Skip to content

Commit 95f6abd

Browse files
Add files via upload
1 parent 45f2ac7 commit 95f6abd

24 files changed

+3680
-0
lines changed

186-europis-70x100-1.ico

185 KB
Binary file not shown.

Cinspirational.wav

24.1 MB
Binary file not shown.

data.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

easy.py

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
from PyQt5.QtWidgets import QPushButton, QLabel, QWidget
2+
from PyQt5.QtGui import QFont
3+
from PyQt5.QtCore import Qt
4+
import os
5+
import sys
6+
import random
7+
8+
# Main function for the 'Easy' quiz level
9+
# Sets up the first question and answer buttons
10+
11+
def easy(window):
12+
global font, ans, qu1
13+
font = QFont("Calibri", 13) # Set the font for all widgets
14+
ans = 0 # User's score for this level
15+
qu1 = None # Whether the first question was answered correctly
16+
instance = random.randint(1, 3) # Randomly select which question to show
17+
18+
# Create the question label, centered horizontally
19+
question = QLabel("", window)
20+
question.setFont(font)
21+
question.setAlignment(Qt.AlignCenter) # Center the text in the label
22+
23+
# Set the question text based on the random variant (all in English)
24+
if instance == 1:
25+
question.setText('''1. Which of the following countries
26+
is located on the Scandinavian Peninsula?''')
27+
elif instance == 2:
28+
question.setText('''1. Which of the following countries
29+
is landlocked (has no access to the sea)?''')
30+
elif instance == 3:
31+
question.setText('''1. Which of the following countries has
32+
Copenhagen as its capital city?''')
33+
34+
# Calculate position to center the label horizontally and place it near the top
35+
window_width = window.frameGeometry().width()
36+
question_width = 600
37+
question_height = 100 # Smaller height so the label isn't too big
38+
question_x = (window_width - question_width) // 2 # Center horizontally
39+
question_y = 20 # Near the top, with a small margin
40+
41+
question.setGeometry(question_x, question_y, question_width, question_height)
42+
question.setStyleSheet("font-size: 20px; font-weight: bold;")
43+
question.show()
44+
45+
# Function to proceed to the next question (calls easy2.easy)
46+
def next_question():
47+
import easy2
48+
# Remove all widgets from the window before showing the next question
49+
for widget in window.children():
50+
widget.deleteLater()
51+
print(ans)
52+
print(qu1)
53+
try:
54+
easy2.easy(window, ans, qu1)
55+
except Exception as e:
56+
print(f"Error: {e}") # Print any error that occurs
57+
58+
# Answer button callbacks for each possible answer
59+
# Each function checks which question is active and updates the score and correctness accordingly
60+
def answer_dania():
61+
global qu1, ans
62+
if instance == 1:
63+
qu1 = False
64+
next_question()
65+
elif instance == 2:
66+
qu1 = False
67+
next_question()
68+
elif instance == 3:
69+
qu1 = True
70+
ans += 2
71+
next_question()
72+
73+
def answer_latvia():
74+
global qu1, ans
75+
if instance == 1:
76+
qu1 = False
77+
next_question()
78+
elif instance == 2:
79+
qu1 = False
80+
next_question()
81+
elif instance == 3:
82+
qu1 = False
83+
next_question()
84+
85+
def answer_norway():
86+
global qu1, ans
87+
if instance == 1:
88+
qu1 = True
89+
ans += 2
90+
next_question()
91+
elif instance == 2:
92+
qu1 = False
93+
next_question()
94+
elif instance == 3:
95+
qu1 = False
96+
next_question()
97+
98+
def answer_lichtenstain():
99+
global qu1, ans
100+
if instance == 1:
101+
qu1 = False
102+
next_question()
103+
elif instance == 2:
104+
qu1 = True
105+
ans += 2
106+
next_question()
107+
elif instance == 3:
108+
qu1 = False
109+
next_question()
110+
111+
# Create answer buttons with English text and connect them to the correct callback
112+
dania = QPushButton("A) Denmark", window)
113+
dania.resize(500, 120)
114+
dania.move(250, 130)
115+
dania.setFont(font)
116+
dania.show()
117+
dania.clicked.connect(answer_dania)
118+
119+
andora = QPushButton("B) Latvia", window)
120+
andora.setFont(font)
121+
andora.resize(500, 120)
122+
andora.move(250, 260)
123+
andora.show()
124+
andora.clicked.connect(answer_latvia)
125+
126+
norway = QPushButton("C) Norway", window)
127+
norway.resize(500, 120)
128+
norway.move(250, 390)
129+
norway.setFont(font)
130+
norway.show()
131+
norway.clicked.connect(answer_norway)
132+
133+
lichtenstain = QPushButton("D) Liechtenstein", window)
134+
lichtenstain.resize(500, 120)
135+
lichtenstain.move(250, 520)
136+
lichtenstain.setFont(font)
137+
lichtenstain.show()
138+
lichtenstain.clicked.connect(answer_lichtenstain)

