Giter VIP home page Giter VIP logo

Comments (6)

ElliotGarbus avatar ElliotGarbus commented on June 10, 2024

Do you have a minimal example? This does not make sense to me. The FloatLayout will honor the pos of it's children, making the padding of the parent layout irrelevant. In the example below, press Button One to print the size and pos of the floatlayout, size and pos of button One (self), and the position of the Button Two (the child of the floatlayout).

from kivy.app import App
from kivy.lang import Builder

kv = """
BoxLayout:
    orientation: 'vertical'
    padding: 10
    Button:
        text: 'One'
        on_release: print(f'{fl.pos=} {fl.size=} {self.size=} {self.pos=} {fl_child.pos=}')
    FloatLayout:
        id: fl
        Button:
            id: fl_child
            text: 'two'
    Button:
        text: 'Three'
"""


class BoxPadFloatApp(App):
    def build(self):
        return Builder.load_string(kv)


BoxPadFloatApp().run()

output:
fl.pos=[10, 253.33333333333334] fl.size=[980, 243.33333333333334] self.size=[980, 243.33333333333334] self.pos=[10, 496.6666666666667] fl_child.pos=[0, 0]

from kivy.

Samael-TLB avatar Samael-TLB commented on June 10, 2024

What I mean is that I understand FloatLayout will honor the pos of it's children, in this case its (0,0). But this contradicts with the behaviour of the parent which is BoxLayout. Boxlayout guarantees that the children shall respect the paddings.
Now there comes the issue, boxlayout makes the starting of the widget to be after the padding but the float layout should not ignore that when the children did not ask it to . That is by default, the float layout's (0,0), should start after the padding of its parent BoxLayout.

If the FloatLayout doesn't regard the padding for positioning its children, then it should also not regard the padding for its own sizing. If it takes its sizing from its parent then its positioning should also take that into consideration. Like that should be the case right, any layouts boundary denotes the (0,0) inside this layout ( please note I'm not referring it to be relative coordinates, but just conveying the idea of the starting position). Then it can obviously regard child position as requested.

from kivy.

Samael-TLB avatar Samael-TLB commented on June 10, 2024

output:
fl.pos=[10, 253.33333333333334] fl.size=[980, 243.33333333333334] self.size=[980, 243.33333333333334] self.pos=[10, 496.6666666666667] fl_child.pos=[0, 0]

Yes, as seen the fly pos is at 10,253.333 and fl_child pos is 0,0.
This denotes the notion that the float layout is letting the child to be at the 0,0 of the root relative widget( here window).
This though it behaves normally like the float layout is stated to be, but doesn't it negates the padding constraint of the boxlayout. This behaviour disregards the expected one, but upon investigation we see that this is how float layout behaves.

i think there's a need for some clear descriptions in the docs or we should have the constraints being followed.

from kivy.

ElliotGarbus avatar ElliotGarbus commented on June 10, 2024

There is not a bug here. I suggest closing this issue. If you would like to continue this discussion on Discord, I'd be happy to continue.

from kivy.

Samael-TLB avatar Samael-TLB commented on June 10, 2024

Thanks @Julian-O for closing the issue.

from kivy.

Samael-TLB avatar Samael-TLB commented on June 10, 2024

There is not a bug here. I suggest closing this issue. If you would like to continue this discussion on Discord, I'd be happy to continue.

Surely.

from kivy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.