Dufam
Dufam

Reputation: 27

is there a way to display an image over image in pySimpleGui?

i am trying to make a changble speedometer is there a way to display one image over image in pySimpleGui

import PySimpleGUI as gui


layout = [[gui.Image(filename = 'cardashboard\Speedometer.png')],
          [gui.Image(filename = 'cardashboard\Arrow.png')]]
window = gui.Window("Car Dashboard", layout)

while True:
    event, values = window.read()
    if event == gui.WIN_CLOSED:
        break
      
window.close()

Upvotes: 2

Views: 1229

Answers (1)

Alderven
Alderven

Reputation: 8270

Yes, as Jason Yang mentioned it is possible with draw_image of Graph element:

import PySimpleGUI as psg

psg.theme('DarkAmber')
layout = [[(psg.Graph((400, 190), (0, 0), (400, 190), key='Graph'))]]
window = psg.Window('Car Dashboard', layout, finalize=True)
window['Graph'].draw_image(filename='Speedometer.png', location=(0, 200))
window['Graph'].draw_image(filename='Arrow.png', location=(190, 170))
while True:
    event, values = window.read()
    if event == psg.WIN_CLOSED:
        break

window.close()

Car Dashboard

Upvotes: 2

Related Questions