I am using python-2.7
and kivy
. Can someone tell me that how to add a different colour border to kivy button.
from kivy.uix.screenmanager import Screen
from kivy.app import App
from kivy.core.window import Window
Window.clearcolor = (0.5, 0.5, 0.5, 1)
Window.size = (300, 100)
class User(Screen):
pass
class Test(App):
def build(self):
return self.root
if __name__ == '__main__':
Test().run()
User:
BoxLayout:
Button:
background_normal: ''
text: 'Ok'
I suppose you mean additionnaly to the current background/border.
If so, you probably want to use some canvas instruction.
You probably want to add them in canvas.before
so it's drawn before the text of the button.
The instruction you'll use will depend on the effect you want, but Line is probably a good start.
Button:
text: 'test'
canvas.before:
Color:
rgba: .5, .5, .5, 1
Line:
width: 2
rectangle: self.x, self.y, self.width, self.height
You may want to look at the border property of the Button Class,basically: In kiv:
Button:
border: (10,10,10,10)
I believe this will be the border image used by BorderImage
Disclaimer: Not tested but its along those lines
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