i'm trying to create a big clock as a gui test project. The window should run without any input and just display the time while updating 10 times a second. Regardless of what i tried so far i cannot get the text to update with my current time.
Here's my code:
import PySimpleGUI as gui
import time
gui.theme('Reddit')
clockFont = ('Arial', 72)
layout = [
[gui.Text('Loading...',size=(8,2), justification='center', key='CLK', font=clockFont)]
]
window = gui.Window('Big Clock', layout, size=(500, 150), finalize=True)
window.Resizable = True
while True:
event, values = window.read()
print(event)
if event in (None, gui.WIN_CLOSED):
break
if event == 'Run':
currentTime = time.strftime("%H:%M:%S")
window['CLK'].update(currentTime)
window.refresh()
time.sleep(0.1)
window.close()
Additionally someone on StackOverflow said in a post that one should not use time.sleep() in a looped environment. What should i use instead?