我在Kivy中遇到一个TextInput问题。在
当我将它添加到我的一个屏幕上现有的FloatLayout
时,它会占用整个窗口,即使指定了高度。我希望将此文件保存在.py文件中,因此请避免在.kv文件中添加任何用于调整大小的样式选项。在
class WebsiteInput(Screen):
def __init__(self, **kwargs):
super(WebsiteInput, self).__init__(**kwargs)
Clock.schedule_once(self._finish_init)
def _finish_init(self, dt):
# Title Label
self.lbl1 = Label(text="Enter a URL to bind to this button:", pos=(self.x, self.height +132))
self.lbl1.font_name = 'Montserrat-Bold.ttf'
self.lbl1.font_size = 28
self.ids.float_web.add_widget(self.lbl1)
# URL Text Input
self.web_input = TextInput(height=100)
self.web_input.height = 100
self.ids.float_web.add_widget(self.web_input)
如你所见,我已经尝试在两个不同的位置影响大小,它仍然填充了整个窗口。在
为了使} 属性在相应的轴上是
size
属性生效,您需要^{None
:相关问题 更多 >
编程相关推荐