0
KV 파일에서 버튼의 배경색을 변경하고 싶지만 작동하지 않습니다. 버튼이 정의되어 있고 파이썬 파일에서 반복됩니다.파이썬에서 정의 된 KV 파일의 버튼에 액세스하기
def gotoPost(i, instance):
print("HAHAHAH")
Manager.current = 'ScreenTwo'
class ScreenOne(Screen):
box = ObjectProperty(None)
def on_box(self, *args):
for i in range(5):
btn = Button(text=str(i))
btn.bind(on_press=partial(gotoPost,i))
self.box.add_widget(btn)
Factory.register('ScreenOne', cls=ScreenOne)
class ScreenTwo(Screen):
pass
class Manager(ScreenManager):
screen_one = ObjectProperty(None)
screen_two = ObjectProperty(None)
class MainApp(App):
def build(self):
return Manager()
if __name__=="__main__":
MainApp().run()
어떻게 KV 파일의 버튼에 액세스합니까?
질문은 "KV 파일의 버튼에 어떻게 액세스합니까?"입니다. 파이썬 스크립트에서는 그렇지 않습니다. – ikolim