Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.lang import Builder
- from kivymd.app import MDApp
- from kivymd.uix.taptargetview import MDTapTargetView
- KV = '''
- Screen:
- id: screen
- MDFloatingActionButton:
- id: button
- icon: "plus"
- pos: 10, 10
- on_release: app.tap_target_start()
- on_press: app.printIds()
- MDCard:
- id: card
- size_hint: None, None
- size: "280dp", "180dp"
- pos_hint: {"center_x": .5, "center_y": .5}
- MDLabel:
- id: label
- text: "MDLabel"
- halign: "left"
- MDIconButton:
- id: button2
- icon: "android"
- theme_text_color: "Custom"
- text_color: app.theme_cls.primary_color
- on_press: app.printIds()
- '''
- class TapTargetViewDemo(MDApp):
- def build(self):
- screen = Builder.load_string(KV)
- self.tap_target_view = MDTapTargetView(
- widget=screen.ids.button,
- title_text="This is an add button",
- description_text="This is a description of the button",
- widget_position="left_bottom",
- )
- return screen
- def tap_target_start(self):
- if self.tap_target_view.state == "close":
- self.tap_target_view.start()
- else:
- self.tap_target_view.stop()
- def printIds(self):
- self.root.ids.label.text = "e che cazzo"
- TapTargetViewDemo().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement