Skip to content

Instantly share code, notes, and snippets.

@kived
Created October 7, 2015 16:45
Show Gist options
  • Save kived/831c76a9ad7b2dcf9e77 to your computer and use it in GitHub Desktop.
Save kived/831c76a9ad7b2dcf9e77 to your computer and use it in GitHub Desktop.
Kivy: EffectWidget in ScreenManager test
import kivy
kivy.require('1.9.1')
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.effectwidget import EffectWidget, PixelateEffect
from kivy.properties import StringProperty
class PixelLabel(EffectWidget):
text = StringProperty()
def __init__(self, **kwargs):
super(PixelLabel, self).__init__(**kwargs)
self.effects = [PixelateEffect()]
root = Builder.load_string('''
<PixelLabel>:
Label:
text: root.text
bold: True
<LabelGrid@GridLayout>:
cols: 4
canvas.before:
Color:
rgba: 0.4, 0.5, 0.2, 1
Rectangle:
size: self.size
pos: self.pos
#PixelLabel:
Label:
text: 'One'
Label:
text: 'Two'
Label:
text: 'Three'
Label:
text: 'Four'
Label:
text: 'Five'
Label:
text: 'Six'
Label:
text: 'Seven'
Label:
text: 'Eight'
Label:
text: 'Nine'
Label:
text: 'Ten'
Label:
text: 'Eleven'
Label:
text: 'Twelve'
Label:
text: 'Thirteen'
Label:
text: 'Fourteen'
Label:
text: 'Fifteen'
Label:
text: 'Sixteen'
ScreenManager:
Screen:
name: 'labels'
LabelGrid
''')
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