Skip to content

Adding a Tab

Richard Arthurs edited this page Jul 7, 2018 · 1 revision

To add a new tab to Houston, follow the procedure outlined below.

  1. Decide on a name for your tab. NEWTab will be used as an example

  2. 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

  3. In houston.kv, locate the instantiations of the tabs (line 47 ish) and add one for the new tab: NEWTab: id: new_tab.

  4. 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 for NEWTab. This region will be filled out with later with the layout constructs for the tab.

  5. 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.

  6. At the top of houston.py, add from NEWTab import *

  7. At the top of houston.py at the top of the Top class, add new_tab = ObjectProperty(None). This lets us reference elements in the new tab from python as new_tab.element.

  8. In the setup_tabs() method of houston.py, add a call to the initialize method of your tab class. self.new_tab.initialize().

  9. 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.

Clone this wiki locally