我试图更改另一个方法中按钮的属性。这是我目前正在使用的:
def _finish_init(self, dt):
self.ids.grid_1.cols = 5
def callfun(self, *args):
self.ChangePic()
# Creating a variable to use to determine if the buttons should be editable
binded = 0
# Loop to make 15 different buttons on screen
for x in range(15):
self.buttons.append(Button())
self.ids.grid_1.add_widget(self.buttons[x])
self.buttons[x].background_normal = 'YOUTUBE.png'
self.buttons[x].background_down = 'opacity.png'
self.buttons[x].bind(on_release=partial(self.HoldButtonNum, x))
# Make the button switch screens to input from calling the function above
if edit_mode is True:
self.buttons[x].bind(on_release=partial(self.SwitchScreenInput, x))
def ChangePic(self, *args):
_finish_init().buttons[1].background_normal = 'folder.png'
调用ChangePic时,我得到错误:
NameError: name '_finish_init' is not defined
有什么建议吗
看起来这两个函数都是一个类的成员,您需要使用
相关问题 更多 >
编程相关推荐