Last active
March 18, 2021 20:18
-
-
Save kived/3f6a638fc4827957f933463954524de5 to your computer and use it in GitHub Desktop.
Kivy: Separator widgets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Separator@Widget>: | |
canvas: | |
Color: | |
rgba: 1, 1, 1, 1 | |
Rectangle: | |
pos: self.pos | |
size: self.size | |
<HSeparator@Separator>: | |
size_hint_y: None | |
height: dp(2) | |
<VSeparator@Separator>: | |
size_hint_x: None | |
width: dp(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kivy | |
kivy.require('1.8.1') | |
from kivy.app import App | |
from kivy.lang import Builder | |
root = Builder.load_string(''' | |
<Separator@Widget>: | |
canvas: | |
Color: | |
rgba: 1, 1, 1, 1 | |
Rectangle: | |
pos: self.pos | |
size: self.size | |
<HSeparator@Separator>: | |
size_hint_y: None | |
height: dp(2) | |
<VSeparator@Separator>: | |
size_hint_x: None | |
width: dp(2) | |
BoxLayout: | |
Widget | |
VSeparator | |
Widget | |
VSeparator | |
BoxLayout: | |
orientation: 'vertical' | |
Widget | |
HSeparator | |
Widget | |
HSeparator | |
Widget | |
''') | |
class TestApp(App): | |
def build(self): | |
return root | |
if __name__ == '__main__': | |
TestApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice practical use of kv templates. I slightly changed it to add a parameter for the colour :