Can anyone help me.When working with KivyMD in python syntax the on_action_button parameter of MDBottomAppBar(MDTopAppBar()) does not work.Can anyone guide me why does on_action_button: app.presser() is not working in kivymd
from kivymd.app import MDApp
from kivy.lang import Builder
class MyFirst_App(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = "BlueGray"
return Builder.load_file("BottomBar.kv")
def presser(self):
print("hello")
MyFirst_App().run()
###############################KVFILE##########################################################
MDBoxLayout:
orientation: "vertical"
MDTopAppBar:
title: " Our Top Bar"
left_action_items: [["menu",lambda x: app.presser()]]
right_action_items: [["dots-vertical",lambda x: app.presser()]]
MDLabel:
id: my_label
text:"Some Stuff"
halign:"center"
MDBottomAppBar:
MDTopAppBar:
icon: "git"
#title: "Bottom Bar"
mode: "free-end"
#mode: "end"
#mode: "center"
#mode: "free-center"
on_action_button: app.presser()
You create the MDBottomAppBar icons the same way as the MDTopAppBar, just inside the MDBottomAppBar.
ie.
MDBottomAppBar:
MDTopAppBar:
left_action_items: [["account-circle",lambda x: app.presser()]]
right_action_items: [["account-child",lambda x: app.presser()],["account-child",lambda x: app.presser()]]