Here is a screenshot of my kivy app. I am trying to get the TextInput
in the bottom left to be centered in the BoxLayout
which it is in, and I don't want it to be the same size as the layout, I want it to be much smaller. This BoxLayout
in question resides in the bottom half of the screen. I have tried setting the TextInput
s propertycenter:self.parent.center
but this doesn't work. As you can see, I have printed the center coords from the BoxLayout
into the TextInput
using that very line, self.parent.center, with the correct result. Yet, setting the TextInput
s center or position to these coords is not centering it, it doesn't move... what am I doing wrong?
py file:
import kivy
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
class TimeTabler(Widget):
pass
class TimerApp(App):
def build(self):
return TimeTabler()
if __name__ == "__main__":
TimerApp().run()
****kv file:****
#:kivy 1.0
BoxLayout:
orientation: 'vertical'
size: root.size
BoxLayout:
orientation: 'vertical'
Label:
text: 'TimeTabler'
BoxLayout:
TextInput:
text: '%s' % (self.parent.center) # why does this work here
size_hint: None, None
width: sp(200)
height: sp(30)
center: self.parent.center # but not here