Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created December 14, 2011 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tshirtman/1478634 to your computer and use it in GitHub Desktop.
Save tshirtman/1478634 to your computer and use it in GitHub Desktop.
#:kivy 1.0
#:import SomeWidget main.SomeWidget
# rules for the widget
<SomeWidget>:
BoxLayout:
pos: root.pos
size: root.size
orientation: "vertical"
Label:
text: "hello"
Button:
text: "world"
# root
BoxLayout:
id: layout
Button:
text: "add"
on_press: layout.add_widget(SomeWidget())
#!/usr/bin/env python
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.factory import Factory
class SomeWidget(Widget):
pass
Factory.register('SomeWidget', SomeWidget)
class Main(App):
pass
Main().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment