python - How to prevent Tkinter and Pyserial from blocking entire program execution -
i writing program involves usage of tkinter (for gui), pyserial (serial communication device), , tweepy. current flow of execution follow:
- gui class instantiated (based on tkinter). set of code uses tkinter's standard key binding functions well.
- gui class creates non-blocking serial connection internally. used writing, not reading.
- program proceeds create tweepy stream instance, , listens tweets.
the gui, , tweepy instances work fine separately. however, when called sequentially, stops @ (2). tweepy initialized after tkinter window closed.
is there way make both tweepy , gui work concurrently (similar multithreading, except objects should have references each other?)
found solution. used threading class.
apparently, had call gui initializer method using thread_1 = threading.thread() , thread_1.start(). other functions did not have run threads.
these might prove helpful has encountered same problem: http://softwareramblings.com/2008/06/running-functions-as-threads-in-python.html
Comments
Post a Comment