Can I design a button like the one given in pic using Kivy? [closed]
-
20-12-2019 - |
Frage
I need white background for the buttons and a picture on the left. And also an arrow mark on the left like in the picture. I also want to do rounded corners for the button. Are the above things possible with Kivy? And also how di I do it. Give me an example or something! Thanks!
Lösung
Are the above things possible with Kivy?
The answer is simply 'yes'. Do you have a specific context that you're having trouble with?
You simply need to create your own widget rule that displays things the way you want. It might start as something like
<YourRule@BoxLayout>:
text: 'something' # define a property to hold the button text,
# could also be done in python
Image:
size_hint_x: None
width: self.height # make it square
source: 'whatever'
Label:
text_size: self.size # the text wrapping bounds
text: root.text
halign: 'left'
Image:
size_hint_x: None
width: dp(10)
source: 'right_arrow.png' # assuming you have a picture of the button arrow
# you could also draw one manually with kivy canvas instructions
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow