]> git.jsancho.org Git - kivyforms.git/blobdiff - kivyforms/formcanvas.py
Replace type with isinstance
[kivyforms.git] / kivyforms / formcanvas.py
index 0f8f2fee5d4e17aad23b8c1c5a0a51910dc97a99..4cd1b802f55db19210d226a2ca2952d111123575 100644 (file)
@@ -64,7 +64,7 @@ class Grabbable(BoxLayout):
         self.size_hint = self.form_canvas.widgets_size_hint
 
         for widget in self.form_canvas.walk(restrict=True):
-            if type(widget) is Grabbable and widget.collide_point(x, y):
+            if isinstance(widget, Grabbable) and widget.collide_point(x, y):
                 idx = widget.get_index()
                 if widget.point_area == 'top':
                     widget.parent.add_widget(self, index=idx + 1)
@@ -158,10 +158,10 @@ class FormCanvas(ButtonBehavior, StackLayout):
         widgets = self.walk(restrict=True)
         next(widgets)    # the first widget is the FormCanvas
         for widget in widgets:
-            if not type(widget) is Grabbable:
+            if not isinstance(widget, Grabbable):
                 # Look for the widget position inside the tree
                 parent = widget.parent
-                if type(parent) is Grabbable:
+                if isinstance(parent, Grabbable):
                     parent = parent.parent
                 while not parent is stack[-1]:
                     stack.pop()