Answer the question
In order to leave comments, you need to log in
Why is the button nailed to the bottom left corner?
Good day, there is a python code:
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.graphics import Color, Rectangle
from kivy import Config
from kivy.lang import Builder
Config.set("graphics", "fullscreen", "auto")
Builder.load_file("app.kv")
class MyWidget(Widget):
def __init__(self):
super().__init__()
self.size_hint = 0.2, 1
class MainWidget(App):
def build(self):
main_widget = BoxLayout(orientation="horizontal")
main_widget.add_widget(MyWidget())
return main_widget
if __name__ == '__main__':
MainWidget().run()
<MyWidget>:
canvas:
Color:
rgba: (0.3, 0.3, 0.3, 1)
Rectangle:
pos: self.pos
size: self.size
Button:
text: "button"
size_hint: 0.5, 1
pos_hint: {"center_y": .5, "center_x": .5}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question