pyworkflow.gui.graph module

This module implements a simple algorithm to display a graph(mainly a tree) level by level, using only Tkinter.

class pyworkflow.gui.graph.LevelTree(graph)[source]

Bases: object

Class to render the Graph in a Canvas.

paint(createNode=None, createEdge=None, maxLevel=9999, usePositions=False)[source]

Paint the Graph, nodes will be positioned by levels. Params:

canvas: the canvas object to paint the graph. createNode: function to build the Item that represents a Node.

the Item created should have the following methods:

getDimensions: return the width and height moveTo: change the position of the Item

createEdge: function to build an Edge connection two Nodes usePositions: if this is True, use the nodes positions without

recomputing them.

If createNode and createEdge are None, the default ones will be used, that requires the setCanvas method had to be called first.

setCanvas(canvas)[source]