Here are a few things to consider:
self.review_ct.bind(on_press=self.switch_screens('review'))
The bind statement above is not correct. You want to set on_press to a function name, not call the function. Given you want to pass a parameter you could create a lambda to call the function, or use functools.partial to create a callable object that includes the parameter.
The other thing to keep in mind is that when the app starts, the on_enter for the first screen under the ScreenManager fires. This can sometimes cause issues depending on the order of initialization.
In the example code below, the name of the screen is printed to the console when the screen is entered. Note it fires at app startup, and the name is not yet set. There are a number of ways to workaround this is this is a problem, the simplest would be to add a dummy screen as the first screen under the ScreenManager.
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import
Screen
kv = """
<ButtonScreen>:
BoxLayout:
orientation: 'vertical'
Label:
text: f'This screen is named {root.name}'
Button:
size_hint_y: None
height: dp(48)
text: 'next_screen'
on_release: root.manager.current = root.manager.next()
ScreenManager:
ButtonScreen:
name: 'screen_1'
ButtonScreen:
name: 'screen_2'
ButtonScreen:
name: 'screen_3'
"""
class ButtonScreen(Screen):
def on_enter(self, *args):
print(f'Entered Screen {self.manager.current}')
# note the screen name does not print out the first time...
class ScreenExampleApp(App):
def build(self):
return Builder.load_string(kv)
ScreenExampleApp().run()
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/e02bd18a-ca3a-42b0-b4f6-45ae0ac2d6d5n%40googlegroups.com.