Make button checkable
This commit is contained in:
parent
8b447c240c
commit
0692a45f09
1 changed files with 9 additions and 0 deletions
|
|
@ -12,6 +12,9 @@ class leekMainWindow(QMainWindow):
|
|||
self.setWindowTitle("Leek!")
|
||||
|
||||
button = QPushButton("Press Me!")
|
||||
button.setCheckable(True)
|
||||
button.clicked.connect(self.button_clicked)
|
||||
button.clicked.connect(self.button_toggled)
|
||||
|
||||
self.setMaximumSize(QSize(800,600))
|
||||
self.setMinimumSize(QSize(400,300))
|
||||
|
|
@ -19,6 +22,12 @@ class leekMainWindow(QMainWindow):
|
|||
# Set the central widget of the Window.
|
||||
self.setCentralWidget(button)
|
||||
|
||||
def button_clicked(self):
|
||||
print("Button was clicked")
|
||||
|
||||
def button_toggled(self, checked):
|
||||
print("Checked?", checked )
|
||||
|
||||
|
||||
def main():
|
||||
# If you know you won't use command line arguments QApplication([]) works too.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue