I'm starting to write a program using kivy
, but I have some problems understand how it deals with sizes.
For example:
import kivy
kivy.require('1.5.1')
from kivy.app import App
from kivy.uix.button import Button
class MyApp(App):
def build(self): return Button(text='Some text')
MyApp().run()
The above program works, but it creates a huge window. Trying to set size=(100, 100)
does not change anything. Setting size_hint=(None, None)
will show a button with the correct size, but it is placed randomly inside a still huge window.
Trying to set the size of MyApp
does not change anything too.
How do I create a window with the same size of the button?
It should be a simple enough task, but looking at the documentation and example I can't find anything about this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…