Pyqt: Variable Values In Qmessagebox Output?
Right now I'm displaying a window with text in a QMessageBox. It works and displays the text accurately. profBox = QMessageBox() QMessageBox.about(self,'Profile', 'Gender:
Solution 1:
Use str.format
:
>>>gender = 'M'>>>age = 33>>>"Gender: {}<br /> Age: {}< br />".format(gender, age)
'Gender: M<br /> Age: 33< br />'
or use %
operator:
>>> "Gender: %s<br /> Age: %s< br />" % (gender, age)
'Gender: M<br /> Age: 33< br />'
Post a Comment for "Pyqt: Variable Values In Qmessagebox Output?"