Changing Kivy Button Colors - Python Kivy GUI Tutorial #7

preview_player
Показать описание
In this video I'll show you how to change the color of buttons with Kivy.

Kivy uses a kind of weird color system that looks like this (1,1,1,1) where each of those 1's represents a color (Red, Green, Blue, and Alpha).

To choose colors, divide the RGB value you want by 255.0 to get the kivy color code.

I'll also show you a hacky way to use hex color codes instead of the weir (1,1,1,1) thing.
Рекомендации по теме
Комментарии
Автор

▶️ Watch Entire Kivy Playlist ✅ Subscribe To My YouTube Channel:
▶️ See More At: ✅ Join My Facebook Group:
▶️ Get The Code

Codemycom
Автор

Hello John sir, kivy can also recognize hex color code directly which I tried and it works. For example:
Button:
background_normal: ' '
background_color: "#00800ff "

Thank you for your tutorials sir

dhanushhv
Автор

For anyone who's having trouble and confused of why the button hasn't changed its color, just add this syntax to the button

background_normal: ' '

I spent 2 hours of my life looking for this solution. Happy coding everyone :>

jettergarcia
Автор

John, not sure what you find weird in the color coding, but it's not unusual to use normalized (0 to 1) values for RGB, e.g. in image processing, color science, ... and not all colours data is coded on 8bits (0-255)! Normalizing the color allows to have even more accurate colors (with the matching human eyes and appropriate display). Excellent series on kivy: concise, efficient and to the point.

hinokikuaimu
Автор

The way Kivy handles colors is pretty unreasonable

shnigle_shnagle
Автор

If you will write like background_color:rgba(0, 255, 0, ) instead of background_color:(0, 1, 0, 1) the rgb values will get normal

siderealvictor
Автор

As usual very good videos and very good explain thanks

alaahoussen
Автор

Thaks for the video, but it only shows how to change the color of button in normal state. When the button is touched it shows another color. How can I change this color?

brunoluizfonseca
Автор

Submit button still darkens when clicked, is it possible to change the on click color?

hbarudi
Автор

Hello jhon, as usual excellent video from an excellent man

charantechgeek
Автор

when i tried to run the code in, a dialog box appears that displays "Kivy Fatal Error" and suddenly closed, what should i do sir.

vanshatcode
Автор

I'm having an issue, seeing if anyone else has this as well/if there is an answer.

When I add the background_color parameter to the Button section, the button doesn't change color, but it does give me an outline of that color around the button. I can get the same outline around the text input boxes as well if I move the background_color part to them as well, but none of them get filled in with that color, it just stays as the default color.

It does this if I use the standard fraction color code, or if I use the hex type. Adding the background_normal parameter does remove the grayness of the outline, but it is still just an outline.

Anyone have any ideas on why this is happening?

marshallsentz
Автор

Thanks for today's video...you are just awesome...keep it up

SammarpanDasguptaOfficial
Автор

when i put the code ```background_normal: ' '``` into the design file i get the error [Errno 13] Permission denied: 'filepathtofolder', its fine when i remove it though

Ooms_
Автор

is there a way of adding threading to kivy as the screen hangs on few tasks plz tell me

kanishkbhattacharya
Автор

can you make a video on how I can upload our kivy fill on android and google play plz?

AR-mkks
Автор

Hi, John! Could you help: how to change the color of the button when it pressed? It seems like a big problem, since the press-color can only be in shades of blue, and there are bugs when released

КаЩеЙ-шс
Автор

how did you add the error correction in the video? was it a new edited video upload to youtube?

vegam
Автор

Hey Jhon, I had problem only background line gets colorer not full button do u know why?

BipBop
Автор

John, i have another question. Dividing in python always returns float is this 255.0 needed? Couldn't we just divide by 255?

thenaturat
welcome to shbcf.ru