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()

 

上一篇:C语言13


下一篇:动态内存分配的方法实现冒泡排序