0
爲什麼此代碼會生成以下錯誤?將小部件結果添加到「AttributeError:'HomeScreen'對象沒有屬性'_trigger_layout'」
AttributeError: 'HomeScreen' object has no attribute '_trigger_layout'
class HomeScreen(BoxLayout):
def __init__(self):
print "homescreen"
topbar = BoxLayout(spacing = -2, size = (64, 64), size_hint = (1, None))
back_button = Button(size = (32, 64), size_hint = (None, 1), text = '>', font_size = 15 + 0.015 * self.height, background_color = (0.239, 0.815, 0.552, 1))
home_button = Button(text = "HOME", font_size = 10 + 0.015 * self.width, background_color = (0.239, 0.815, 0.552, 1))
more_button = Button(size = (32, 64), size_hint = (None, 1), text = '...', font_size = 15 + 0.015 * self.height, background_color = (0.239, 0.815, 0.552, 1))
topbar.add_widget(back_button)
topbar.add_widget(home_button)
topbar.add_widget(more_button)
self.add_widget(topbar)
現在我的按鈕是不可見的,我一個空白屏幕,你知道如何解決這一問題? –
如果我複製並粘貼我的代碼,我會得到上面的內容(請參閱添加的屏幕快照)。你也不明白嗎? – PalimPalim
當我將代碼隔離在調試文件中時,它可以工作。但是,當我將它與已經先進的應用程序集成時,它不會顯示3個按鈕。 –