I am using kivy to create an app which will be having multiple screens, I am using Screen Manager component to manage the screens.
<AppScreenManager>:
Screen:
name: "HomeScreen"
HomeScreenLayout:
Screen:
name: "ImageScreen"
ImageScreenMenu:
My home screen has a tabbed Panel
<HomeScreenLayout>:
rows: 3
TabbedPanel:
tab_pos: 'top_mid'
pos_hint: {'center_x': .5, 'center_y': .5}
do_default_tab: False
TabbedPanelItem:
text: "File"
BoxLayout:
orientation: "vertical"
padding: "50dp"
spacing: "20dp"
size: root.width, root.height
Image:
id: my_image
source: ""
FileChooserListView:
id: fileChooser
on_selection: root.selected_file(fileChooser.selection)
TabbedPanelItem:
text: "Cut"
TabbedPanelItem:
text: "Blur"
TabbedPanelItem:
text: "Filters"
I wanted to use the click of a tabbed Panel item in order to change the screen and that screen will have its own tabbed panel. In the documentation and other guides i have read they have used button to change the screen.
I wanted the click of a tabbedPanelItem to result in a screen change, I have tried using on_press attribute but it docent seem to work
TabbedPanelItem:
text: "Cut"
on_press: root.current = "ImageScreen"
The TabbedPanelItem
is a ToggleButton
, so you can use on_state
like this:
TabbedPanelItem:
text: "Cut"
on_state: if self.state == "down": app.root.current = "ImageScreen"
Note that you will never be able to see any content in that TabbedPanelItem
if you use the tab to change to another Screen
.