gui/tools/toolbox.py
def tool_click(self, evt):
        "Event handler tool selection (just add to default handler)"
    
        # get the control
        ctrl = self.menu_ctrl_map[evt.GetId()]
        # create the control on the parent:
        if self.inspector.selected_obj:
            # find the first parent drop target
            parent = self.inspector.selected_obj
            while parent.drop_target is None and parent.get_parent():
                parent = parent.get_parent()
            # create the new object
            obj = ctrl(parent, 
                       name="%s_%s" % (ctrl._meta.name.lower(), wx.NewId()), 
                       pos=(0, 0), designer=self.designer)
            # associate the object with the toolbox:
            if obj._meta.container:
                dt = ToolBoxDropTarget(obj, self.inspector.root_obj, 
                                       designer=self.designer, 
                                       inspector=self.inspector)
                obj.drop_target = dt
        # fix width and height if default is not visible
        w, h = obj.size
        if w <= 10:
            obj.width = 100
        if h <= 10:
            obj.height = 20

        # update the object at the inspector (to show the new control)
        if self.inspector:
            self.inspector.load_object(self.inspector.root_obj)  # refresh tree
            self.inspector.inspect(obj)
def tool_click(self, evt):
        "Event handler tool selection (just add to default handler)"
    
        # get the control
        ctrl = self.menu_ctrl_map[evt.GetId()]
        # create the control on the parent:
        if self.inspector.selected_obj:
            # find the first parent drop target
            parent = self.inspector.selected_obj
            while parent.drop_target is None and parent.get_parent():
                parent = parent.get_parent()
            # create the new object
            obj = ctrl(parent, 
                       name="%s_%s" % (ctrl._meta.name.lower(), wx.NewId()), 
                       pos=(0, 0), designer=self.designer)
            # associate the object with the toolbox:
            if obj._meta.container:
                dt = ToolBoxDropTarget(obj, self.inspector.root_obj, 
                                       designer=self.designer, 
                                       inspector=self.inspector)
                obj.drop_target = dt
        # fix width and height if default is not visible
        w, h = obj.size
        if w <= 10:
            obj.width = 100
        if h <= 10:
            obj.height = 20

        # update the object at the inspector (to show the new control)
        if self.inspector:
            self.inspector.load_object(self.inspector.root_obj)  # refresh tree
            self.inspector.inspect(obj)
Event handler tool selection (just add to default handler)