-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGreetingScreen.py
More file actions
71 lines (56 loc) · 1.81 KB
/
GreetingScreen.py
File metadata and controls
71 lines (56 loc) · 1.81 KB
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
64
65
66
67
68
69
70
import sys
from PySide6.QtCore import QSize, Qt
from PySide6.QtWidgets import (
QApplication,
QMainWindow,
QPushButton,
QLabel,
QVBoxLayout,
QHBoxLayout,
QStackedLayout,
QWidget
)
# Create Main Window
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
# Set window title
self.setWindowTitle("StudyWise")
# Create app title to display
appName = QLabel("StudyWise")
font = appName.font()
font.setPointSize(60)
appName.setFont(font)
appName.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
# Create greeting message
user = "Person" # This should be changed to allow the user to enter their name
greetingMsg = QLabel("Hello, " + user)
font = greetingMsg.font()
font.setPointSize(28)
greetingMsg.setFont(font)
greetingMsg.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
# Create layouts to use later
pageLayout = QVBoxLayout()
buttonLayout = QHBoxLayout()
# Create Biology button
btn = QPushButton("Biology")
btnSize = QSize(200, 200)
btn.setFixedSize(btnSize)
buttonLayout.addWidget(btn)
# Create Psychology button
btn = QPushButton("Psychology")
btnSize = QSize(200, 200)
btn.setFixedSize(btnSize)
buttonLayout.addWidget(btn)
#Organize elements
pageLayout.addWidget(appName)
pageLayout.addWidget(greetingMsg)
pageLayout.addLayout(buttonLayout)
container = QWidget()
container.setLayout(pageLayout)
# Set the central widget of the Window.
self.setCentralWidget(container)
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()