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)
- Unnecessary black window appears when using Kivy and Multiprocessing HOT 2
- Kivy
- apk crashes on android without logging each time a lottie animation is used as the default splash screen HOT 6
- libpybundle.so Error HOT 1
- libpybundle.so error ... #support HOT 1
- Modify and update complete code for app HOT 3
- "Level 8" Logs? Constant spam, cannot disable without entirely turning off kivy logger. HOT 3
- Kivy Release Plan 2.3.0
- MDTextField rtl , persian,arabic writing HOT 3
- MDTextField or InputText Kivymd,kivy rtl , persian arabic support text HOT 1
- Documentation of the load_kv() method of kivy.App is incorrect HOT 6
- Label text not updated after calling open_settings() HOT 4
- I want to start HOT 2
- Reimplement/implement basic state behaviors: `ButtonBehavior`, `FocusBehavior` and `HoverBehavior`
- Textİnput rtl(peraian,arabic) bugs HOT 1
- Label rlt (persian,arabic) bug HOT 1
- Problem With set_custom_titlebar on Windows 11 HOT 14
- Label,TextInput rtl bug HOT 6
- Start the Service after phone restart/reboot HOT 1
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.