this the entire code
main.py
import kivy
from kivy.config import Config
Config.set('graphics', 'width', '400')
Config.set('graphics', 'height', '500')
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.uix.image import Image
import sqlite3
from kivy.uix.screenmanager import ScreenManager,Screen
import random
from kivy.core.audio import SoundLoader
from kivy.properties import ObjectProperty
from kivy.uix.videoplayer import VideoPlayer
from kivy.uix.widget import Widget
class Playvideo(Screen):
def on_pre_enter(self,*args):
video= VideoPlayer(source ='react.mp4')
video.state ='play'
video.allow_fullscreen=True
return video
class mywidget(Screen):
def pressed(self):
self.ids.l1.text="text"
class Firstwindow(Screen):
pass
class Secondwindow(Screen):
global x1
global re,re1,re2,re3,re4
db = sqlite3.connect('book.db')
cu = db.cursor()
cu1= db.cursor()
cu2 = db.cursor()
cu3 = db.cursor()
cu4= db.cursor()
choseOption =db.cursor()
cu1.execute("select wronganswer1 from intermediate")
cu.execute("select questions from intermediate")
cu2.execute("select wronganswer2 from intermediate")
cu3.execute("select rightanswer from intermediate")
cu4.execute("select option from intermediate")
re1= cu1.fetchall()
re2= cu2.fetchall()
re= cu.fetchall()
re3 = cu3.fetchall()
re4 = cu4.fetchall()
def on_pre_enter(self,*args):
global theoption
x1 = random.randint(1,331)
self.ids.record1.text= str (re[x1])
self.ids.ll1.text = str (re1[x1])
self.ids.ll2.text = str (re2[x1])
self.ids.ll3.text = str (re3[x1])
theoption = str(re4[x1])
def build(self):
video= VideoPlayer(source ='react.mp4')
video.state ='play'
video.allow_fullscreen=True
return video
class Thirdwindow(Screen):
global x
global results,result1,result2,result3
db = sqlite3.connect('book.db')
cur = db.cursor()
cur1= db.cursor()
cur2 = db.cursor()
cur3 = db.cursor()
cur1.execute("select wronganswer1 from advanced")
cur.execute("select questions from advanced")
cur2.execute("select wronganswer2 from advanced")
cur3.execute("select rightanswer from advanced")
result1= cur1.fetchall()
result2= cur2.fetchall()
results= cur.fetchall()
result3 = cur3.fetchall()
def on_pre_enter(self,*args):
x = random.randint(1,244)
self.ids.record.text = str (results[x])
self.ids.l1.text = str (result1[x])
self.ids.l2.text = str (result2[x])
self.ids.l3.text = str (result3[x])
class Windowfirst(Screen):
global r
global s,s1,s2,s3
db = sqlite3.connect('book.db')
b = db.cursor()
b1= db.cursor()
b2 = db.cursor()
b3 = db.cursor()
b1.execute("select wronganswer1 from beginner")
b.execute("select questions from beginner")
b2.execute("select wronganswer2 from beginner")
b3.execute("select rightanswer from beginner")
s1= b1.fetchall()
s2= b2.fetchall()
s= b.fetchall()
s3 = b3.fetchall()
def on_pre_enter(self,*args):
r = random.randint(1,253)
self.ids.record3.text = str (s[r])
self.ids.lll1.text = str (s1[r])
self.ids.lll2.text = str (s2[r])
self.ids.lll3.text = str (s3[r])
class WindowManager(ScreenManager):
global theoption
def screen_manager_method(self):
pass
class CrashCourse(App):
def build(self):
Builder.load_file("crashcourse.kv")
return WindowManager()
if __name__ == '__main__':
CrashCourse().run()
kv file
Output:
<WindowManager>:
Firstwindow:
Secondwindow:
Thirdwindow:
Windowfirst:
mywidget:
Playvideo:
<Firstwindow>:
canvas:
Rectangle:
source:"down.jpg"
size: self.size
name: "home_screen"
id: home_screen
Button:
id: b1
text: 'Beginner'
color:"purple"
pos:130,300
size_hint:(0.5,0.1)
on_release:
app.root.current="w_screen"
root.manager.transition.direction= "right"
Button:
id: b2
text:" Inermediate"
color:"purple"
pos:130,230
size_hint:(0.5,0.1)
on_release:
app.root.current="menu_screen"
root.manager.transition.direction= "right"
Button:
id: b3
text:"Advanced"
color:"purple"
pos:130,160
size_hint:(0.5,0.1)
on_release:
app.root.current="game_screen"
root.manager.transition.direction= "right"
<Secondwindow>:
name: "menu_screen"
id: menu_screen
Label:
id:record1
text:""
text_size:self.width, None
pos_hint:{'x':0,'top':1.45}
GridLayout
padding:1
cols:2
Label:
id:ll1
text:""
CheckBox:
id:ch1
group:"mygroup"
Label:
text:""
id:ll2
CheckBox:
group:"mygroup"
Label:
text:""
id:ll3
CheckBox:
group:"mygroup"
Button:
text:"Move Next"
on_press: root.on_pre_enter()
size_hint:(0.4,0.4)
Button:
size_hint:(0.4,0.4)
pos_hint:{'x':10}
text:"Explain"
on_press:root.build()
<Thirdwindow>:
name: "game_screen"
id: game_screen
Label:
id:record
text:""
text_size:self.width, None
pos_hint:{'x':0,'top':1.45}
GridLayout
padding:50
spacing:50
cols:2
Label:
id:l1
text:""
text_size:self.width, None
CheckBox:
id:ch1
group:"mygroup"
Label:
text:""
id:l2
text_size:self.width, None
CheckBox:
group:"mygroup"
Label:
text:""
id:l3
text_size:self.width, None
CheckBox:
group:"mygroup"
Button:
text:"Move Next"
on_press: root.on_pre_enter()
size_hint:(0.4,0.4)
Button:
size_hint:(0.4,0.4)
pos_hint:{'x':10}
text:"Explain"
on_release:
app.root.current="video"
<Windowfirst>:
name: "w_screen"
id: w_screen
Label:
id:record3
text:""
text_size:self.width, None
pos_hint:{'x':0,'top':1.45}
GridLayout
padding:1
cols:2
Label:
id:lll1
text:""
CheckBox:
id:ch1
group:"mygroup"
Label:
text:""
id:lll2
CheckBox:
group:"mygroup"
Label:
text:""
id:lll3
CheckBox:
group:"mygroup"
Button:
text:"Move Next"
on_press: root.on_pre_enter()
size_hint:(0.4,0.4)
Button:
size_hint:(0.4,0.4)
pos_hint:{'x':10}
text:"Explain"
on_press:root.ch()
<mywidget>:
name:"ww"
id:"ww"
ActionBar:
size:root.width, 50
pos_hint: {'top':1}
background_color: .6, 4, .2, .6
ActionView:
ActionPrevious:
title: 'Action Bar'
with_previous: False
ActionGroup:
text:"action"
ActionButton:
text:"verb to be"
ActionButton:
text:"present simple"
<Playvideo>:
name:"video"
id:"video"
error message:
Error:
[ERROR ] [Image ] Error loading <react.mp4>