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()