import sys
import time
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication,QMainWindow
class Mywindow(QMainWindow):
def init(self):
super(Mywindow, self).init()
self.setGeometry(50, 50, 250, 350)
self.setWindowTitle("Kontrol Paneli")
self.label_1 = QtWidgets.QLabel(self)
self.label_1.setText("Ledler Pasif")
self.label_1.move(50, 150)
self.buton_yak = QtWidgets.QPushButton(self)
self.buton_yak.setText("Led Yak")
self.buton_yak.move("30,210")
self.buton_sondur = QtWidgets.QPushButton(self)
self.buton_sondur.setText("Led Söndür")
self.buton_sondur.move("140,210")
self.line_edit_1=QtWidgets.QLineEdit(self)
self.line_edit_1.move(80,80)
# signal slot ilişkilerinin tanımlanması
self.buton_yak.clicked.connect(self.yazdir)
self.buton_sondur.clicked.connect(self.buton_sondur)
def yazdir(self):
self.label_1.setText("Led Yandı")
for i in range(5):
print(f"Led yandı {i} defa yandı")
time.sleep(1)
def led_sondur(self):
self.label_1.setText("Led Söndü")
print("led söndü")
def main():
app = QApplication(sys.argv)
win = Mywindow()
win.show()
exit(app.exec())
if __name__ == 'main':
main()