其他分享
首页 > 其他分享> > Bubble和BubbleButton气泡框

Bubble和BubbleButton气泡框

作者:互联网

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang.builder import Builder
"""Bubble本身不能触发事件,可以嵌套Button"""

Builder.load_string("""
<BubbleWidget>:
    size_hint:.5,.2
    pos_hint:{'center_x':.5,'center_y':.5}
    Bubble:
        arrow_pos:'bottom_left'
    Bubble:
        Button:
            text:'Bubble'
            on_release:root.pr()
""")


class BubbleWidget(BoxLayout):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def pr(self):
        print("123")


class MyApp(App):
    def build(self):
        return BubbleWidget()


if __name__ == '__main__':
    MyApp().run()

 

标签:__,BubbleButton,self,kivy,import,Bubble,def,气泡
来源: https://www.cnblogs.com/vip136510786/p/15083814.html