Sorry for the noob question, but I really don't get it.
I am using python / tkinter and I want to display something (say a canvas with several shapes on it) and save it until the program terminates. I understand that no widgets will be displayed until I call tkinter.tk.mainloop(). However, if I call tkinter.tk.mainloop(), I cannot do anything until the user closes the main window.
I do not need to track any user input events, just show some things. What a good way to do this without taking control away mainloop?
EDIT:
Is this example code reasonable:
class App(tk.Tk):
def __init__(self, sim):
self.sim = sim
self.loop()
def loop():
self.redraw()
sim.next_step()
self.after(0, self.loop)
def redraw():
EDIT2 (added after_idle):
class App(tk.Tk):
def __init__(self, sim):
self.sim = sim
self.after_idle(self.preloop)
def preloop():
self.after(0, self.loop)
def loop():
self.redraw()
sim.next_step()
self.after_idle(self.preloop)
def redraw():
source