Hi, so I'm having quite the difficulty here. Let me start by explaining the architecture of my scripts. My "Listener.py" is a script that uses asyncore in order to listen for connections and receive commands from them. If it receives the text "play" from a connection, it calls another script, "MusicPlayer.py," that uses the tkSnack library to play a sound file (which requires root.mainloop() to be called). So, I have that working well. Listener.py receives a connection, receives the text "play," and calls "MusicPlayer.py" to play a sound file.
Now, here is where the trouble begins. What good is playing music if you can't pause/stop/restart/etc. it? If I don't change anything about my scripts, the mainloop of Tkinter prevents Listener.py from receiving any more connections/data.
Immediately, I thought to myself, "Oh, no problem! I can just give MusicPlayer.py it's own thread and then I can continue receiving connections/data!" Sadly, this didn't work. It gives me the following error from Tkinter:
RuntimeError: main thread is not in main loop . I guess Tkinter doesn't want its main loop inside a separate thread.
So...what can I do about this? If I were to put Listener.py into another thread, I would have the same problem...asyncore requires that you call its mainloop method, and I would be willing to bet it would give me the same error as Tkinter did.
Thanks so, so much in advance.