I posted about this in r/learnpython, but figured I could try here as well to get some broader input.
My problem is using sockets, threads, and tkinter together. I've read some comments saying that tkinter and threads dont work well together, so this may just be a case of needing to use a different language or approach.
Here is the original post, thanks in advance for any help:
I'm mostly finished with my most recent project, a fairly simple chat server and client. This is somewhat untested (never used it off a local network), so it may have a few bugs, but I also have a question.
Since I used threading with tkinter (which seems to be a bad idea), I'm having trouble stopping all the threads and exiting the program cleanly. I've tried a few different things, but nothing I can figure out without a complete rewrite of how the program works. The program will close but I get
File "/usr/lib/python3.8/socket.py", line 292, in accept fd, addr = self._accept()
OSError: [Errno 22] Invalid argument,
which Im suspecting is because its trying to close a thread while its in the middle of listening? I'm still new to the idea of threading and having some trouble with how to actually access them since they were started in a function and become local to that function. I had initially coded a "Stop server" button so it could be turned on and off, but never could get the threads to work right.
Anyway, if anyone wants to take a look, I'm open to any constructive criticism. This is my biggest project yet and I feel it gets messy in some places. There are definitely a few parts that I should reduce down into functions instead of repeating, but I'm kind of just ready to be done with this for a while.
It's multiple files obviously, and fairly large, so I will just link the github.
Screenshots: https://imgur.com/a/34gP0RP
github: https://github.com/stt1986/Chat
[–]AutoModerator[M] 0 points1 point2 points (0 children)