Answers for "Set a Widget size to the parent size from python in kivy"

0

Set a Widget size to the parent size from python in kivy

A widget keeps a reference to its parent in self.parent.
So you can just use

self.parent.size or self.parent.pos or whatever.

Depending on what you're doing,
it may be necessary or useful to make sure
you check if self.parent is None first, 
so that your code doesn't fail for widgets with no parent.
Posted by: Guest on August-13-2021

Python Answers by Framework

Browse Popular Code Answers by Language