-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.py
63 lines (53 loc) · 2.03 KB
/
gui.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
55
56
57
58
59
60
61
62
63
import sys
from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton
from PyQt6.QtGui import QFont
from PyQt6.QtCore import Qt
class MyWindow(QWidget):
def __init__(self):
super().__init__()
# Set up the window
self.setWindowTitle("Styled Basketball Stats GUI")
self.setGeometry(200, 200, 600, 600)
# Create layout
self.layout = QVBoxLayout()
# Title Label
self.label = QLabel("Enter something:")
self.label.setFont(QFont("Arial", 14, QFont.Weight.Bold))
self.label.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.label.setStyleSheet("color: white; padding: 8px; border-radius: 5px;")
self.layout.addWidget(self.label)
# Textbox
self.textbox = QLineEdit(self)
self.textbox.setFont(QFont("Arial", 12))
self.textbox.setStyleSheet("padding: 5px; border: 2px solid #3498db; border-radius: 5px;")
self.layout.addWidget(self.textbox)
# Submit Button
self.button = QPushButton("Submit")
self.button.setFont(QFont("Arial", 12, QFont.Weight.Bold))
self.button.setStyleSheet("""
QPushButton {
background-color: #2ecc71;
color: white;
border-radius: 10px;
padding: 5px;
}
QPushButton:hover {
background-color: #27ae60;
}
""")
self.button.clicked.connect(self.on_submit)
self.layout.addWidget(self.button)
# Result Label
self.result_label = QLabel("")
self.result_label.setFont(QFont("Arial", 12))
self.result_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.result_label.setStyleSheet("color: #2c3e50; padding: 5px;")
self.layout.addWidget(self.result_label)
self.setLayout(self.layout)
def on_submit(self):
self.close()
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MyWindow()
window.show()
sys.exit(app.exec())