4

I am trying to display a variable with some message in qmessagebox using creator. I found similar post here: pyqt: Variable values in QMessageBox output? but it does not work within the creator. Any suggestions how to amend the code below so that it worked?:

purchaseValue = col2SumUp.sum()
msgbox = QMessageBox(QMessageBox.Information, "Value: %s" % purchaseValue, QMessageBox.Ok)
New2coding
  • 715
  • 11
  • 23

1 Answers1

3

You are missing the title parameter, the following is working for me:

purchaseValue = 125.2
msgbox = QMessageBox(QMessageBox.Information, "Title", "Value: %s" % purchaseValue, QMessageBox.Ok)
msgbox.exec_()

QMessageBox

Isma
  • 14,604
  • 5
  • 37
  • 51