From: Javier Sancho Date: Wed, 18 Jul 2018 11:22:53 +0000 (+0200) Subject: Replace type with isinstance X-Git-Url: https://git.jsancho.org/?p=kivyforms.git;a=commitdiff_plain;h=b3f59c08b88ab111e72ea08bedf6c0af0e86f294 Replace type with isinstance --- diff --git a/kivyforms/formcanvas.py b/kivyforms/formcanvas.py index 0f8f2fe..4cd1b80 100644 --- a/kivyforms/formcanvas.py +++ b/kivyforms/formcanvas.py @@ -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()