2

I am new to tkinter. I need to show in a text box some informations about the ongoing process. The code below prints the two messages at exit. How can I refresh the box whenever I need?

Self.txtbox.insert("end", "wait...")

do_something_long() Self.txtbox.insert("end", "done\n")

5
  • you should post an stackoverflow.com/help/mcve ... What is the type of txtbox Commented Sep 30, 2017 at 6:03
  • Apologizes for the bad presentation of the code. I am on my IPad. I did my best but I could not manage to get it right. Thanks. Commented Sep 30, 2017 at 6:08
  • What do you mean by refresh? Delete all text in it? Commented Sep 30, 2017 at 6:26
  • The text box is of type Text. Commented Sep 30, 2017 at 6:34
  • Refresh means update. In the sample code, I want to print the "wait..." message BEFORE the tricky calculation starts. By default, the text box is updated at the exit of the function. Commented Sep 30, 2017 at 6:36

1 Answer 1

2

Insert this line right after changing the content of the text box will force it to refresh immediately.

Self.update_idletasks()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.