mirror of https://github.com/kivy/kivy.git
widget: throw an exception when the user is trying to add itself to the children. closes #410
This commit is contained in:
parent
ec1b470242
commit
f7f47320d8
|
@ -222,6 +222,8 @@ class Widget(EventDispatcher):
|
|||
>>> slider = Slider()
|
||||
>>> root.add_widget(slider)
|
||||
'''
|
||||
if widget is self:
|
||||
raise WidgetException('You cannot add yourself in a Widget')
|
||||
if not isinstance(widget, Widget):
|
||||
raise WidgetException(
|
||||
'add_widget() can be used only with Widget classes.')
|
||||
|
|
Loading…
Reference in New Issue