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,
    data_base64 = None,
    background_color = None,
    size = (None, None),
    pad = None,
    key = None,
    k = None,
    tooltip = None,
    click_submits = False,
    enable_events = False,
    visible = True,
    size_px = (None, None),
    metadata = None
)

Parameter Descriptions

Name Type Default Description
background_color str None color of background. Can be in #RRGGBB format or a color name "black"
click_submits bool False DO NOT USE. Only listed for backwards compat - Use enable_events instead
data bytes or str or None None Raw or Base64 representation of the image to put on button. Choose either filename or data
data_base64 str None base64 encoded string
enable_events bool False Turns on the element specific events. For an Image element, the event is "image clicked"
filename str or None None image filename if there is a button image. GIFs and PNGs only.
k str or int or tuple or object None Same as the Key. You can use either k or key. Which ever is set will be used.
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
metadata Any None User metadata that can be set to ANYTHING
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)
size (int, int) or (None, None) (None, None) w=characters-wide, h=rows-high
size_px (int, int) or (None, None) (None, None) w=pixels-wide, h=pixels-high
tooltip str None text, that will appear when mouse hovers over the element
visible bool True set visibility state of the element

Class Properties

This class has no public properties

Class Methods

 def expand
 def get_stylesheet
 def set_stylesheet
 def update

expand

WARNING - NOT USED IN PySimpleGUIQt port. Provided as dummy method

expand(
    expand_x = False,
    expand_y = False,
    expand_row = True
)

Parameter Descriptions

Name Type Default Description
expand_row bool True If True the row containing the element will also expand. Without this your element is "trapped" within the row
expand_x bool False If True Element will expand in the Horizontal directions
expand_y bool False If True Element will expand in the Vertical directions
RETURN None None

get_stylesheet

Returns the stylesheet for element's associated Qt Widget

get_stylesheet()

Parameter Descriptions

Name Type Default Description
RETURN str stylesheet

set_stylesheet

Sets the stylesheet for a Qt Widget

set_stylesheet(
    stylesheet
)

Parameter Descriptions

Name Type Default Description
stylesheet str Stylesheet (string) to set stylesheet to

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,
    data_base64 = None,
    size = (None, None),
    visible = None
)

Parameter Descriptions

Name Type Default Description
data bytes or str or None None Raw or Base64 representation of the image to put on button. Choose either filename or data
data_base64 str None base64 encoded string
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 set visibility state of the element (Default = True)