座右铭:怎么简单怎么来,以实现功能为主。
欢迎大家关注公众号与我交流
from PyQt5.QtNetwork import QLocalServer, QLocalSocket
app = QtWidgets.QApplication(sys.argv)
server_name = "your_server_name"
socket = QLocalSocket()
socket.connectToServer(server_name)
if socket.waitForConnected(1000):
app.quit()
else:
local_server = QLocalServer()
local_server.listen(server_name)
app.setQuitOnLastWindowClosed(False)
select = Select()
sys.exit(app.exec_())