0
I need the result of the function print((randint(0,700))
appear on the label (label) of my program window (created with Py’s own Qt Designer), and not in the interpreter, but only know the command interface.label.setText("")
which only shows the text placed, nothing more.
That is the programming:
from random import randint
from PyQt5 import QtWidgets, uic
janela=QtWidgets.QApplication([])
interface=uic.loadUi ("hello_interface.ui")
def PRINT():
**interface.label.setText("print(randint(0,700))")**
interface.pushButton.clicked.connect(PRINT)
interface.show()
janela.exec
I just need the result of print(randint)
instead of the code text, please!
It wouldn’t be enough to do
interface.label.setText(randint(0,700))
?– Woss
just need to convert to string -
.setText(str(randint(0, 700))
or.setText(f"{randint(0, 700)}")
– jsbueno