widget: assign default value proeprties if they are passed into parameters at __init__

This commit is contained in:
Mathieu Virbel 2010-11-05 22:49:02 -04:00
parent c46a70c49d
commit deabcddd06
1 changed files with 8 additions and 1 deletions

View File

@ -68,7 +68,15 @@ class Widget(EventDispatcher):
self.register_event_type('on_touch_up')
self.register_event_type('on_draw')
# Before doing anything, ensure the windows exist.
EventLoop.ensure_window()
# Apply the existing arguments to our widget
for key, value in kwargs.iteritems():
if hasattr(self, key):
setattr(self, key, value)
# Create the default canvas
self.canvas = Canvas()
# Apply all the styles
@ -76,7 +84,6 @@ class Widget(EventDispatcher):
#
# Collision
#