我想把布局unsing kivy语言打包出来,但我的Label并没有被AnchorLayout以任何方式影响
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import ListProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.properties import NumericProperty
from kivy.properties import StringProperty
wurzel = Builder.load_string('''
AnchorLayout:
Label:
text: 'test'
anchor_x:'left'
anchor_y:'top'
''')
class TurF(App):
def build(self):
return wurzel
TurF().run()
答案 0 :(得分:0)
AnchorLayout可能正常工作,但你的标签填写它。请设置类似以下的内容。
AnchorLayout:
Label:
text: 'test'
anchor_x:'left'
anchor_y:'top'
size_hint: None, None
size: 50, 50