Kivy with Python tutorial Part 6 - Layouts: Float Layout

preview_player
Показать описание
In this Kivy application development tutorial, we cover one of the layouts built into Kivy: Float Layout. Depending on your application, you may use one of the many layouts, or you may even mix and match.

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

I am in an internship and choose to use Kivy and Python and this is amazong help indeed. I will watch all of his tutorials

rajarshiroy
Автор

Just a note for next viewers: You can use ['center_y': 0.5 ] or ['center_x': 0.5] inside [pos_hint] to center (exactly) buttons on window.
Thanks for video :)

luismatias
Автор

QUICK EXPLANATION:

"x" : 0->1 goes from the LEFT to the RIGHT and it places the LEFT of the widget in place.
"center_x": 0->1 goes from the LEFT to the RIGHT and it places the MIDDLE of the widget in place.
"right" : 0->1 goes from the RIGHT to the LEFT and it places the RIGHT of the widget in place.

"y" : 0->1 goes from the BOTTOM to the TOP and it places the BOTTOM of the widget in place.
"center_x": 0->1 goes from the BOTTOM to the TOP and it places the MIDDLE of the widget in place.
"top" : 0->1 goes from the TOP to the BOTTOM and it places the TOP of the widget in place.

BleachWizz
Автор

Just a comment, the (0, 0) isn't "flipped" ist just that on OpenGL left bottom corner is where the 0, 0 is. Since kivy runs on OpenGL I guess it wouldn't make any sense to just shift the 0, 0 to the top left corner.
Thanks for the FloatLayout explanation thought, was very useful. (:

RonnieAndrewMagatti
Автор

Doesn't work for me. I followed (more exactly: copied) your code and the "kivy" button isn't on screen.

epischewurststullederverda
Автор

Thanks bro fot your stuff. It's helped me a lot =) Best regard from Ukraine.

sviat
Автор

My Python App does not seem to be picking up my .kv files (though) they are in the same directory. Is there any naming conviction that I need to follow? Please let me know. I had to (in frustration) use float layout by directly specifying in Python code. Please help me

brpawankumariyengar
Автор

is the init not needed here because the app class inherits only from the Widgets? Thank you

tsalamazing
Автор

Does the buttons created can be deserved to hold any action like submitting to databases?
And does kivy helps for Android app creation for mobile phones?

kowsikr
Автор

I suppose it is in't the degree of topness or rightness, it is just the location of the top or right edge of the widget. 0 is extreme bottom or left and 1 is extreme top or right

sraheja
Автор

how can we remove responsiveness of our kivy app?and if we really want to be our button at top-center then we have to pass "top":0.7 right?

ifredpingplay
Автор

hey can we add a widget infront of an image widget..if so how?

dreamchaser
Автор

After looking at the docs/source code I think the reason your "bot" key in the dictionary is not working, is that it doesn't exist (at least in kivy 1.9.1, not sure about the version you were using in the video). The dictionary will take any keyword you give it but not throw you an error like "keyword 'bot' is not a valid keyword" which is kind of misleading.

The valid keys for the dictionary are:
x: How far in the x direction (from bottom left of button and screen)
right: How far right (from right side of button and left of screen)
y: How far in the y direction (from bottom left of button and screen)
top: How far up (from bottom of screen and top of button)
center_x: How far in the x direction(from the center x point of the button and left of the screen)
center_y: How far in the y direction(from the center y point of the button and bottom of the screen)
center: This one combines both center_x and center_y, however takes a list or tuple of the two values. Eg. {"center": (0.5, 0.5)} centers the button at the center of the screen anchored at the center of the button.
pos: Similar to center except it uses the bottom left of the button as the anchor (Combines x and y). This also takes a tuple

Hope this helps someone, feel free to leave a comment if I messed something up, I am new to kivy aswell.

Thanks :)

Justin-oobh
Автор

I don't understand why you could make buttons without importing it into the python code. Can anyone explain this?

yomomma
Автор

I think the better way to explain the 'degree of...' is to rather use 1 = on, 0 = off, like a lightswitch. That way when bottom=0 would make more sense when it starts at bottom

ViaNocturna
Автор

omg space after colon! :D thanks great tutorial.

crumpz
Автор

i am not able to run the kivy programm

aruntiwari
Автор

The Buttons don't it's show in my screen...

pedrobarbosa
Автор

i run this code in Raspberry PI, all work good only one problem is that ... when i enter text from keyboard for username/password/TFA ...all are print in twice, double the character.
any one help, why this happen ???

nngohel
Автор

10: Button:
>> 11: text: "Kivy"
12: pos_hint: {"x": 0, 'y':0}
13:
...
Invalid data after declaration

whats the issue here

DevS
visit shbcf.ru