Files
pythonkurs/teil29/handleButton.py
2025-02-16 14:39:34 +01:00

31 lines
627 B
Python
Executable File

#! /usr/bin/python
#Datei: handleButton.py
import sys
from PyQt6.QtWidgets import QApplication, QMainWindow, QPushButton
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Button Signal")
button = QPushButton("Bitte klicken")
button.setCheckable(True)
button.clicked.connect(self.handle_button_click)
# Set the central widget of the Window.
self.setCentralWidget(button)
def handle_button_click(self):
print("Button geklickt")
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()