Web Analytics Made Easy - Statcounter
Skip to content

Canvas

Canvas call reference

layout = [[sg.Canvas(background_color='red', size=(100, 100))]]

canvas

The Canvas element is used primarily as a way to integrate PySimpleGUI with another Python package such as matplotlib. Other packages that understand how to work specifically with a tkinter Canvas widget fall into this category. You could also use a Graph element, which is implemented using a tkinter Canvas widget, by accessing the tk_canvas member variable for your Graphelement.

If you are integrating with another Python package, but in a more indirect manner, such as OpenCV, then you would use an Image element or a Graph element without any knowledge of the underlying implementation. This is the preferred method as it enables you to run your application on more than 1 port of PySimpleGUI. Using the Canvas element means you'll be limiting your application to only run on tkinter.

Events

No events are generated by a Canvas element

Values Dictionary

There are no entries in the values dictionary for a Canvas element.

To access with tkinter widget, use the TKCanvas class property of the Canvas element.