我正在尝试将标签小部件放置在特定位置。我尝试了各种文档中提供的所有技巧。我无法将小部件放置在所需的位置。它始终在屏幕中间显示标签。即使我提供位置Pos =(20,20)。让我知道我的代码出了什么问题
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
class LoginScreen(FloatLayout):
def __init__(self, **kwargs):
super(LoginScreen, self).__init__(**kwargs)
layout = FloatLayout(size=(1024,600),pos=(0,0))
text_label = Label(text='User Name', pos=(20,20))
text_label.font_size=150
self.add_widget(text_label)
class MyApp(App):
def build(self):
self.title = "Login Screen"
return LoginScreen()
if __name__ == '__main__':
MyApp().run()