5.2.4 Decorating Widgets


Code

class Example(gantt.Standard):
    data = acso
    
    def modify_widget(self, widget, task):
        widget.text(task.to_string["%d"].start,
                    LEFT - 3 * HSEP, VCENTER, 
                    horizontalalignment="right", 
                    verticalalignment="center")
        widget.text(task.to_string["%d"].end,
                    RIGHT + 3 * HSEP, VCENTER, 
                    horizontalalignment="left", 
                    verticalalignment="center")

    def make_diamond_shape(self, widget, title):
        from faces.charting import shapes
        widget.set_shape(shapes.diamond, "milestone")
        widget.text(title, HCENTER, TOP + 2*VSEP,
                    horizontalalignment ="center",
                    verticalalignment="bottom",
                    fontproperties="top")
	return widget

Result

\includegraphics[width=\textwidth]{gencustomize/gantt4}

Description

If you want to influence the creation of a specific shape, you can define a method make_<shape name>_shape. Here make_diamond_shape changes the position of the title from right to top.