Python GUIs - "The Official PySimpleGUI Course" - Coding Exercises

Lesson 37

Image Element

Exercise 1

Make a digital clock using images of handwritten numerals

Instructions:

Image Element in the Call Reference Documentation

A little background on the images. The images used in this exercise were taken from the MNIST Dataset. This database is used by many machine learning programs to train AI algorithms to recognize handwritten numerals.

You can learn more about the MNIST Dataset by visiting the DeepAI website https://deepai.org/dataset/mnist

Hints:

  • Having trouble with space between your Image Elements? Set the padding to (0,0) for your Image elements so that the images are flush
  • Use f-strings as a quick way to format the time
    • Get the current datetime: `now = datetime.datetime.now()
    • To format in HH:MM:SS, use this f-string: f'{now:%I}:{now:%M}:{now:%S}'
  • To make a right click menu that has only exit, you can use the pre-defined right click menu sg.MENU_RIGHT_CLICK_EXIT. Set your Window parameter right_click_menu to this value
  • You will need 8 Image elements in order to display HH:MM:SS

Enter your solution here

Solution