-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLastScreen.py
More file actions
125 lines (98 loc) · 3.74 KB
/
LastScreen.py
File metadata and controls
125 lines (98 loc) · 3.74 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import sys
from PySide6.QtCore import QSize, Qt
from PySide6.QtWidgets import (
QApplication,
QMainWindow,
QPushButton,
QLabel,
QVBoxLayout,
QHBoxLayout,
QWidget
)
# Create Score Screen
class ScoreScreen(QWidget):
def __init__(self):
super().__init__()
# Create Score Screen layout
scoreLayout = QVBoxLayout()
# Create Score Label
scoreLabel = QLabel("Score")
font = scoreLabel.font()
font.setPointSize(60)
scoreLabel.setFont(font)
scoreLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
# Create Your Score Label
yourScoreLabel = QLabel("Your Score: 8/10") # You can update the score dynamically
font = yourScoreLabel.font()
font.setPointSize(36)
yourScoreLabel.setFont(font)
yourScoreLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
# Create Stats Label
statsLabel = QLabel("Stats: 8/10") # You can update the stats dynamically
font = statsLabel.font()
font.setPointSize(28)
statsLabel.setFont(font)
statsLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
# Create Return Button
returnButton = QPushButton("Return")
returnButton.setFixedSize(QSize(200, 60))
# Connect the button click event to a function (e.g., to return to the main screen)
returnButton.clicked.connect(self.return_to_main_screen)
# Add elements to the score layout
scoreLayout.addWidget(scoreLabel)
scoreLayout.addWidget(yourScoreLabel)
scoreLayout.addWidget(statsLabel)
scoreLayout.addWidget(returnButton)
# Set the layout for the Score Screen
self.setLayout(scoreLayout)
def return_to_main_screen(self):
# Implement the logic to return to the main screen here
print("Returning to the main screen") # You can replace this with your actual logic
# 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 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)
# Add buttons layout to the page layout
pageLayout.addWidget(appName)
pageLayout.addLayout(buttonLayout)
# Set the central widget of the Window to the Greeting Screen
container = QWidget()
container.setLayout(pageLayout)
self.setCentralWidget(container)
# Initialize Score Screen (hidden by default)
self.score_screen = ScoreScreen()
self.score_screen.setVisible(False)
self.setFixedSize(800, 600) # Adjust the window size as needed
# Create a button to switch to the Score Screen
show_score_button = QPushButton("Show Score")
show_score_button.clicked.connect(self.show_score)
buttonLayout.addWidget(show_score_button)
def show_score(self):
# Show the Score Screen and hide the main screen
self.score_screen.setVisible(True)
self.centralWidget().setVisible(False)
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()