Digital Solutions

Lesson: GUI__images


Example 1: PySimpleGUI/image1.py:
import PySimpleGUI as PSG rows = [ [PSG.Image("atari.gif")] ] form = PSG.FlexForm("This is a form.") form.Layout(rows) button, value = form.Read()
Example 2: PySimpleGUI/image2.py:
import PySimpleGUI as PSG myImage = PSG.Image("heads.png") rows = [ [myImage], [PSG.ReadFormButton("Swap image")] ] form = PSG.FlexForm("This is a form.") form.Layout(rows) button, value = form.Read() if button == "Swap image": myImage.Update("atari.gif")
Example 3: PySimpleGUI/image3.py:
import PySimpleGUI as PSG message = PSG.Text("Welcome") rows = [ [message], [PSG.ReadFormButton("Atari",image_filename="atari.gif")] ] form = PSG.FlexForm("This is a form.") form.Layout(rows) button, value = form.Read() if button == "Atari": message.Update("Clicked on Atari")

  1. Can you create a Heads or Tails coin flipper?

  2. Can you create a random Card Draw app?


cards.zip
heads.png
tails.png
dice.zip
atari.gif