If this has already been posted and answered I couldn't find it by searching. I am trying to use a tkinter scrolledtext widget to serve as a basic text display for file operations the script I'm writing will perform. Why would I want to do this? I don't like how the terminal limits how far you can scroll, how it looks, and I think this looks much more streamlined into a simple GUI.
I know we can create a simple scrolledtext widget like so and also disable user input and deleting with setting the state to state = disabled
. Since these is just serving as a text area to display essentially what's happening I don't need any input from the user merely a read-only interface. However, setting the state to disabled prevents insert
from being used to insert the updates themselves.
Is there a way around this? Simpler alternative methods are also welcome. I could use a label, but then I'd have scrolling issues.
I realize I could change the state before and after inserting, from normal to disabled, but seems like there should be a simpler solution.
text_area = ScrolledText(master = root, wrap = tk.WORD, state = tk.DISABLED)
text_area.pack(side = tk.TOP, fill = tk.BOTH, expand = True)
text_area.insert(tk.INSERT, some_text_here) #No longer works
Setting the state from disable to normal, inserting text, and setting it back to disabled, is the simplest solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With