diff --git a/oop-exam/timer.py b/oop-exam/timer.py deleted file mode 100644 index a5e4931..0000000 --- a/oop-exam/timer.py +++ /dev/null @@ -1,43 +0,0 @@ -import sys -from PyQt6.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QVBoxLayout -from PyQt6.QtCore import QTimer - -class SimpleTimer(QWidget): - def __init__(self): - super().__init__() - self.setWindowTitle("Таймер") - - self.label = QLabel("0") - self.seconds = 0 - - self.start_button = QPushButton("Старт") - self.start_button.clicked.connect(self.start_timer) - - self.stop_button = QPushButton("Стоп") - self.stop_button.clicked.connect(self.stop_timer) - - layout = QVBoxLayout() - layout.addWidget(self.label) - layout.addWidget(self.start_button) - layout.addWidget(self.stop_button) - self.setLayout(layout) - - self.timer = QTimer() - self.timer.timeout.connect(self.update_time) # вызывается каждый тик - self.timer.setInterval(1000) # 1000 мс = 1 секунда - - def start_timer(self): - self.timer.start() - - def stop_timer(self): - self.timer.stop() - - def update_time(self): - self.seconds += 1 - self.label.setText(str(self.seconds)) - -if __name__ == "__main__": - app = QApplication(sys.argv) - timer = SimpleTimer() - timer.show() - sys.exit(app.exec()) \ No newline at end of file