active_time = graph.active_time / running_time active_time = round(100 * active_time, 2) var_active.set("Active Time : {}%".format(active_time)) keys_clicks = graph.keypresses / max((graph.clicks + graph.keypresses), 1) keys_clicks = round(100 * keys_clicks, 2) var_cur.set("Current : {} APM".format(cur_apm)) var_cur_hover.set("{} APM".format(cur_apm)) var_max.set("Max : {} APM".format(max_apm)) var_avg.set("Avg : {} APM".format(avg_apm)) var_kc.set("Keypresses : {}%".format(keys_clicks)) Fenetre.update_idletasks() if graph.active != "inactive": stats.after(100, update_stats) # Real-time moving average apm graphing graph = Graph(Fenetre, bg="black", width=width, height=3 * height // 4, max_x=10, max_y=10) graph.place(x=0, y=height // 4) graph.display(intro=True) Fenetre.mainloop() klistener.stop() mlistener.stop()