mirror of https://github.com/kivy/kivy.git
widget: assign default value proeprties if they are passed into parameters at __init__
This commit is contained in:
parent
c46a70c49d
commit
deabcddd06
|
@ -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
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue