Added missing files and removed unnessesary ones
This commit is contained in:
37
Python/clock/main.py
Executable file
37
Python/clock/main.py
Executable file
@ -0,0 +1,37 @@
|
||||
import sys
|
||||
from time import strftime
|
||||
|
||||
from PyQt6.QtCore import QTimer
|
||||
from PyQt6.QtWidgets import QApplication, QLCDNumber, QVBoxLayout, QWidget
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setGeometry(100, 100, 800, 400)
|
||||
self.setWindowTitle("Clock")
|
||||
vbox = QVBoxLayout()
|
||||
|
||||
self.timer = QTimer()
|
||||
self.timer.timeout.connect(self.update_clock)
|
||||
self.timer.start(200)
|
||||
|
||||
self.lcd = QLCDNumber()
|
||||
vbox.addWidget(self.lcd)
|
||||
self.setLayout(vbox)
|
||||
|
||||
def update_clock(self) -> None:
|
||||
time_ = strftime("%H:%M:%S")
|
||||
self.lcd.setDigitCount(8)
|
||||
self.lcd.display(time_)
|
||||
|
||||
|
||||
def main():
|
||||
app = QApplication(sys.argv)
|
||||
window = Window()
|
||||
window.show()
|
||||
sys.exit(app.exec())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user