pysimplegui_01.py

#! /usr/bin/python3
# ===================================================================
# create a simple graphic interface using PySimpleGUI
# -------------------------------------------------------------------
# From: www.linux-magazine.com/Issues/2020/241/PySimpleGUI/
# -------------------------------------------------------------------
# to install Tkinter ->
#      sudo apt install python-tk
# to display what version you are running ->
#      python3 -m tkinter
# ===================================================================

import tkinter

import PySimpleGUI as sg

layout = [[sg.Text("the feedback", key="feedback")],
          [sg.Button("FORWARD")],
          [sg.Button("LEFT"),sg.Button("Right")],
          [sg.Button("STOP")],
          [sg.Button("Quit")]]

# create window

window = sg.Window('my First App',layout)

# Event loop to process 'events'

while True:

    event,values = window.Read()

    window['feedback',update(event)] # show the button in the feedback

    print(event,values)

    if event in (None,'QUIT'):
        break

window.close()