Web Analytics Made Easy - Statcounter
Skip to content

Image

Image Element - show an image in the window. Should be a GIF or a PNG only

Image(
    filename = None,
    data = None,
    background_color = None,
    size = (None, None),
    pad = None,
    key = None,
    tooltip = None,
    right_click_menu = None,
    visible = True,
    enable_events = False
)

Parameter Descriptions

Name Type Default Description
background_color str None color of background. Can be in #RRGGBB format or a color name "black"
data bytes or str or None None Raw or Base64 representation of the image to put on button. Choose either filename or data
enable_events bool False Turns on the element specific events. Combo event is when a choice is made
filename str or None None image filename if there is a button image. GIFs and PNGs only.
key str or int or tuple or object None Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element
pad (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),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)
right_click_menu List[List[ List[str] or str ]] None A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.
size (int, int) or (None, None) (None, None) (width, height) size of image in pixels
tooltip str None text, that will appear when mouse hovers over the element
visible bool True set visibility state of the element (Default = True)

Class Properties

This class has no public properties

Class Methods

 def update

update

Changes some of the settings for the Image Element. Must call Window.Read or Window.Finalize prior.

Changes will not be visible in your window until you call window.read or window.refresh.

If you change visibility, your element may MOVE.

update(
    filename = None,
    data = None,
    size = (None, None),
    visible = None
)

Parameter Descriptions

Name Type Default Description
data str or tkPhotoImage None Base64 encoded string OR a tk.PhotoImage object
filename str None filename to the new image to display.
size (int, int) (None, None) (width, height) size of image in pixels
visible bool None control visibility of element