Change Button, Label and Text Input Widget Colors + Font Settings in Kivy- Python's App-Builder GUI!

LeMaster Tech
183 followers
2 Video Views·Apr 22, 2025
Learn to develop universally compatible apps using Python and Kivy!! This is episode 6 in an intro to Kivy series from LeMaster Tech. This episode covers defining colors using the R,G,B, alpha settings and adjusting font sizes, bold and italics settings and more in Kivy!
Be sure to check out our channel for tons of additional python tutorials and practice problems and be sure to like and subscribe if you find our content useful!!
https://www.youtube.com/channel/UCV5Ab39YnXvTZ6Grar9URxQ
If you want to see anything specific on the channel or have technical questions about anything leave a comment on our of our videos and we will get back as soon as we can!
hey what's going on you guys welcome
back to the channel uh today's going to
be our next episode in our kibby with
python tutorial series and if you missed
the first ones in the series we are
starting from uh kind of a
functioning login app where you type in
a username you enter a password and you
hit this confirm button and then it
outputs hello username your password is
now whatever you typed in the password
bar so if you want to follow along line
for line i recommend you either pause
the video and copy down the code you see
here
or you go back and check out those
videos because we are going to be diving
right into some new stuff
so today's video in particular we're
going to be finally taking a look at
kind of improving the aesthetics of your
app changing some background colors and
text colors as well as messing around
with like things like bold and italics
and colors in kivy aren't exactly
standard if you've worked with other
gooeys in kibby or in python like kinter
or pygame kibby's is a little bit
different so
let's dive right into it uh
one thing that i'm going to talk about
real quick is colors for kibby
they do come in
colors
are what's called rgb
a which is red green blue and then alpha
if you're familiar with programming in
general you've probably seen
like a three coordinate value zero to
two five five that's your rgb what you
maybe haven't seen before is alpha which
is opacity
and then uh these colors are actually a
little different because each entry is
zero to one so like if i want red
um i want it to be
r
of one and then g and b of zero but then
i want it to just be one if i want solid
red
if i want a
green it's um you know kind of the same
thing zero one zero
one so a lot of times i like to actually
make my uh
i like to make my colors as variables so
anytime i call them i've already thought
about the color and defined it
but when i use these variables later on
you'll see we are going to be able to um
we would be able to just punch the rgb
values in right there or these modified
rgbs
excuse me
so i'm going to just start with
red green and blue so i can call them
later but then when we're using the
colors i'll tweak that
opacity a little bit that alpha value
and you can kind of see what it does
um
so let's go ahead and start with our uh
confirm button i think that's a good
place to mess around a little bit
and let's start by just saying
background underscore color
and let's make it
blue
and i'll just run this real quick so you
can see that
straight away and you see we've got this
really dark blue button
but one thing i do want to show you guys
real quick as well is if i take that
same background color blue and i apply
it to
one of our text inputs so let's say
background color blue for the text input
you know something kind of interesting
we just called the same color
but we got two different colors right
there so um
why is that i want to talk about it real
quick if you notice um i'll get rid of
that again real quick
the text inputs background started from
a point of being white and the confirm
entry buttons background started from a
point of being gray so what it did is it
put our same blue that you see here it
stuck it on top of the gray background
and that's why it was so much darker
so i kind of think it looks good like
that but if you want to change it to
where it's just the same blue it's like
your true blue then what you change is
this
setting for buttons which is called
background
normal
and you do an equals and this
technically it's like taking an image
and sticking it on the back of the
background so it's like taking a picture
of a gray rectangle
and making that the background of the
button what we're going to do here is
say well don't take any image so now
there's going to be no background
and now if we say background color blue
let's go ahead and get that on this line
so now if we say background color blue
and we load it in it should be the exact
same blue as our text entry button
okay and it is um i actually am gonna
get rid of the background normal one
because i preferred it a little bit
darker but just know if you prefer
looking at it um as that vibrant blue
and knowing exactly what color you're
defining it that you would need to
change that background normal setting
so let's go ahead and make the other
text input
um
background color
we'll make this one green
might be kind of a funky looking app you
might never actually build an app
you might never actually build an app
that looks like this but i'm trying to
trying to show a lot in one video so
there we go we got green and blue going
on here
we've got our
button
with a interesting background color
let's go ahead and take a look at what
you can do with labels real easily
so i'm not going to get into how to
change the background color of your
labels in this video because it actually
replied
requires a fairly advanced like defining
of a canvas um and then setting a
background like image and defining a
rectangle space for it so we're going to
do that after we've covered kind of
using the kibby design language but what
you can do really easily with labels is
you can rather than background color you
can use just regular color and that will
change the color of the text so here
if i say color equals red for the
label of username and i'll go ahead and
apply the same thing to the label of
password
so now if we run that
okay we get red username and password
which is
kind of cool
so then
confirm entry your password is now
secret
um
but uh we can do a few other kind of
cool and unique things with the labels
so let's go ahead and look at some of
those now
um
there are two settings probably kind of
uh self-explanatory but you can do
italic which is going to you'll see it's
going to put the text in italics and
then you can also do another one so we
did that to username let's go ahead down
to password
and we'll make that one bold and so like
this the setting is just bold equals
true or false and then italic equals
true or false and those will both by
default um be false so you can obviously
see password is bold now username is um
username is italicized you can do both
so we would be able to make this bold
and italic
you know that's that's a valid look it's
definitely
um
you know it's it's vibrant it jumps out
at you uh and then something else that
you can do is and i know we talked about
this briefly when we made the button but
um you can use font size and we can make
that a little bit bigger
so now it should kind of jump off the
screen at you a little bit more yeah
because we made it bigger
so
i'll go ahead take this bold italic and
font size i'll apply that to both of
them so for future videos uh we're going
to have it look a little bit more like
this so um it's definitely kind of got a
funky look to it uh but i still think
it's it's more fun than just the plain
like black and white we've been dealing
with so going forward um
going forward we're gonna uh take this
app and so if you're watching the videos
as a series um just know i'm gonna kind
of keep it in this state so hopefully
you found this video useful uh there's
definitely a lot more you can do with
style but i try to keep these videos
pretty tight um so if you have any
questions about something in particular
go ahead let me know about in the
comments i'll try to get back to you as
soon as i can um and if you found this
or anything else on the channel useful i
really appreciate a like on the video
and to subscribe to the channel it helps
the channel out a ton and as always
thank you so much for watching the
videos and good luck with your code
thanks bye
