【发布时间】:2016-03-16 14:37:28
【问题描述】:
当我触及MyPaintWidget 时,会在其canvas 中创建一个椭圆。
但我也想检测用户何时触摸已经绘制的椭圆,以便我可以执行其他指令而不是再次绘制椭圆。
我看到self.collide_point 只适用于Widgets。
有其他解决方案吗?
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color, Ellipse
class MyPaintWidget(Widget):
def on_touch_down(self,touch):
with self.canvas:
Color(1,1,0)
d=30
Ellipse(pos=(touch.x-d/2,touch.y-d/2),size=(d,d))
class MyPaintApp(App):
def build(self):
return MyPaintWidget()
if __name__=='__main__':
MyPaintApp().run()
【问题讨论】:
标签: android python user-interface kivy