goocanvas.CanvasModelSimple — A simple implementation of the canvas model interface.
goocanvas.CanvasModelSimple
is a simple implementation of the
goocanvas.CanvasModel
interface.Typically the canvas model is created, items are added,
and then the model is set in the
goocanvas.CanvasView
:
# Create the canvas view canvas = goocanvas.CanvasView() # create a simple model canvas_model = goocanvas.CanvasModelSimple() # Get the root item of the model root = canvas_model.get_root_item() # Create a rectangle item item = goocanvas.Rect(x=100, y=100, width=400, height=400) # Add the item to the root root.add_child(item) # Pass the model to the GooCanvasView canvas_view(canvas_model)