Skip to content

Instantly share code, notes, and snippets.

@vijinho
Created October 28, 2014 13:32
Show Gist options
  • Save vijinho/66e200cf3bbec4ff5b7a to your computer and use it in GitHub Desktop.
Save vijinho/66e200cf3bbec4ff5b7a to your computer and use it in GitHub Desktop.
Kivy Debug Test Script
# -*- coding: utf-8 -*-
import kivy
kivy.require('1.8.0')
from kivy.uix.image import Image
from kivy.uix.behaviors import ButtonBehavior
from kivy.properties import ObjectProperty, StringProperty
from kivy.uix.widget import Widget
from kivy.app import App
from kivy.lang import Builder
from kivy.config import Config
import os
class Test(Widget):
def __init__(self, **kwargs):
super(Test, self).__init__()
class TestApp(App):
folder = StringProperty()
def __init__(self):
self.folder = os.path.dirname(os.path.abspath(__file__))
App.__init__(self)
def build(self):
return Test()
if __name__ in ('__main__', '__android__'):
Builder.load_string('''
#:kivy 1.8.0
# DEBUG ALL WIDGETS
<Widget>:
canvas.after:
Line:
rectangle: self.x+1, self.y+1, self.width-1, self.height-1
dash_offset: 5
dash_length: 3
<Test@Widget>:
BoxLayout:
Button:
text: 'Test'
Label:
text: 'Test'
canvas.after:
Color:
rgba: 1, 0, 0, 0.5
Line:
rectangle: self.x+1, self.y+1, self.width-1, self.height-1
Color:
rgba: 0, 0, 1, 0.3
Rectangle:
pos: self.pos
size: self.size
''')
TestApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment