Re: [kivy-users] Changing Screen on Build

12 views
Skip to first unread message

Elliot Garbus

unread,
Mar 27, 2023, 7:43:55 PM3/27/23
to kivy-...@googlegroups.com
Move your code that sets the screen from build to on_start().  The on_start method is called after build has completed.  


Sent from my iPhone

On Mar 27, 2023, at 3:33 PM, Kelly Whitlock <kellyros...@gmail.com> wrote:

When my app builds and loads, I want it to use a function to display a certain screen based off if the database is filled. If the database is filled, it will go to the main menu. If not, it will go to the startup screen. 

Before trying this feature out, my app would return the kv builder with all my screens when it executes.

I am not sure the best way to do this or if I should create a function inside the screen manager class? Trying to do that and triggering it with using on_pre_enter and it did not work. 

Example: 
class WindowManager(ScreenManager):
pass
kv = Builder.load_file('kvs/new_window.kv')

class AwesomeApp(App):

def build(self):
if check_for_admin_info() != 0:
kv.current = 'admin_name_window'
else:
kv.current = 'main'
return kv


Thank you in advance!! 

--
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/fa7e8a6a-886b-4eb7-9d22-36bed7ad73den%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages