-
Notifications
You must be signed in to change notification settings - Fork 3
Home
-
Go to the
home_page.py
file. -
Import your screen like
from cilantro_audit.completed_audits_list_page import CompletedAuditsListPage
at the top of the file. An outline would befrom cilantro_audit.<YOUR_PYTHON_FILE> import <YOUR_PAGE>
. -
In the
build(self)
method ofCilantroAudit
, add your view to the screen manager likesm.add_widget(YourPythonClassName(name="NameForYourScreen"))
. If we were trying to addcompleted_audits_list_page
, the result would besm.add_widget(CompletedAuditsListPage(name="CompletedAuditsListPage"))
. -
Now your screen manager should have an entry for
CompletedAuditsListPage
. ThisString
is how you will be referencing in your other Python/kv files. -
In your .kv file, you must have a certain property for a button for instance e.g.
on_press: root.manager.current = 'ADMIN_SCREEN'
, if you'd like to have your screen go back to theADMIN_SCREEN
. -
If you want to link a page to your screen, you must do the reverse, so
on_press: root.manager.current = 'CompletedAuditsListPage'
if your screen name was namedCompletedAuditsListPage
. -
root.manager.current
has 3 parts. The root is the root widget of the kivy app, which in this case isHomePage
. The manager is the screen manager that the root widget has already created in itsbuild
method. The current property of the screen manager refers to the current screen. Once the current field is changed, the screen will be updated accordingly. -
If everything works as intended, you will be able to run
home_page.py
, and then navigate to your desired page. After navigating to your page, going backwards should work as well.