I have a question for pyqt5.

Asked 1 years ago, Updated 1 years ago, 111 views

Recently, I am making a simple socket chat program with pyqt5.

In this process, I would like to make a color pallet that can determine the color of the font using the combo box

I want to know how to put the color in the combo box item.

Second, the socket multi-chat program implemented server recv as thread, which is provided by default

Problem occurs with the directly implemented exit button rather than the X mark in the window window.

The end button was implemented using app.quit(), sys.exit(1), etc.

When you click the button, the program stops.

I think it's because the thread is working on the expected phenomenon.

I want to know how to end the thread.

Please answer me. Thank you.

pyqt5 python combobox color thread

2022-09-21 21:13

1 Answers

Of course, you have to gracefully end it.

I'm sure the recv is waiting around the infinite loop.

In the part of listening to the data, configure the code so that you can escape at any signal, not just an infinite loop, and sock after escape.Shutdown(socket.SHUT_RDWR) and close() should be called.

https://docs.python.org/ko/3/howto/sockets.html#disconnecting

Refer to the link above

And this was bookmarked a long time ago

https://engineering.imvu.com/2014/03/06/charming-python-how-to-actually-close-a-socket-by-calling-shutdown-before-calling-close/

Read this article, too.


2022-09-21 21:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.