'Inserting DateTime in a label when cliking a button in PyQt5
I am experiencing some problems with my code whit PyQt5 interfaces (which I'm learning how it works yet). Here is my issue: I create a button and an empty label. This button, when clicked, should insert the current date and time inside the label. However it didn't work. What should I do? Here is my code:
from PyQt5 import uic, QtWidgets
from PyQt5.QtCore import QDateTime
def pagina_1():
hoje = QDateTime.currentDateTime()
heute = ponto_1.pushButton_3.clicked(hoje)
linha1 = ponto_1.lineEdit_1.text()
linha2 = ponto_1.lineEdit_2.text()
linha3 = ponto_1.label_8.setText(heute)
linha4 = ponto_1.timeEdit_4.text()
linha5 = ponto_1.timeEdit_5.text()
print('Nome: ', linha1)
print('Número: ', linha2)
print('Data: ', linha3)
print('Entrada: ', linha4)
print('Saída: ', linha5)
app = QtWidgets.QApplication([])
ponto_1 = uic.loadUi("ponto_1.ui")
ponto_1.pushButton_1.clicked.connect(pagina_1)
ponto_1.show()
app.exec()
below there is a printscreen of my app:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
