I developped a small application, but I would like to know how to add a simple counter inside a message box.
The message box, from QT designer, can appear 3 times. I would like to see the number in the message box.
Let's say it appears the first time, I should see -> 1, a second time, I should see -> 2, a third time -> 3.
Here is the part of the code:
else:
second_message_box(QMessageBox.Critical,
"Attention!",
"Il n'est pas possible d'ajouter L'inspecteur " + employeesChosen[i],
QMessageBox.Ok)
I tried this, but it always gives me "1", it never iterate, even when the message box opens more than one time.
else:
count = 0
count += 1
second_message_box(QMessageBox.Critical,
str(count),
"Il n'est pas possible d'ajouter L'inspecteur " + employeesChosen[i],
QMessageBox.Ok)
edit 3:
I did that
count = 0
def foo():
...
else:
global counter
count += 1
second_message_box(QMessageBox.Critical,
str(count),
"Il n'est pas possible d'ajouter L'inspecteur " + employeesChosen[i],
QMessageBox.Ok)
question from:
https://stackoverflow.com/questions/65839344/how-to-add-enumerate-or-a-simple-counter-inside-a-message-box 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…