0
此代碼中缺少運行傳送帶?
我正嘗試將旋轉木馬按鈕放入旋鈕中。當我跑步時,它顯示一個按鈕,但on_press沒有任何反應。 此代碼中運行傳送帶時缺少什麼?Kivy旋轉木馬從一個按鈕
Builder.load_string('''
<tela>:
Button:
text: 'ir'
font_size: 32
size_hint: None, None
pos_hint: {'right': 1}
size: 150, 50
on_press: root.ida()
''')
class acesso(BoxLayout):
def ida(self):
self.clear_widgets()
self.add_widget(tela1())
class tela(BoxLayout):
def ida(self):
self.parent.ida()
class tela1(App,Widget):
def livro(self):
carousel = Carousel(direction='right',loop='true')
for i in range(1,5):
src = "images/%d.png" % i
image = Image(source=src,pos=(1,10), size=(1250, 635))
carousel.add_widget(image)
return carousel
class CarroselApp(App):
def build(self):
self.acesso = acesso()
self.acesso.add_widget(tela())
return self.acesso
if __name__ == "__main__":
CarroselApp().run()
請輸入完整的代碼。它更容易複製。 – svineet