Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
from functools import partial
|
||||
from itertools import count
|
||||
|
||||
from PyQt5.QtWidgets import (QApplication,
|
||||
QLabel,
|
||||
QPushButton,
|
||||
QWidget)
|
||||
from PyQt5.QtCore import QRect
|
||||
|
||||
LABEL_GEOMETRY = QRect(0, 15, 200, 25)
|
||||
BUTTON_GEOMETRY = QRect(50, 50, 100, 25)
|
||||
|
||||
|
||||
def on_click(_, label, counter=count(1)):
|
||||
label.setText(f"Number of clicks: {next(counter)}")
|
||||
|
||||
|
||||
def main():
|
||||
application = QApplication([])
|
||||
window = QWidget()
|
||||
label = QLabel(text="There have been no clicks yet",
|
||||
parent=window)
|
||||
label.setGeometry(LABEL_GEOMETRY)
|
||||
button = QPushButton(text="click me",
|
||||
parent=window)
|
||||
button.setGeometry(BUTTON_GEOMETRY)
|
||||
update_counter = partial(on_click,
|
||||
label=label)
|
||||
button.clicked.connect(update_counter)
|
||||
window.show()
|
||||
application.lastWindowClosed.connect(window.close)
|
||||
application.exec_()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue