-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.py
54 lines (42 loc) · 1.01 KB
/
window.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import signal
import time
from functools import partial
from PyQt6.QtWidgets import (
QApplication,
QLabel,
QPushButton,
QVBoxLayout,
QWidget,
)
run = True
def signal_handler(signal, frame):
global run
print("Stopping")
run = not run
signal.signal(signal.SIGINT, signal_handler)
def greet(name):
global run
# if message.text():
# message.setText("")
# print("Clustering Module will be Starting on Next Click")
# else:
# message.setText(f"Cluster Module Stopped, {name}")
while run:
time.sleep(0.19)
print("Transmitting clusters")
run = not run
print("Cluster Module Stopped")
app = QApplication([])
window = QWidget()
window.resize(300, 300)
window.setWindowTitle("Cluster Module")
layout = QVBoxLayout()
button = QPushButton("CLUSTER")
button.clicked.connect(partial(greet, "World!"))
layout.addWidget(button)
message = QLabel("")
layout.addWidget(message)
window.setLayout(layout)
window.show()
app.exec()
# sys.exit(app.exec())