Last active
September 14, 2022 09:14
-
-
Save Dayof/c2fc5883c8884d61ca02109dc7944813 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import toga | |
from colosseum import CSS | |
class StartApp(toga.App): | |
def startup(self): | |
self.main_window = toga.MainWindow(self.name) | |
self.main_window.app = self | |
self.outer_box = toga.Box() | |
all_tests_box = toga.Tree(['Tests']) | |
problems_box = toga.Tree(['Problems']) | |
self.notebook = toga.OptionContainer(content=[ | |
('All tests', all_tests_box), | |
('Problems', problems_box)]) | |
self.button = toga.Button('Print ID', on_press=self.printCurrentID, | |
style=CSS(margin=50)) | |
self.outer_box.add(self.notebook) | |
self.outer_box.add(self.button) | |
self.main_window.content = self.outer_box | |
self.main_window.show() | |
def printCurrentID(self, button): | |
print(self.notebook.selected['id']) | |
def main(): | |
app = StartApp('ProgressBar Test', 'org.pybee.test') | |
app.main_loop() | |
if __name__ == '__main__': | |
main() |
Hello! I want to use the optioinCintainer
widget to add tab views to my app, when I type briefcase dev
, it works fine on Windows systems, but after I typebriefcase package android
, and install it on my android phone and open it, there is nothing appeare on my screen but a title of the app...How could this happen? Is there something wrong? How can I add tab views to my android app?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The callback mechanism
on_select
will pass the selected widget back as theoption
parameter to theon_select
handler. You could maintain a copy of that reference in your own app.The core
OptionContainer
widget could also maintain aselected
attribute as you have suggested. I have just created a PR for iOS implementation ofOptionContainer
and I've added theindex
to the callback handler (as that could be useful to the app developer).So I could see
selected.option
andselected.index
properties as being easy enough to implement.@freakboy3742 is this something you would like to see in
OptionContainer
or would accept if there was a PR for it?