#!/usr/bin/env python # Erster Python TEST mit SimpleGUI! import PySimpleGUI as sg def zaehlen(taste): global z_heim, z_gast, z_bahn flag = False if taste[0] == 'q': if z_heim < 99: z_heim += 1 flag = True # print(z_heim) elif taste[0] == 'a': if z_heim > 0: z_heim -= 1 flag = True # print(z_heim) elif taste[0] == 'w': if z_gast < 99: z_gast += 1 flag = True # print(z_gast) elif taste[0] == 's': if z_gast > 0: z_gast -= 1 flag = True # print(z_gast) elif taste[0] == 'e': z_bahn += 1 flag = True if z_bahn > 9: z_bahn = 1 # print(z_gast) elif taste[0] == 'r': z_heim, z_gast = 0, 0 flag = True if flag: window["-heim-"].update("{:02d}".format(z_heim)) window["-gast-"].update("{:02d}".format(z_gast)) window["-bahn-"].update(z_bahn) sg.theme('Black') bahn = sg.Text('1', font=("DSEG7 classic mini", 150), text_color = "white", justification = "center", size = 14, key = "-bahn-") heim = sg.Text('00', font=("DSEG7 classic mini", 400), text_color = "orange red", key = "-heim-") gast = sg.Text('00', font=("DSEG7 classic mini", 400), text_color = "pale green", key = "-gast-") trennung = sg.Text(':', font=("DSEG7 classic mini", 400, "bold"), text_color = "white") layout = [ [bahn], [heim, trennung, gast] ] z_heim = 0 z_gast = 0 z_bahn = 1 window = sg.Window('Window Title', layout, size=(1920, 1080), no_titlebar = True, return_keyboard_events=True, finalize=True) window.set_cursor("none") while True: event, values = window.read(timeout=1000) if event is not sg.TIMEOUT_KEY and event is not None: zaehlen(event) if len(event) == 1: print('%s - %s' % (event, ord(event))) else: print(event) if event[0:6] == 'Escape': break elif event == sg.WIN_CLOSED: break window.close()