【发布时间】:2021-08-25 09:45:02
【问题描述】:
我需要一个没有矩形的完美圆形按钮。我已经制作了,但是当我在圆(角)之外单击它时,它也被按下,它的行为就好像它是一个矩形,在其中绘制一个圆圈是一个问题。请帮忙!
class Dom(BoxLayout):
pass
class CBB(ButtonBehavior, Label):
pass
class CBApp(App):
pass
CBApp().run()
Kivy file---CB.kv
Dom:
<CBB>:
canvas:
Color:
rgba: (1, 0, 1, 0.1) if self.state == 'down' else (1,1,0,0.1)
Ellipse:
id:el
pos: self.center[0]- 100,self.center[1]- 100
size: 200, 200
angle_start: 0
angle_end: 360
<Dom>:
BoxLayout:
orientation:"vertical"
CBB:
text:"Hello World"
on_press:print("Hello World")
【问题讨论】:
-
请将您编写的代码添加到问题中,以便用户帮助您改进它
-
我已经添加了我的代码,请看。
-
另外,你检查过这个吗? stackoverflow.com/questions/41406252/…
标签: kivy kivy-language