def do_resize(self, evt, wx_obj, (n, w, s, e)):
        "Called by SelectionTag"
        # calculate the pos (minus the offset, not in a panel like rw!)
        pos = wx_obj.ScreenToClient(wx.GetMousePosition())
        x, y = pos
        if evt.ShiftDown():     # snap to grid:
            x = x / GRID_SIZE[0] * GRID_SIZE[0]
            y = y / GRID_SIZE[1] * GRID_SIZE[1]
        pos = wx.Point(x, y)
        if not self.resizing or self.resizing != (wx_obj, (n, w, s, e)):
            self.pos = list(pos)                        # store starting point
            self.resizing = (wx_obj, (n, w, s, e))      # track obj and handle
        else:
            delta = pos - self.pos 
            if DEBUG: print "RESIZING: n, w, s, e", n, w, s, e
            if n or w or s or e:
                # resize according the direction (n, w, s, e)
                x = wx_obj.Position[0] + e * delta[0]
                y = wx_obj.Position[1] + n * delta[1]
                if w or e:
                    if not isinstance(wx_obj, wx.TopLevelWindow):
                        width = wx_obj.Size[0] + (w - e) * delta[0]
                    else:
                        width = wx_obj.ClientSize[0] + (w - e) * delta[0]
                else:
                    width = None
                if n or s:
                    height = wx_obj.Size[1] + (s - n) * delta[1]
                else:
                    height = None
            else:
                # just move
                x = wx_obj.Position[0] + delta[0]
                y = wx_obj.Position[1] + delta[1]
                width = height = None
            new_pos = (x, y)
            new_size = (width, height)
            if new_size != wx_obj.GetSize() or new_pos != wx_obj.GetPosition():
                # reset margins (TODO: avoid resizing recursion)
                wx_obj.obj.margin_left = 0
                wx_obj.obj.margin_right = 0
                wx_obj.obj.margin_top = 0
                wx_obj.obj.margin_bottom = 0
                wx_obj.obj.pos = new_pos      # update gui specs (position)
                # update gui specs (size), but do not alter default value
                if width is not None and height is not None:
                    wx_obj.obj.width = width
                    wx_obj.obj.height = height
                elif width is not None:
                    wx_obj.obj.width = width
                elif height is not None:
                    wx_obj.obj.height = height
                # only update on sw for a smooth resize
                if w:
                    self.pos[0] = pos[0]        # store new starting point
                if s:
                    self.pos[1] = pos[1]