我正在用Python和Kivy構建一個生命計數器。Python/Kivy - kv文件調用不起作用
下面我千伏
#:kivy 1.0
<Test>:
AnchorLayout:
anchor_x: 'center'
anchor_y: 'top'
ScreenManager:
size_hint: 1, .9
id: _screen_manager
Screen:
name: 'screen1'
BoxLayout:
orientation: 'vertical'
padding: 50
BoxLayout:
orientation: 'horizontal'
Button:
text: "Life Counter"
BoxLayout:
orientation: 'horizontal'
Button:
text: "Player 1"
Button:
text: "Player 2"
BoxLayout:
orientation: 'horizontal'
Button:
text: "-"
Button:
text: "0"
Button:
text: "+"
Button:
text: "-"
Button:
text: "0"
Button:
text: "+"
這裏的代碼是我的應用程序
import kivy
kivy.require('1.0.7')
from kivy.app import App
class TestApp(App):
pass
if __name__ == '__main__':
TestApp().run()
這裏是我的輸出
能否請你幫我瞭解我我錯過了? 如果我在kv文件中添加一個帶有描述的簡單按鈕,代碼完美工作。 謝謝
刪除':'在你的.kv行中並重新縮進。 –
FJSevilla
它的工作原理..謝謝! –