update_idletasks funktioniert nicht in Windows (tkinter)
Verfasst: Mittwoch 26. Oktober 2022, 23:08
Folgender Code funktioniert unter Linux einwandfrei, aber unter Windows wird solange ein blankes Fenster angezeigt bis die gesamte Ausgabe abgearbeitet ist. Woran kann das liegen ?
Code: Alles auswählen
class TkConsole(tk.Tk):
def __init__(self):
........
self.console= tk.Text(self, width=80, height=20)
scroll_bar = tk.Scrollbar(self)
scroll_bar.pack(side=tk.RIGHT)
self.console.pack(side=tk.LEFT)
self.console.config(yscrollcommand=scroll_bar.set)
scroll_bar.config(command=self.console.yview)
........
def open_window(self):
help_button.config(state=DISABLED)
window = Window(self)
def write(self, text):
self.console.update_idletasks()
self.console.insert(tk.END, text)
self.console.yview_pickplace("end")
con = TkConsole()
sys.stdout = con
...... Alles was jetzt ausgegeben wird landet in der TK-Ausgabe
if __name__ == "__main__":
tk.mainloop()