Last active
April 26, 2020 22:51
-
-
Save tshirtman/5651140 to your computer and use it in GitHub Desktop.
TextShadow example
This file contains hidden or 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
from kivy.app import App | |
from kivy.uix.label import Label | |
from kivy.properties import ListProperty | |
class ShadowLabel(Label): | |
decal = ListProperty([0, 0]) | |
tint = ListProperty([1, 1, 1, 1]) | |
class ShadowApp(App): | |
pass | |
if __name__ == '__main__': | |
ShadowApp().run() |
This file contains hidden or 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
BoxLayout: | |
orientation: 'vertical' | |
ShadowLabel: | |
text: 'test ' * 10 | |
decal: 10, -10 | |
tint: .5, .5, .5, .5 | |
color: 1, 1, 0, 1 | |
ShadowLabel: | |
text: 'test test' | |
decal: 5, -5 | |
tint: .1, .5, .5, .5 | |
color: 1, 0, 1, 1 | |
Widget: | |
canvas.before: | |
Color: | |
rgba: 1, 1, 1, 1 | |
Rectangle: | |
pos: self.pos | |
size: self.size | |
ShadowLabel: | |
text: 'test' | |
decal: 2, -2 | |
tint: .5, .5, 1, .5 | |
color: 1, 0, 0, 1 | |
pos: self.parent.pos | |
size: self.parent.size | |
<ShadowLabel>: | |
canvas.before: | |
Color: | |
rgba: root.tint | |
Rectangle: | |
pos: | |
int(self.center_x - self.texture_size[0] / 2.) + root.decal[0],\ | |
int(self.center_y - self.texture_size[1] / 2.) + root.decal[1] | |
size: root.texture_size | |
texture: root.texture | |
Color: | |
rgba: 1, 1, 1, 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!