I'm trying to transition between screens but my screen manager is failing, saying that it has a type of NoneType. I suspect I may be failing to refer to my screen manager properly? What would be the correct approach for this?
The approach I've taken is straight from the documentation, so I'm unsure where I'm going wrong.
Error:
on_release: root.manager.current = 'AboutUsWindow'
AttributeError: 'NoneType' object has no attribute 'current'
My .kv file:
<MainWindow>:
name: "MainWindow"
BoxLayout:
orientation: "horizontal"
ActionBar:
pos_hint: {'top':1}
use_separator: True
background_color: 0, 1, 1, 1
ActionView:
use_separator: True
ActionPrevious:
with_previous: True
ActionOverflow:
ActionButton:
# text: "some text"
text: root.name
on_release: root.manager.current = 'AboutUsWindow'
ActionButton:
text: "sponsors"
on_release: root.manager.current = 'AboutUsWindow'
ActionButton:
text: "contact"
ActionButton:
text: "event"
<AboutUsWindow>:
name: "AboutUsWindow"
Label:
text: "asdasdasd"
Button:
size: (123,123)
My main.py file:
# Here are imports which i did not include
class MainWindow(Screen, BoxLayout, CoverImage):
pass
class AboutUsWindow(Screen, BoxLayout, CoverImage):
pass
sm = ScreenManager()
sm.transition = FadeTransition()
sm.add_widget(MainWindow())
sm.add_widget(AboutUsWindow())
class PystokApp(App):
def build(self):
root = MainWindow(source='images/logo.jpg')
return root
# main = MainWindow()
# Window.size = main.size
# return MainWindow()
if __name__ == "__main__":
PystokApp().run()