Omid CompSCI Omid CompSCI - 29 days ago 10
Python Question

How to make size of Label very small in terms of WIDTH and HEIGHT. Python and Kivy

Lets say we have a gridlayout that is 2 columns.
We then add something like this:

gridLayout = GridLayout(cols = 2, orientation = "horizontal")
button = Button(text = "Hello")
label = Label(text = "World", size_hint = (.1,.1))
gridLayout.add_widget(button)
gridLayout.add_widget(label)


I need the 2 columns, but I pretty much want the button to have most of the screen and the label to just be a very small placeholder.

I have tried doing size_hint's on both and just not able to change the size of it.

I am using Python 2.7.x and Kivy 1.8 +

Thanks.

Answer

This code seems to work for me, but perhaps you need to use the width/height directly, for which you'll need to set size_hint = (None, None). You might be interested even in texture_size.

Just a note, if you use Kivy 1.8 or basically anything that's below the latest stable version (now 1.9.1), it's the best time to update Kivy asap.

Comments