Web Analytics Made Easy - Statcounter
Skip to content

Canvas

Canvas Element

Canvas(
    canvas = None,
    background_color = None,
    size = (None, None),
    pad = None,
    key = None,
    tooltip = None
)

Parameter Descriptions

Name Type Default Description
background_color str None color of background. Can be in #RRGGBB format or a color name "black"
canvas (tk.Canvas) or None None Your own Canvas if you already created it. Leave blank to create a Canvas
key str or int or tuple or object None Used with window.find_element and with return values to uniquely identify this element
pad (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int None Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
size (int, int) or (None, None) (None, None) (width in char, height in rows) size in pixels to make canvas
tooltip str None text, that will appear when mouse hovers over the element

Class Properties

tk_canvas

tk_canvas

Returns the underlying tkinter Canvas widget

tk_canvas
Parameter Descriptions

Name Type Default Description
RETURN (tk.Canvas) The tkinter canvas widget

Class Methods

 def update

update

Updates the element

update(
    widget,
    background_color = None,
    text_color = None,
    font = None,
    visible = None,
    disabled = None,
    tooltip = None
)

Parameter Descriptions

Name Type Default Description
background_color None Widget background color
disabled bool None Is the element disabled
font None Text font
text_color None Text color
tooltip None Tooltip to be shown
visible bool None Is the element visible
widget The widget to be updated