aboutsummaryrefslogtreecommitdiffstats
path: root/examples/network/threadedfortuneserver/threadedfortuneserver.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/threadedfortuneserver/threadedfortuneserver.py')
-rw-r--r--examples/network/threadedfortuneserver/threadedfortuneserver.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/network/threadedfortuneserver/threadedfortuneserver.py b/examples/network/threadedfortuneserver/threadedfortuneserver.py
index 839a2a57e..deb993b71 100644
--- a/examples/network/threadedfortuneserver/threadedfortuneserver.py
+++ b/examples/network/threadedfortuneserver/threadedfortuneserver.py
@@ -111,8 +111,9 @@ class Dialog(QDialog):
quitButton.setAutoDefault(False)
if not self.server.listen():
+ reason = self.server.errorString()
QMessageBox.critical(self, "Threaded Fortune Server",
- "Unable to start the server: %s." % self.server.errorString())
+ f"Unable to start the server: {reason}.")
self.close()
return
@@ -123,9 +124,10 @@ class Dialog(QDialog):
ipAddress = QHostAddress(QHostAddress.LocalHost)
ipAddress = ipAddress.toString()
+ port = self.server.serverPort()
- statusLabel.setText("The server is running on\n\nIP: %s\nport: %d\n\n"
- "Run the Fortune Client example now." % (ipAddress, self.server.serverPort()))
+ statusLabel.setText(f"The server is running on\n\nIP: {ipAddress}\nport: {port}\n\n"
+ "Run the Fortune Client example now.")
quitButton.clicked.connect(self.close)