Reputation: 59
I print in the build function of the app root.size
and get the ouptut (100,100)
which is default to any widget, but if I try to create a button in the .kv file that when is pressed prints root.size
prints (800,600)
Why is that happening?
class MovieApp(App):
def build(self):
root = MovieScreen()
print(root.size)
return MovieScreen()
MovieApp().run()
movie.kv
<MovieScreen>
Button:
on_press: print(root.size)
pos_hint: {"x": 0, "y": 0}
background_color: 1,0,0,1
Upvotes: 0
Views: 17
Reputation: 29468
Because during the build method root.size
has value (100, 100)
, but once the app is running root.size
has value (800, 600)
, presumably because the layout logic has now run and it is filling the default-sized Window.
Upvotes: 1