Below is my attempt of having the counter variable increment as each second passes by. It's not working like I thought it would. I think the problem is in the while loop of trying to compare old time to new time to measure if a second has passed.
import time as time import tkinter as tk root = tk.Tk() root.geometry('200x200') months = {'1': 'Month of Flowers', '2': 'Month of Moon', '3': 'Month of Dragon'} hours = {'1': '1st hour', '2': '2nd hour', '3': '3rd hour'} system_time = tk.Label(root, text=f'{time.time()}') system_counter = tk.Label(root, text='0') game_time_month = tk.Label(root, text='Month') game_time_hour = tk.Label(root, text='Hour') system_time.pack() system_counter.pack() game_time_month.pack() game_time_hour.pack() def update_all_time(): system_time['text'] = f'{time.time()}' game_time_month['text'] = 'Month' game_time_hour['text'] = 'Hour' root.update() system_timer_old = time.time() counter = 0 while True: system_timer_new = time.time() if system_timer_new == system_timer_old + 1: counter = counter + 1 system_counter['text'] = 1 update_all_time() root.mainloop()
time.time()multiple times , alsosystem_timer_new == system_timer_old + 1may not yield True at all, as the return value is a high precision float. And its a millisecond timestamp. I suppose you are looking for seconds here ?