Comments (6)
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.
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.
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.
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.
Thanks @Julian-O for closing the issue.
from kivy.
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)
- Dependency Dashboard
- Investigate an alternative for `no-response` bot
- Pyinstaller package required `LD_PRELOAD` to start on Linux HOT 1
- `disable_multitouch` should also disable MTD loading on Linux
- Markup=True in TextInput
- Scroll_to method jumps new widgets between bottom and top
- TabbedPanel button text is rotated when 'tab_pos: "left_top"' is used HOT 1
- DampedScrollEffect.update_velocity: ValueError: cannot convert float NaN to integer
- Add support for picamera2 HOT 1
- Why can't I find MDDataTable in Kivymd 2.3? HOT 1
- CMake error when installing SDL2 dependencies
- How to implement an android floating window? and accessibility controls? No relevant instructions found in the document HOT 1
- KIVY AnchorLayout How can i put 2 children widget in 1 AnchorLayout? xd HOT 12
- ActionOverflow crashes when there is an ActionSeparator
- kivy 2.3.0 unable to get Window macOS 10.13
- matplotlib error kivy 2.3.0 HOT 2
- Fails to build with GCC 14 due to -Wincompatible-pointer-types HOT 3
- ffpyplayer crashes on Linux after a number of files played HOT 5
- Kivylang include other kv files and is invalid in apk HOT 1
- Touch Focus for Android / iOS camera applications using Kivy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kivy.