0

This is a simple customtkinter code with a textbox area.

import import customtkinter as ctk

def print_something():
    print ('Print some text\n' * 50)

# Appearance window
ctk.set_appearance_mode('system') # Modes: system (default), light, dark
ctk.set_default_color_theme('blue') # Themes: blue (default), dark-blue, green

# Create main window
main_window = ctk.CTk()
main_window.geometry('400x400')
main_window.title('Login')

# Create textbox
textbox = ctk.CTkTextbox(main_window)
textbox.pack()

print_something()
main_window.mainloop()

How can i redirect in real time the terminal output to the textbox (errors, print's, etc.)?

I try this:

textbox = ctk.CTkTextbox(main_window)
textbox.insert('0.0', print_something)
textbox.pack()
Chris
  • 13
  • 2
  • Unrelated to the question being asked, `"0.0"` is technically invalid. The first character in a text widget is `"1.0"`. – Bryan Oakley Mar 28 '23 at 22:02
  • There are questions on redirecting console output to a tkinter text box, try to search them. – acw1668 Mar 29 '23 at 00:07

0 Answers0