1
时如上图所见被复制,我想让我的苹果剩下的现货和复制苹果成为draagable对象。 哪种方式可能?
这是我的代码现在。
mn.py
from kivy.uix.widget import Widget
from kivy.uix.behaviors import DragBehavior
from kivy.app import App
from kivy.properties import StringProperty
class apple_0(DragBehavior,Widget):
def on_touch_move(self,touch):
return super(apple_0, self).on_touch_move(touch)
class apple_1(DragBehavior,Widget):
def on_touch_move(self,touch):
return super(apple_1, self).on_touch_move(touch)
class base_0(Widget):
def basepicture_0(self):
pass
class mn(Widget):
pass
class mnApp(App):
def build(self):
return mn()
if __name__=='__main__':
mnApp().run()
mn.kv
<mn>:
canvas:
Color:
rgb: 1,1,1,1
Rectangle:
size: root.width,root.height
pos: 0,0
Label:
pos: 30, root.top- 70
text:
('[size=20][color=000000]'
'fnc_slide_0'
'[/color][/0ize]')
markup: True
base_0:
id: base_0_id
pos: root.width/7, root.height/3
apple_0:
id: apple_0_id
pos: root.width/1.7,root.height/1.6
auto_bring_to_front: True
apple_1:
id: apple_1_id
pos: root.width/1.5,root.height/1.6
auto_bring_to_front: True
<base_0>
size: 944, 502
canvas:
Rectangle:
pos: self.pos
size: self.size
source: 'base_0.png'
<apple_0>:
size: 56.25,56.25
drag_rectangle: self.x, self.y, self.width, self.height
drag_timeout: 10000000
drag_distance: 0
canvas:
Rectangle:
pos: self.pos
size: self.size
source: 'apple_0.png'
<apple_1>:
size: 28.125,56.25
drag_rectangle: self.x, self.y, self.width, self.height
drag_timeout: 10000000
drag_distance: 0
canvas:
Rectangle:
pos: self.pos
size: self.size
source: 'apple_1.png'