![Smile :)](./images/smilies/icon_smile.gif)
Ich habe ein Problem, meine BoxLayout (das in einem FloatLayout liegt) richtig anzuordnen, so dass es in der unteren linken Ecke im FloatLayout sitzen soll. Das Padding soll dabei aber auch berücksichtigt bleiben.
Die Anordnung der ganzen Layouts möchte ich gern so beibehalten, da eigentlich noch mehr da drin ist.
py
Code: Alles auswählen
from kivymd.app import MDApp
from kivymd.uix.screenmanager import ScreenManager
from kivymd.uix.screen import Screen
from kivy.uix.screenmanager import FadeTransition
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.utils import platform
from kivy.clock import mainthread
from kivymd.uix.dialog import MDDialog
from kivymd.uix.button import MDRaisedButton
from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock
from kivy.properties import StringProperty
from kivy.utils import get_color_from_hex
if platform == "android":
from android.permissions import request_permissions, Permission
class GPS(Screen):
def __init__(self, **kwargs):
super(GPS, self).__init__(**kwargs)
class ArbeitszeitkontoApp(MDApp):
def build(self):
Builder.load_file("main.kv")
self.theme_cls.theme_style = (
"Dark" if self.theme_cls.theme_style == "Light" else "Light"
)
# ['Red', 'Pink', 'Purple', 'DeepPurple', 'Indigo', 'Blue', 'LightBlue', 'Cyan', 'Teal', 'Green',
# 'LightGreen', 'Lime', 'Yellow', 'Amber', 'Orange', 'DeepOrange', 'Brown', 'Gray', 'BlueGray']
self.theme_cls.primary_palette = "Gray" # Gray, Cyan, Blue, LightBlue
if platform == "android":
Window.fullsize = True
else:
Window.size = (450, 750)
Window.top = 120
Window.left = 600
screen_manager = ScreenManager()
screen_manager.transition = FadeTransition()
screen_manager.add_widget(GPS(name="GPS-Referenz"))
return screen_manager
if __name__ == "__main__":
ArbeitszeitkontoApp().run()
Code: Alles auswählen
<GPS>:
BoxLayout:
orientation: 'vertical'
padding: dp(10)
spacing: dp(10)
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'vertical'
background_color: (18/255, 25/255, 18/255, 1)
canvas.before:
Color:
rgba: self.background_color
Rectangle:
size: self.size
pos: self.pos
FloatLayout:
size: root.width, root.height
BoxLayout:
orientation: 'vertical'
padding: dp(1)
spacing: dp(2)
size_hint: (.45,.2)
pos_hint: {'bottom': .5, 'left': 1} # <- Diese BoxLayout versuche ich anzuordnen
background_color: (1, 1, 1, .8)
canvas.before:
Color:
rgba: self.background_color
Rectangle:
size: self.size
pos: self.pos
BoxLayout:
size_hint: (None,None)
size: (root.width * .8, root.height * .1)
pos_hint: {'center_x': .5, 'center_y': .5}
MDFillRoundFlatButton:
id: start_btn
text: 'Button'
text_color: get_color_from_hex('#111316')
md_bg_color: get_color_from_hex('#9eb0c7')
font_size: '24sp'
size_hint: (1, 1)
pos_hint: {'center_x': 1, 'center_y': .55}