from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
class MainScreen(Screen):
pass
class ViewScreen(Screen):
def btn_pressed(self, *args):
presentation.current='main'
def __init__(self, **kwargs):
super(ViewScreen, self).__init__(**kwargs)
self.add_widget(ViewBoxLayout())
class ViewBoxLayout(BoxLayout):
def btn_pressed(self, *args):
presentation.current='main'
def __init__(self, **kwargs):
super(ViewBoxLayout, self).__init__(**kwargs)
self.orientation = 'vertical'
back_btn = Button(text='Back')
back_btn.bind(on_press=self.btn_pressed)
self.add_widget(Label(text='My Application')
self.add_widget(ViewGridLayout()) #This is where the error is occurring
self.add_widget(back_btn)
class ViewGridLayout(GridLayout):
def __init__(self, **kwargs):
super(ViewGridLayout, self).__init__(**kwargs)
self.cols = 2
class ScreenManagement(ScreenManager):
pass
class MainApp(App):
def build(self):
return presentation
presentation = Builder.load_file("main2.kv")
MainApp().run()