I'm just experimenting with this. Whenever a user opens the program he should get 'online' and listen for connections.
Here the GUI gets loaded.
class AppUI(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUi()
def initUi(self):
self.parent.title("Redux")
self.pack(fill=BOTH, expand=1)
self.initMenu()
self.initAudio()
self.initMidi()
self.initBroadcast()
self.initFriendList()
But whenever I paste the code of my thread under initUi, it get's stuck on loading and my GUI doesn't show up. (keeps loading, because the thread is listening to connections)
thread2 = threading.Thread(target=Connection().getOnline("", 50007))
thread2.start()
Class Connection():
def getOnline(self, host, port):
self.s.bind((host, port))
self.s.listen(2)
print('Now online - listening to connections')
conn, addr = self.s.accept()
print("Connected to:", addr)
Why is my thread not working?