easy10.py

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
from PyQt5.QtWidgets import QPushButton, QLabel, QWidget
2+
from PyQt5.QtGui import QFont
3+
from PyQt5.QtCore import Qt
4+
import os
5+
import sys
6+
import random
7+
8+
qu10 = None
9+
ans = 0
10+
11+
# Main function for the tenth 'Easy' quiz question
12+
# Receives the window, previous score, and correctness of previous questions
13+
# Sets up the tenth question and answer buttons
14+
15+
def easy(window, ans9, qu9, qu8, qu7, qu6, qu5, qu4, qu3, qu2, qu1):
16+
global qu10, ans
17+
ans += ans9 # Add previous score to current score
18+
font = QFont("Calibri", 13)
19+
instance = random.randint(1, 3) # Randomly select which question to show
20+
21+
# Create the question label, centered horizontally
22+
question = QLabel("", window)
23+
question.setFont(font)
24+
question.setAlignment(Qt.AlignCenter)
25+
26+
# Set the question text based on the random variant (all in English)
27+
if instance == 1:
28+
question.setText('''10. What is the currency of Sweden?''')
29+
elif instance == 2:
30+
question.setText('''10. In which country is Ben Nevis,
31+
the highest peak of the Cambrian Mountains, located?''')
32+
elif instance == 3:
33+
question.setText('''10. Which country has the most islands in Europe?''')
34+
35+
# Calculate position to center the label horizontally and place it near the top
36+
window_width = window.frameGeometry().width()
37+
question_width = 600
38+
question_height = 100
39+
question_x = (window_width - question_width) // 2
40+
question_y = 20
41+
question.setGeometry(question_x, question_y, question_width, question_height)
42+
question.setStyleSheet("font-size: 20px; font-weight: bold;")
43+
question.show()
44+
45+
# Function to proceed to the results screen (calls easy_marks.show_marks)
46+
def next_question():
47+
import marks
48+
# Remove all widgets from the window before showing the results
49+
for widget in window.children():
50+
widget.deleteLater()
51+
print(ans)
52+
print(qu10)
53+
marks.show_marks(window, ans, qu10, qu9, qu8, qu7, qu6, qu5, qu4, qu3, qu2, qu1)
54+
55+
# Answer button callbacks for each possible answer
56+
# Each function checks which question is active and updates the score and correctness accordingly
57+
def answer_dania():
58+
global qu10, ans
59+
if instance == 1:
60+
qu10 = False
61+
next_question()
62+
elif instance == 2:
63+
qu10 = False
64+
next_question()
65+
elif instance == 3:
66+
qu10 = False
67+
next_question()
68+
69+
def answer_kroatia():
70+
global qu10, ans
71+
if instance == 1:
72+
qu10 = True
73+
ans += 2
74+
next_question()
75+
elif instance == 2:
76+
qu10 = False
77+
next_question()
78+
elif instance == 3:
79+
qu10 = False
80+
next_question()
81+
82+
def answer_norway():
83+
global qu10, ans
84+
if instance == 1:
85+
qu10 = False
86+
next_question()
87+
elif instance == 2:
88+
qu10 = True
89+
ans += 2
90+
next_question()
91+
elif instance == 3:
92+
qu10 = False
93+
next_question()
94+
95+
def answer_lichtenstain():
96+
global qu10, ans
97+
if instance == 1:
98+
qu10 = False
99+
next_question()
100+
elif instance == 2:
101+
qu10 = False
102+
next_question()
103+
elif instance == 3:
104+
qu10 = True
105+
ans += 2
106+
next_question()
107+
108+
# Set the button texts according to the question instance (all in English)
109+
def set_correct_text():
110+
if instance == 1:
111+
dania.setText("A) Euro")
112+
kroatia.setText("B) Krona")
113+
norway.setText("C) Franc")
114+
poland.setText("D) Pound")
115+
if instance == 2:
116+
dania.setText("A) Ireland")
117+
kroatia.setText("B) England")
118+
norway.setText("C) Scotland")
119+
poland.setText("D) Wales")
120+
if instance == 3:
121+
dania.setText("A) Italy")
122+
kroatia.setText("B) Greece")
123+
norway.setText("C) Norway")
124+
poland.setText("D) Sweden")
125+
126+
# Create answer buttons and connect them to the correct callback
127+
dania = QPushButton("A) Denmark", window)
128+
dania.resize(500, 120)
129+
dania.move(250, 140)
130+
dania.setFont(font)
131+
dania.show()
132+
dania.clicked.connect(answer_dania)
133+
134+
kroatia = QPushButton("B) Croatia", window)
135+
kroatia.setFont(font)
136+
kroatia.resize(500, 120)
137+
kroatia.move(250, 270)
138+
kroatia.show()
139+
kroatia.clicked.connect(answer_kroatia)
140+
141+
norway = QPushButton("C) Norway", window)
142+
norway.resize(500, 120)
143+
norway.move(250, 400)
144+
norway.setFont(font)
145+
norway.show()
146+
norway.clicked.connect(answer_norway)
147+
148+
poland = QPushButton("D) Liechtenstein", window)
149+
poland.resize(500, 120)
150+
poland.move(250, 530)
151+
poland.setFont(font)
152+
poland.show()
153+
poland.clicked.connect(answer_lichtenstain)
154+
set_correct_text()

0 commit comments

Comments
 (0)