toga
toga copied to clipboard
ios cannot add widgets to main_window.content
Describe the bug A clear and concise description of what the bug is.
To Reproduce Try to run this app in ios:
import toga
class MyApp(toga.App):
def startup(self):
"""
Construct and show the Toga application.
Usually, you would add your application to a main content box.
We then create a main window (with a name matching the app), and
show the main window.
"""
self.state = GameState()
self.main_window = toga.MainWindow(title=self.formal_name)
box = toga.Box()
label = toga.Label("Test1")
box.add(label)
self.main_window.content = box
label2 = toga.Label("Test2")
box.add(label2)
self.main_window.show()
MyApp().main_loop()
Expected behavior The application should open and shows the labels "Test1" and "Test2". Instead, you get a black screen. In the xcode debugger there is a log message on the "box.add(label2)" line about the label (test2) not having the attribute "viewport".
If you comment out box.add(label2), you correctly get a window that has "Test1".
On targets macos and android, the above test will correctly show "Test1 Test2"
Environment:
- Operating System: macos
- Python version: 3.8
- Software versions:
- Briefcase: 0.3.3
- Toga: 0.3.0.dev23
- IOS: iphone 11
This may be related to #225, as you will get a similar error if you try to rebind main_window.content to a different widget.