from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
class Grid(GridLayout):
pass
class UcoeApp(App):
def build(self):
return Grid()
UcoeApp().run()
ucoe.kv文件如下:無法做一個簡單的網格佈局與kivy 4個按鈕
<Grid>:
GridLayout:
cols:2
row_force_default:True
row_default_height:40
Button:
text:"hello1"
size_hint_x:None
width=100
Button:
text:"world1"
Button:
text:"hello2"
size_hint_x:None
width:100
Button:
text:"world2"
,但我得到的錯誤如下: 文件「/ usr/lib目錄/ python3/dist-packages/kivy/lang.py「,第1440行,parse_level '聲明後無效數據') kivy.lang.ParserException:解析器:文件」/home/dimple/ucoe.kv「,第4行: ... 2:GridLayout: 3:cols:2
4:row_force_default:真 5:row_default_height:40 6:
...聲明 後 無效數據請幫幫忙,我是kivy一個新手。