-
Notifications
You must be signed in to change notification settings - Fork 0
/
Index.py
54 lines (40 loc) · 1.53 KB
/
Index.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
#--------------------- APP-1 ---------------------#
from ast import If
from pickle import GLOBAL
from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.uic import loadUi
import sys
from QuestionPage import QuestionPage
import UserData
# Created a class object
class Main(QMainWindow):
def __init__(self):
super(Main, self).__init__()
loadUi('Login.ui', self)
# ~~---------- Ui Logic -------------~~
# set the page base settings
self.setWindowTitle("Exium - Login")
self.setFixedSize(430, 721)
# Adding difficulties to the combo box
self.comboBox.addItems('easy medium hard'.split())
self.comboBox.setStyleSheet('background-color: white')
# OnClick Get Started button -> start the game
self.pushButton.clicked.connect(lambda:self.Login())
# Get Started button behavior
def Login(self):
# Pass Name & Difficulty to the next window
UserData.student_name = self.textEdit.toPlainText()
UserData.student_score = 0
UserData.question_index = 0
UserData.difficulty = self.comboBox.currentText()
print(UserData.student_name, UserData.difficulty)
# Transport to the next window
self.anotherwindow = QuestionPage()
self.anotherwindow.show()
self.hide()
if __name__ == '__main__':
app = QApplication(sys.argv)
ui = Main()
ui.show()
app.exec_()