#๐Ÿ”’ tkinter issue

12 messages ยท Page 1 of 1 (latest)

dapper mason
#

i'm trying rn to give an interface, gui to my code so that it's easier to experience with it, and trying to make one with tkinter rn, the code is alr i just got a problem wit the root.mainloop() which is just blocking my whole code after it, and if i try to put it a the end of my code it's just making the interface showing really late

silent hazelBOT
#

@dapper mason

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

dull glacier
#

Mainloop blocks everything because it makes the gui listen to events in the current thread. Meaning it's busy. You gotta make another thread to have both gui and something running in the background at the same time

dapper mason
#

oh

#

how do i do that tho?

dull glacier
#

Mainloop is called like that because internally it's literally a loop - loop ends only of the main window closes, otherwise it checks for events (clicking buttons, keys, mouse events, etc), does stuff related to those events... then checks for new events.

dapper mason
#

so another thread seem a good deal but idek how it works

dull glacier
# dapper mason how do i do that tho?

You gotta learn about threading. Idk what's a good resource for that. I think realpython had some explanation about threading ๐Ÿค” but I'm not sure, I've never taught anyone about those, and I learned threads before I learned python...

dapper mason
#

alr thanks

silent hazelBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.