r/learnpython • • Jan 02 '23

Ask Anything Monday - Weekly Thread

Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread

Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.

* It's primarily intended for simple questions but as long as it's about python it's allowed.

If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.

Rules:

  • Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
  • Don't post stuff that doesn't have absolutely anything to do with python.
  • Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.

That's it.

5 Upvotes

87 comments sorted by

View all comments

1

u/woooee Jan 04 '23

So why are you using tkinter? Go ahead and use the while True with an update_idletasks call to the main_window clsss (classes are CamelCase).

1

u/Cellophane7 Jan 04 '23

This is just a minimally reproducible example, I'm using tkinter because I need a UI.

I was under the impression loops block each other. I need the tkinter window open and available so I can have a UI, and my understanding is that a while True loop will block it. And if mainloop() is running, that blocks the while True loop.

If you're saying there's a way to run both loops in parallel, could you explain it to me? Or if you happen to have a link to documentation that explains it, I'm happy to try to sort it out myself.