I am beginner and following a course on Python GUIs. This time he is teaching a GUI done on QT designer and then translated to python code using PySide.
The problem is that the event is not printed if I click one button.
Link to see translated PySide2 ui_calculadora.py below: https://drive.google.com/file/d/1G3xXnz1WBSdns8gLkFNwcwAkwZXdOqrL/view?usp=sharing
import sys
from PySide2.QtWidgets import *
from VISTA.ui_calculadora import Ui_Calculadora
class Calculadora(QDialog):
def __init__(self):
super(Calculadora, self).__init__()
self.calculadora = Ui_Calculadora()
self.calculadora.setupUi(self)
def keyPressEvent(self, event):
print('Key: ' + str(event.key()) + ' | Text Press: ' + str(event.text()))
if __name__ == "__main__":
print("----Example Starts----")
app = QApplication(sys.argv)
mi_aplicacion = Calculadora()
mi_aplicacion.show()
sys.exit(app.exec_())
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…