-
Notifications
You must be signed in to change notification settings - Fork 2
Adding a Tab
To add a new tab to Houston, follow the procedure outlined below.
-
Decide on a name for your tab.
NEWTab will be used as an example -
In houston.kv, under the
<Top>:declaration, add a reference to your new tab class under the existing ones (line 6 ish):new_tab : new_tab. This allows us to reference the tab in Python -
In houston.kv, locate the instantiations of the tabs (line 47 ish) and add one for the new tab:
NEWTab: id: new_tab. -
Now you need to start the layout of your tab. At the bottom of houston.kv, copy the code for
<DASHTab>(line 274 or so) and modify it so that it's forNEWTab. This region will be filled out with later with the layout constructs for the tab. -
Now it's time for Python. Create a python file called
NEWTab.py. Kivy has strict requirements about capitalization matching, which is why we're using the weird capitalization for the tabs. -
At the top of
houston.py, addfrom NEWTab import * -
At the top of
houston.pyat the top of theTopclass, addnew_tab = ObjectProperty(None). This lets us reference elements in the new tab from python asnew_tab.element. -
In the
setup_tabs()method ofhouston.py, add a call to the initialize method of your tab class.self.new_tab.initialize(). -
Now you are ready to start coding the logic of your tab class. You can follow the example of DASHTab.py at commit 254184da06df2ca256f84ccdf5dd4fdb07b4718a as an example of the basic boilerplate needed.