Skip to content

Instantly share code, notes, and snippets.

@rdeaton
Created March 23, 2013 21:30
Show Gist options
  • Save rdeaton/5229433 to your computer and use it in GitHub Desktop.
Save rdeaton/5229433 to your computer and use it in GitHub Desktop.
class RegisterForm(spyral.Form):
name = spyral.TextInputWidget(self, 50, "Name")
password = spyral.TextInputWidget(self, 50, "Pass")
user_type = spyral.RadioGroup(self, map(partial(spyral.RadioButtonWidget, self), ["Admin", "User", "Guest"]))
remember_me = spyral.CheckboxWidget(self)
okay = spyral.ButtonWidget(self, "Okay")
cancel = spyral.ButtonWidget(self, "Cancel")
form = RegisterForm(scene)
# Three options
# One: Direct to widgets
print form.name
# <spyral.TextInputWidget ...>
form.name.pos = (20, 20)
# They're all sprites and they can manipulate them directly
# To get values, you do
print form.values.name
# Two: Straight to values
print form.name
# Cory
print form.password
# CorgisAreCool
# To get the sprites
print form.widgets.name
# <spyral.TextInputWidget ...>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment