【发布时间】:2019-07-17 23:47:57
【问题描述】:
我有 MainScreen 类。单击“下一步”功能中的按钮后,我需要移动图片。我正在尝试在“下一个”功能中设置一个新值,但它不会更改该值。
class MainScreen(Screen):
btns = ObjectProperty(None)
img = ObjectProperty(None)
pic_pos = -0.8
def __init__(self, **kwargs):
super(MainScreen, self).__init__(**kwargs)
self.pic = Image(source='img/icon-back.png', pos_hint={'x': self.pic_pos, 'y': 0})
self.img.add_widget(self.pic)
def on_btns(self, *args):
for x in word_list:
self.btn = Button(text=x)
self.btn.bind(on_press=self.next)
self.btns.add_widget(self.btn)
# here I am trying to change the value
def next(self, instance):
self.pic_pos = 0.3
我该怎么做?
【问题讨论】:
标签: python kivy kivy-language