【发布时间】:2017-10-31 03:12:57
【问题描述】:
我想在我的所有屏幕上添加相同类型的小部件。并且当单击这些添加的小部件中的任何一个时,它会从所有屏幕中删除。这是目前的做法
def drinksSelect(self,value): # creating a button by referring the id of the layout in which to create button
drinkImagePath = {'pepsi': 'drinksPictures/pepsi.png','7up': 'drinksPictures/7up.png'}
if self.root.a_s.l < self.root.a_s.limit: # You know what I mean
st = 'number'
img = myImage(source= drinkImagePath[value], size=(200,20), id=st)
img2 = myImage(source=drinkImagePath[value], size=(200, 20), id='soo')
self.root.a_s.ids.place_remaining.add_widget(img)
self.root.m_s.ids.place.add_widget(img2)
self.root.a_s.l += 1
我正在使用这个删除图像
class myImage (Image):
def on_touch_down(self, touch):
if self.collide_point(*touch.pos):
self.parent.remove_widget(self)
这样做的问题是它只会删除被点击的图像,而不是其他屏幕上的图像。
【问题讨论】:
标签: android python python-3.x kivy kivy-language