from kivy.lang import Builder
from kivy.properties import NumericProperty, ListProperty
from kivymd.app import MDApp
from kivy.core.text import LabelBase
from kivymd.uix.anchorlayout import AnchorLayout
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.core.window import Window
Window.size = (350, 600)
screen_helper = """
ScreenManagement:
LoginPage:
HomePage:
Q1:
Q2:
Q3:
Q4:
Q5:
Q6:
Q7:
Q8:
Q9:
Q10:
FinalPage:
<LoginPage>:
name: 'login'
MDFloatLayout:
Image:
source: 'Okudo2.png'
pos_hint: {'y': 0.25}
size_hint:
MDLabel:
text: "Primary Two Quiz"
pos_hint: {'center_x': 0.5, 'center_y': 0.48}
halign: 'center'
font_size: '30sp'
theme_text_color: 'Secondary'
text_color: 60/255, 43/255, 117/255, 1
MDFloatLayout:
size_hint: 0.85, 0.08
pos_hint: {'center_x': 0.5, 'center_y': 0.38}
canvas:
Color:
rgb: (238/255, 238/255, 238/255, 1)
RoundedRectangle:
size: self.size
pos: self.pos
radius:[25]
TextInput:
hint_text: 'Enter Username'
size_hint: 1, None
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
height: self.minimum_height
multiline: False
cursor_color: 96/255, 74/255, 215/255, 1
cursor_width: '2sp'
foreground_color: 96/255, 74/255, 215/255, 1
background_color: 0, 0, 0, 0
padding: 15
font_name:
font_size: '18sp'
MDFloatLayout:
size_hint: 0.85, 0.08
pos_hint: {'center_x': 0.5, 'center_y': 0.28}
canvas:
Color:
rgb: (238/255, 238/255, 238/255, 1)
RoundedRectangle:
size: self.size
pos: self.pos
radius:[25]
TextInput:
id: passw
password: True
hint_text: 'Password'
password_hint: True
size_hint: 1, None
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
height: self.minimum_height
multiline: False
cursor_color: 96/255, 74/255, 215/255, 1
cursor_width: '2sp'
foreground_color: 96/255, 74/255, 215/255, 1
background_color: 0, 0, 0, 0
padding: 15
font_name:
font_size: '18sp'
MDTextButton:
text: 'Forget your password?'
font_name:
theme_text_color: 'Primary'
text_color: 246/255, 135/255, 177/255, 1
pos_hint: {'center_x': 0.5, 'center_y': 0.21}
Button:
text: 'LOGIN'
font_size: '20sp'
size_hint: 0.5, 0.08
pos_hint: {'center_x': 0.5, 'center_y': 0.12}
background_color: 0, 0, 0, 0
on_press:
root.manager.current = 'home' if passw.text == 'bukki' else 'login'
root.manager.transition.direction = 'left'
canvas.before:
Color:
rgb: 7/255, 32/255, 240/255, 1
RoundedRectangle:
size: self.size
pos: self.pos
<HomePage>:
name: 'home'
canvas.before:
Rectangle:
size: self.size
source:
Button:
on_release: app.root.current = 'q1'
size_hint:0.7, 0.33
pos_hint: {'x':0.15, 'y':0.5}
background_normal: 'Maths.png'
background_down: 'Maths.png'
Button:
on_release: app.root.current = 'q6'
size_hint:0.7, 0.33
pos_hint: {'x':0.15, 'y':0.15}
background_normal: 'English.png'
background_down: 'English.png'
<Q1>:
name: 'q1'
BoxLayout:
orientation: 'vertical'
Label:
text: '1. What is the place value of 7 in 7896?'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. Tens'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. Thousand'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (168/255, 245/255, 100/255, 1)
Button:
text: 'C. Units'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'home'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'q2'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q2>:
name: 'q2'
BoxLayout:
orientation: 'vertical'
Label:
text: '2. In 5904, what does 0 stand for?'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. Unit'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. Million'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'C. Tens'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q1'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'q3'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q3>:
name: 'q3'
BoxLayout:
orientation: 'vertical'
Label:
text: '3. What number comes before 6000.'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. 3999'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. 5999'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
Button:
text: 'C. 2999'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q2'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'q4'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q4>:
name: 'q4'
BoxLayout:
orientation: 'vertical'
Label:
text: '4. The number that comes after 3418 is _____.'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. 4319'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. 5419'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'C. 3419'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q3'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'q5'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q5>:
name: 'q5'
BoxLayout:
orientation: 'vertical'
Label:
text: '5. 7 thousand 8 hundred 2 tens 4 units= ________.'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. 7824'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
Button:
text: 'B. 4287'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'C. 8724'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q4'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'final'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q6>:
name: 'q6'
BoxLayout:
orientation: 'vertical'
Label:
text: '1. Which word is a noun?'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. Run'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. Quickly'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'C. Boy'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q5'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'q7'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q7>:
name: 'q7'
BoxLayout:
orientation: 'vertical'
Label:
text: '2. Select the pronoun in the following sentence: "The dog chased its tail."'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. Dog'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. chased'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'C. its'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q6'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'q8'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q8>:
name: 'q8'
BoxLayout:
orientation: 'vertical'
Label:
text: '3. Identify the adverb in the sentence: "She sings beautifully."'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. She'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. sings'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'C. beautifully'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q7'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'q9'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q9>:
name: 'q9'
BoxLayout:
orientation: 'vertical'
Label:
text: '4. Which word is a pronoun?'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. Book'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. They'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
Button:
text: 'C. Jump'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q8'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'q10'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<Q10>:
name: 'q10'
BoxLayout:
orientation: 'vertical'
Label:
text: '5. Find the adverb in the sentence: "He ran fast to catch the bus."'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
font_size:self.width/15
color: 0,0,0,
canvas.before:
Rectangle:
pos:self.pos
size:self.size
Button:
text: 'A. He'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'B. ran'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (255,0,0,)
Button:
text: 'C. fast'
text_size: self.width, None
font_size:self.width/15
color: (1,1,0)
on_release:self.background_color = (180/255, 228/225, 85/225, 1)
AnchorLayout:
anchor_y: 'bottom'
BoxLayout:
Button:
on_release:app.root.current= 'q9'
background_normal: 'left-28998_1280.png'
background_down: 'left-28998_1280.png'
Button:
on_release:app.root.current= 'final'
background_normal: 'arrow-153643_1280.png'
background_down: 'arrow-153643_1280.png'
<FinalPage>:
name: 'final'
canvas.before:
Rectangle:
size: self.size
source:
Button:
on_release: app.root.current = 'q1'
size_hint:0.7, 0.33
pos_hint: {'x':0.15, 'y':0.5}
background_normal: 'calculator-1432526_1280.png'
background_down: 'calculator-1432526_1280.png'
Button:
on_release: app.root.current = 'q1'
size_hint:0.7, 0.33
pos_hint: {'x':0.15, 'y':0.15}
background_normal: 'calculator-1432526_1280.png'
background_down: 'calculator-1432526_1280.png'
"""
class LoginPage(Screen):
pass
class HomePage(Screen):
pass
class Q1(Screen):
pass
class Q2(Screen):
pass
class Q3(Screen):
pass
class Q4(Screen):
pass
class Q5(Screen):
pass
class Q6(Screen):
pass
class Q7(Screen):
pass
class Q8(Screen):
pass
class Q9(Screen):
pass
class Q10(Screen):
pass
class FinalPage(Screen):
pass
class ScreenManagement(ScreenManager):
pass
class MusicHubApp(MDApp):
def build(self):
self.theme_cls.theme_style = 'Dark'
self.theme_cls.primary_palette = 'BlueGray'
screen = Builder.load_string(screen_helper)
return screen
if __name__ == '__main__':
MusicHubApp().run()