Clicker Game
unknown
plain_text
2 years ago
929 B
9
Indexable
import sys
from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QVBoxLayout
class ClickerApp(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('Clicker App')
self.setGeometry(100, 100, 300, 200)
self.click_count = 0
self.label = QLabel('Clicks: 0', self)
self.button = QPushButton('Click me', self)
self.button.clicked.connect(self.increment_click_count)
layout = QVBoxLayout()
layout.addWidget(self.label)
layout.addWidget(self.button)
self.setLayout(layout)
def increment_click_count(self):
self.click_count += 1
self.label.setText(f'Clicks: {self.click_count}')
def main():
app = QApplication(sys.argv)
clicker_app = ClickerApp()
clicker_app.show()
sys.exit(app.exec())
if __name__ == '__main__':
main()
Editor is loading...
Leave a Comment