3

How to create a dropdown menu at the top of the window (like "File", "Edit", and "Tools") in Kivy?

Demian Wolf
  • 1,698
  • 2
  • 14
  • 34
Nirdesh Kumawat
  • 386
  • 2
  • 16
  • 56

1 Answers1

11

How about using ActionBar

enter image description here

from kivy.app import App
from kivy.lang import Builder

kv_str = Builder.load_string('''
ActionBar:
    pos_hint: {'top':1}
    ActionView:
        use_separator: True
        ActionPrevious:
            title: 'Example App'
            with_previous: False
        ActionButton:
            text: 'File'
        ActionButton:
            text: 'Edit'
        ActionGroup:
            text: 'Tools' 
            mode: 'spinner'
            ActionButton:
                text: 'Tool1'
            ActionButton:
                text: 'Tool2'
            ActionButton:
                text: 'Tool3'
            ActionButton:
                text: 'Tool4'
''')


class ExampleApp(App):
    def build(self):
        return kv_str

if __name__ =='__main__':
    ExampleApp().run()
PalimPalim
  • 2,892
  • 1
  • 18
  • 40