import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
def buttonAction():
print("You clicked on the button !")
app = QApplication(sys.argv)
widget = QWidget()
myButton = QPushButton(widget)
myButton.setText("Click here !")
myButton.move(50 , 30)
myButton.clicked.connect(buttonAction)
widget.setGeometry(100, 100 , 320 , 200)
widget.setWindowTitle("Example of PyQt5 Button")
widget.show()
sys.exit(app.exec_())
Younes Derfoufi
my-courses.net
my-courses.net