I tried like this, but when I access the menu, the Preferences item is not enabled :
class Application(toga.App):
def startup(self):
# ... build UI here
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = MainBox
self.main_window.show()
def preferences(self):
# Create a new window for the preferences
pref_window = toga.Window(title="Preferences")
# Create a preferences window layout
pref_box = toga.Box(style=Pack(direction=COLUMN, padding=10))
# Example preferences settings (could be text inputs, toggles, etc.)
theme_label = toga.Label("Choose Theme:", style=Pack(padding=(0, 5)))
theme_selection = toga.Selection(items=["Light", "Dark"])
notification_label = toga.Label("Enable Notifications:", style=Pack(padding=(0, 5)))
notification_toggle = toga.Switch()
# Add widgets to the box
pref_box.add(theme_label, theme_selection, notification_label, notification_toggle)
# Set the content of the preferences window
pref_window.content = pref_box
pref_window.show()