I am new in kivy i can not add customise colour on progress bar kivy please help me to implement this
ProgressBar:
id: pb
size_hint:dp(.9),dp(.4)
background_color:"#22222"
#value: (app.time * 20) % 100.
value: 50
pos_hint: {"right": 1, "top": .65}
Use BorderImage
and change the source
.
There is no attribute, background_color
for ProgressBar
. It uses BorderImages. The first BorderImage
(e.g. blue.png) acts as a rail/track whereby the second BorderImage
(e.g. red.png) runs on the rail/track.
#:kivy 1.11.0
<Rootwidget>:
ProgressBar:
id: pb
max: 1000
canvas:
BorderImage:
border: (12, 12, 12, 12)
pos: self.x, self.center_y - 12
size: self.width, 24
source: 'blue.png'
BorderImage:
border: [int(min(self.width * (self.value / float(self.max)) if self.max else 0, 12))] * 4
pos: self.x, self.center_y - 12
size: self.width * (self.value / float(self.max)) if self.max else 0, 24
source: 'red.png'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With