]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/multisash.py
"wxWindows" --> "wxWidgets"
[wxWidgets.git] / wxPython / wx / lib / multisash.py
index 2c7d5a537bcf913b3d523c6ec37797cf3cdec1a6..34ed2599a443fe5197d6ae8ad525f4818bdba322 100644 (file)
@@ -7,10 +7,20 @@
 # Created:      2002/11/20
 # Version:      0.1
 # RCS-ID:       $Id$
-# License:      wxWindows licensie
+# License:      wxWindows license
 #----------------------------------------------------------------------
+# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o 2.5 compatability update.
+#
+# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o wxMultiSash -> MultiSash
+# o wxMultiSplit -> MultiSplit 
+# o wxMultiViewLeaf -> MultiViewLeaf
+#
 
-from wxPython.wx import *
+import wx
 
 MV_HOR = 0
 MV_VER = not MV_HOR
@@ -20,12 +30,12 @@ CR_SIZE = SH_SIZE * 3
 
 #----------------------------------------------------------------------
 
-class wxMultiSash(wxWindow):
+class MultiSash(wx.Window):
     def __init__(self, *_args,**_kwargs):
-        apply(wxWindow.__init__,(self,) + _args,_kwargs)
+        apply(wx.Window.__init__,(self,) + _args,_kwargs)
         self._defChild = EmptyChild
-        self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
-        EVT_SIZE(self,self.OnMultiSize)
+        self.child = MultiSplit(self,self,(0,0),self.GetSize())
+        self.Bind(wx.EVT_SIZE,self.OnMultiSize)
 
     def SetDefaultChildClass(self,childCls):
         self._defChild = childCls
@@ -39,7 +49,7 @@ class wxMultiSash(wxWindow):
 
     def Clear(self):
         old = self.child
-        self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
+        self.child = MultiSplit(self,self,(0,0),self.GetSize())
         old.Destroy()
         self.child.OnSize(None)
 
@@ -55,7 +65,7 @@ class wxMultiSash(wxWindow):
         exec 'import %s' % mod
         self._defChild = eval(dChild)
         old = self.child
-        self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
+        self.child = MultiSplit(self,self,wxPoint(0,0),self.GetSize())
         self.child.SetSaveData(data['child'])
         old.Destroy()
         self.OnMultiSize(None)
@@ -65,10 +75,10 @@ class wxMultiSash(wxWindow):
 #----------------------------------------------------------------------
 
 
-class wxMultiSplit(wxWindow):
+class MultiSplit(wx.Window):
     def __init__(self,multiView,parent,pos,size,view1 = None):
-        wxWindow.__init__(self,id = -1,parent = parent,pos = pos,size = size,
-                          style = wxCLIP_CHILDREN)
+        wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
+                          style = wx.CLIP_CHILDREN)
         self.multiView = multiView
         self.view2 = None
         if view1:
@@ -76,44 +86,44 @@ class wxMultiSplit(wxWindow):
             self.view1.Reparent(self)
             self.view1.MoveXY(0,0)
         else:
-            self.view1 = wxMultiViewLeaf(self.multiView,self,
-                                         wxPoint(0,0),self.GetSize())
+            self.view1 = MultiViewLeaf(self.multiView,self,
+                                         (0,0),self.GetSize())
         self.direction = None
 
-        EVT_SIZE(self,self.OnSize)
+        self.Bind(wx.EVT_SIZE,self.OnSize)
 
     def GetSaveData(self):
         saveData = {}
         if self.view1:
             saveData['view1'] = self.view1.GetSaveData()
-            if isinstance(self.view1,wxMultiSplit):
+            if isinstance(self.view1,MultiSplit):
                 saveData['view1IsSplit'] = 1
         if self.view2:
             saveData['view2'] = self.view2.GetSaveData()
-            if isinstance(self.view2,wxMultiSplit):
+            if isinstance(self.view2,MultiSplit):
                 saveData['view2IsSplit'] = 1
         saveData['direction'] = self.direction
-        v1,v2 = self.GetPositionTuple()
+        v1,v2 = self.GetPosition()
         saveData['x'] = v1
         saveData['y'] = v2
-        v1,v2 = self.GetSizeTuple()
+        v1,v2 = self.GetSize()
         saveData['w'] = v1
         saveData['h'] = v2
         return saveData
 
     def SetSaveData(self,data):
         self.direction = data['direction']
-        self.SetDimensions(data['x'],data['y'],data['w'],data['h'])
+        self.SetDimensions(int(data['x']), int(data['y']), int(data['w']), int(data['h']))
         v1Data = data.get('view1',None)
         if v1Data:
             isSplit = data.get('view1IsSplit',None)
             old = self.view1
             if isSplit:
-                self.view1 = wxMultiSplit(self.multiView,self,
-                                          wxPoint(0,0),self.GetSize())
+                self.view1 = MultiSplit(self.multiView,self,
+                                          (0,0),self.GetSize())
             else:
-                self.view1 = wxMultiViewLeaf(self.multiView,self,
-                                             wxPoint(0,0),self.GetSize())
+                self.view1 = MultiViewLeaf(self.multiView,self,
+                                             (0,0),self.GetSize())
             self.view1.SetSaveData(v1Data)
             if old:
                 old.Destroy()
@@ -122,11 +132,11 @@ class wxMultiSplit(wxWindow):
             isSplit = data.get('view2IsSplit',None)
             old = self.view2
             if isSplit:
-                self.view2 = wxMultiSplit(self.multiView,self,
-                                          wxPoint(0,0),self.GetSize())
+                self.view2 = MultiSplit(self.multiView,self,
+                                          (0,0),self.GetSize())
             else:
-                self.view2 = wxMultiViewLeaf(self.multiView,self,
-                                             wxPoint(0,0),self.GetSize())
+                self.view2 = MultiViewLeaf(self.multiView,self,
+                                             (0,0),self.GetSize())
             self.view2.SetSaveData(v2Data)
             if old:
                 old.Destroy()
@@ -148,20 +158,20 @@ class wxMultiSplit(wxWindow):
     def AddLeaf(self,direction,caller,pos):
         if self.view2:
             if caller == self.view1:
-                self.view1 = wxMultiSplit(self.multiView,self,
+                self.view1 = MultiSplit(self.multiView,self,
                                           caller.GetPosition(),
                                           caller.GetSize(),
                                           caller)
                 self.view1.AddLeaf(direction,caller,pos)
             else:
-                self.view2 = wxMultiSplit(self.multiView,self,
+                self.view2 = MultiSplit(self.multiView,self,
                                           caller.GetPosition(),
                                           caller.GetSize(),
                                           caller)
                 self.view2.AddLeaf(direction,caller,pos)
         else:
             self.direction = direction
-            w,h = self.GetSizeTuple()
+            w,h = self.GetSize()
             if direction == MV_HOR:
                 x,y = (pos,0)
                 w1,h1 = (w-pos,h)
@@ -170,9 +180,8 @@ class wxMultiSplit(wxWindow):
                 x,y = (0,pos)
                 w1,h1 = (w,h-pos)
                 w2,h2 = (w,pos)
-            self.view2 = wxMultiViewLeaf(self.multiView,self,
-                                         wxPoint(x,y),wxSize(w1,h1))
-            self.view1.SetSize(wxSize(w2,h2))
+            self.view2 = MultiViewLeaf(self.multiView, self, (x,y), (w1,h1))
+            self.view1.SetSize((w2,h2))
             self.view2.OnSize(None)
 
     def DestroyLeaf(self,caller):
@@ -191,8 +200,8 @@ class wxMultiSplit(wxWindow):
             self.view1.SetSize(self.GetSize())
             self.view1.Move(self.GetPosition())
         else:
-            w,h = self.GetSizeTuple()
-            x,y = self.GetPositionTuple()
+            w,h = self.GetSize()
+            x,y = self.GetPosition()
             if caller == self.view1:
                 if self == parent.view1:
                     parent.view1 = self.view2
@@ -230,7 +239,7 @@ class wxMultiSplit(wxWindow):
         if not (self.view1 and self.view2):
             return
         if pos < 10: return
-        w,h = self.GetSizeTuple()
+        w,h = self.GetSize()
         if side == MV_HOR:
             if pos > w - 10: return
         else:
@@ -247,11 +256,11 @@ class wxMultiSplit(wxWindow):
             self.view1.SetSize(self.GetSize())
             self.view1.OnSize(None)
             return
-        v1w,v1h = self.view1.GetSizeTuple()
-        v2w,v2h = self.view2.GetSizeTuple()
-        v1x,v1y = self.view1.GetPositionTuple()
-        v2x,v2y = self.view2.GetPositionTuple()
-        w,h = self.GetSizeTuple()
+        v1w,v1h = self.view1.GetSize()
+        v2w,v2h = self.view2.GetSize()
+        v1x,v1y = self.view1.GetPosition()
+        v2x,v2y = self.view2.GetPosition()
+        w,h = self.GetSize()
 
         if v1x != v2x:
             ratio = float(w) / float((v1w + v2w))
@@ -269,8 +278,8 @@ class wxMultiSplit(wxWindow):
         else:
             v1h = v2h = h
 
-        self.view1.SetDimensions(v1x,v1y,v1w,v1h)
-        self.view2.SetDimensions(v2x,v2y,v2w,v2h)
+        self.view1.SetDimensions(int(v1x), int(v1y), int(v1w), int(v1h))
+        self.view2.SetDimensions(int(v2x), int(v2y), int(v2w), int(v2h))
         self.view1.OnSize(None)
         self.view2.OnSize(None)
 
@@ -278,10 +287,10 @@ class wxMultiSplit(wxWindow):
 #----------------------------------------------------------------------
 
 
-class wxMultiViewLeaf(wxWindow):
+class MultiViewLeaf(wx.Window):
     def __init__(self,multiView,parent,pos,size):
-        wxWindow.__init__(self,id = -1,parent = parent,pos = pos,size = size,
-                          style = wxCLIP_CHILDREN)
+        wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
+                          style = wx.CLIP_CHILDREN)
         self.multiView = multiView
 
         self.sizerHor = MultiSizer(self,MV_HOR)
@@ -291,7 +300,10 @@ class wxMultiViewLeaf(wxWindow):
         self.detail = MultiClient(self,multiView._defChild)
         self.closer = MultiCloser(self)
 
-        EVT_SIZE(self,self.OnSize)
+        self.Bind(wx.EVT_SIZE,self.OnSize)
+
+        self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE))
+
 
     def GetSaveData(self):
         saveData = {}
@@ -302,10 +314,10 @@ class wxMultiViewLeaf(wxWindow):
                 dData = attr()
                 if dData:
                     saveData['detail'] = dData
-        v1,v2 = self.GetPositionTuple()
+        v1,v2 = self.GetPosition()
         saveData['x'] = v1
         saveData['y'] = v2
-        v1,v2 = self.GetSizeTuple()
+        v1,v2 = self.GetSize()
         saveData['w'] = v1
         saveData['h'] = v2
         return saveData
@@ -335,7 +347,7 @@ class wxMultiViewLeaf(wxWindow):
 
     def AddLeaf(self,direction,pos):
         if pos < 10: return
-        w,h = self.GetSizeTuple()
+        w,h = self.GetSize()
         if direction == MV_VER:
             if pos > h - 10: return
         else:
@@ -362,20 +374,20 @@ class wxMultiViewLeaf(wxWindow):
 #----------------------------------------------------------------------
 
 
-class MultiClient(wxWindow):
+class MultiClient(wx.Window):
     def __init__(self,parent,childCls):
         w,h = self.CalcSize(parent)
-        wxWindow.__init__(self,id = -1,parent = parent,
-                          pos = wxPoint(0,0),
-                          size = wxSize(w,h),
-                          style = wxCLIP_CHILDREN | wxSUNKEN_BORDER)
+        wx.Window.__init__(self,id = -1,parent = parent,
+                          pos = (0,0),
+                          size = (w,h),
+                          style = wx.CLIP_CHILDREN | wx.SUNKEN_BORDER)
         self.child = childCls(self)
         self.child.MoveXY(2,2)
         self.normalColour = self.GetBackgroundColour()
         self.selected = False
 
-        EVT_SET_FOCUS(self,self.OnSetFocus)
-        EVT_CHILD_FOCUS(self,self.OnChildFocus)
+        self.Bind(wx.EVT_SET_FOCUS,self.OnSetFocus)
+        self.Bind(wx.EVT_CHILD_FOCUS,self.OnChildFocus)
 
     def UnSelect(self):
         if self.selected:
@@ -386,11 +398,11 @@ class MultiClient(wxWindow):
     def Select(self):
         self.GetParent().multiView.UnSelect()
         self.selected = True
-        self.SetBackgroundColour(wxColour(255,255,0)) # Yellow
+        self.SetBackgroundColour(wx.Colour(255,255,0)) # Yellow
         self.Refresh()
 
     def CalcSize(self,parent):
-        w,h = parent.GetSizeTuple()
+        w,h = parent.GetSize()
         w -= SH_SIZE
         h -= SH_SIZE
         return (w,h)
@@ -398,8 +410,8 @@ class MultiClient(wxWindow):
     def OnSize(self,evt):
         w,h = self.CalcSize(self.GetParent())
         self.SetDimensions(0,0,w,h)
-        w,h = self.GetClientSizeTuple()
-        self.child.SetSize(wxSize(w-4,h-4))
+        w,h = self.GetClientSize()
+        self.child.SetSize((w-4,h-4))
 
     def SetNewChildCls(self,childCls):
         if self.child:
@@ -415,34 +427,37 @@ class MultiClient(wxWindow):
         self.OnSetFocus(evt)
 ##        from Funcs import FindFocusedChild
 ##        child = FindFocusedChild(self)
-##        EVT_KILL_FOCUS(child,self.OnChildKillFocus)
+##        child.Bind(wx.EVT_KILL_FOCUS,self.OnChildKillFocus)
 
 
 #----------------------------------------------------------------------
 
 
-class MultiSizer(wxWindow):
+class MultiSizer(wx.Window):
     def __init__(self,parent,side):
         self.side = side
         x,y,w,h = self.CalcSizePos(parent)
-        wxWindow.__init__(self,id = -1,parent = parent,
-                          pos = wxPoint(x,y),
-                          size = wxSize(w,h),
-                          style = wxCLIP_CHILDREN)
+        wx.Window.__init__(self,id = -1,parent = parent,
+                          pos = (x,y),
+                          size = (w,h),
+                          style = wx.CLIP_CHILDREN)
 
         self.px = None                  # Previous X
         self.py = None                  # Previous Y
         self.isDrag = False             # In Dragging
         self.dragTarget = None          # View being sized
 
-        EVT_LEAVE_WINDOW(self,self.OnLeave)
-        EVT_ENTER_WINDOW(self,self.OnEnter)
-        EVT_MOTION(self,self.OnMouseMove)
-        EVT_LEFT_DOWN(self,self.OnPress)
-        EVT_LEFT_UP(self,self.OnRelease)
+        self.Bind(wx.EVT_LEAVE_WINDOW,self.OnLeave)
+        self.Bind(wx.EVT_ENTER_WINDOW,self.OnEnter)
+        self.Bind(wx.EVT_MOTION,self.OnMouseMove)
+        self.Bind(wx.EVT_LEFT_DOWN,self.OnPress)
+        self.Bind(wx.EVT_LEFT_UP,self.OnRelease)
+
+        self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE))
+
 
     def CalcSizePos(self,parent):
-        pw,ph = parent.GetSizeTuple()
+        pw,ph = parent.GetSize()
         if self.side == MV_HOR:
             x = CR_SIZE + 2
             y = ph - SH_SIZE
@@ -460,15 +475,15 @@ class MultiSizer(wxWindow):
         self.SetDimensions(x,y,w,h)
 
     def OnLeave(self,evt):
-        self.SetCursor(wxStockCursor(wxCURSOR_ARROW))
+        self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
 
     def OnEnter(self,evt):
         if not self.GetParent().CanSize(not self.side):
             return
         if self.side == MV_HOR:
-            self.SetCursor(wxStockCursor(wxCURSOR_SIZENS))
+            self.SetCursor(wx.StockCursor(wx.CURSOR_SIZENS))
         else:
-            self.SetCursor(wxStockCursor(wxCURSOR_SIZEWE))
+            self.SetCursor(wx.StockCursor(wx.CURSOR_SIZEWE))
 
     def OnMouseMove(self,evt):
         if self.isDrag:
@@ -508,28 +523,28 @@ class MultiSizer(wxWindow):
 #----------------------------------------------------------------------
 
 
-class MultiCreator(wxWindow):
+class MultiCreator(wx.Window):
     def __init__(self,parent,side):
         self.side = side
         x,y,w,h = self.CalcSizePos(parent)
-        wxWindow.__init__(self,id = -1,parent = parent,
-                          pos = wxPoint(x,y),
-                          size = wxSize(w,h),
-                          style = wxCLIP_CHILDREN)
+        wx.Window.__init__(self,id = -1,parent = parent,
+                          pos = (x,y),
+                          size = (w,h),
+                          style = wx.CLIP_CHILDREN)
 
         self.px = None                  # Previous X
         self.py = None                  # Previous Y
         self.isDrag = False           # In Dragging
 
-        EVT_LEAVE_WINDOW(self,self.OnLeave)
-        EVT_ENTER_WINDOW(self,self.OnEnter)
-        EVT_MOTION(self,self.OnMouseMove)
-        EVT_LEFT_DOWN(self,self.OnPress)
-        EVT_LEFT_UP(self,self.OnRelease)
-        EVT_PAINT(self,self.OnPaint)
+        self.Bind(wx.EVT_LEAVE_WINDOW,self.OnLeave)
+        self.Bind(wx.EVT_ENTER_WINDOW,self.OnEnter)
+        self.Bind(wx.EVT_MOTION,self.OnMouseMove)
+        self.Bind(wx.EVT_LEFT_DOWN,self.OnPress)
+        self.Bind(wx.EVT_LEFT_UP,self.OnRelease)
+        self.Bind(wx.EVT_PAINT,self.OnPaint)
 
     def CalcSizePos(self,parent):
-        pw,ph = parent.GetSizeTuple()
+        pw,ph = parent.GetSize()
         if self.side == MV_HOR:
             x = 2
             y = ph - SH_SIZE
@@ -547,13 +562,13 @@ class MultiCreator(wxWindow):
         self.SetDimensions(x,y,w,h)
 
     def OnLeave(self,evt):
-        self.SetCursor(wxStockCursor(wxCURSOR_ARROW))
+        self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
 
     def OnEnter(self,evt):
         if self.side == MV_HOR:
-            self.SetCursor(wxStockCursor(wxCURSOR_HAND))
+            self.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
         else:
-            self.SetCursor(wxStockCursor(wxCURSOR_POINT_LEFT))
+            self.SetCursor(wx.StockCursor(wx.CURSOR_POINT_LEFT))
 
     def OnMouseMove(self,evt):
         if self.isDrag:
@@ -588,53 +603,53 @@ class MultiCreator(wxWindow):
             evt.Skip()
 
     def OnPaint(self,evt):
-        dc = wxPaintDC(self)
-        dc.SetBackground(wxBrush(self.GetBackgroundColour(),wxSOLID))
+        dc = wx.PaintDC(self)
+        dc.SetBackground(wx.Brush(self.GetBackgroundColour(),wx.SOLID))
         dc.Clear()
 
-        highlight = wxPen(wxSystemSettings_GetColour(wxSYS_COLOUR_BTNHIGHLIGHT), 1, wxSOLID)
-        shadow = wxPen(wxSystemSettings_GetColour(wxSYS_COLOUR_BTNSHADOW), 1, wxSOLID)
-        black = wxPen(wxBLACK,1,wxSOLID)
-        w,h = self.GetSizeTuple()
+        highlight = wx.Pen(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT), 1, wx.SOLID)
+        shadow = wx.Pen(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNSHADOW), 1, wx.SOLID)
+        black = wx.Pen(wx.BLACK,1,wx.SOLID)
+        w,h = self.GetSize()
         w -= 1
         h -= 1
 
         # Draw outline
         dc.SetPen(highlight)
-        dc.DrawLine((0,0), (0,h))
-        dc.DrawLine((0,0), (w,0))
+        dc.DrawLine(0,0, 0,h)
+        dc.DrawLine(0,0, w,0)
         dc.SetPen(black)
-        dc.DrawLine((0,h), (w+1,h))
-        dc.DrawLine((w,0), (w,h))
+        dc.DrawLine(0,h, w+1,h)
+        dc.DrawLine(w,0, w,h)
         dc.SetPen(shadow)
-        dc.DrawLine((w-1,2), (w-1,h))
+        dc.DrawLine(w-1,2, w-1,h)
 
 #----------------------------------------------------------------------
 
 
-class MultiCloser(wxWindow):
+class MultiCloser(wx.Window):
     def __init__(self,parent):
         x,y,w,h = self.CalcSizePos(parent)
-        wxWindow.__init__(self,id = -1,parent = parent,
-                          pos = wxPoint(x,y),
-                          size = wxSize(w,h),
-                          style = wxCLIP_CHILDREN)
+        wx.Window.__init__(self,id = -1,parent = parent,
+                          pos = (x,y),
+                          size = (w,h),
+                          style = wx.CLIP_CHILDREN)
 
         self.down = False
         self.entered = False
 
-        EVT_LEFT_DOWN(self,self.OnPress)
-        EVT_LEFT_UP(self,self.OnRelease)
-        EVT_PAINT(self,self.OnPaint)
-        EVT_LEAVE_WINDOW(self,self.OnLeave)
-        EVT_ENTER_WINDOW(self,self.OnEnter)
+        self.Bind(wx.EVT_LEFT_DOWN,self.OnPress)
+        self.Bind(wx.EVT_LEFT_UP,self.OnRelease)
+        self.Bind(wx.EVT_PAINT,self.OnPaint)
+        self.Bind(wx.EVT_LEAVE_WINDOW,self.OnLeave)
+        self.Bind(wx.EVT_ENTER_WINDOW,self.OnEnter)
 
     def OnLeave(self,evt):
-        self.SetCursor(wxStockCursor(wxCURSOR_ARROW))
+        self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
         self.entered = False
 
     def OnEnter(self,evt):
-        self.SetCursor(wxStockCursor(wxCURSOR_BULLSEYE))
+        self.SetCursor(wx.StockCursor(wx.CURSOR_BULLSEYE))
         self.entered = True
 
     def OnPress(self,evt):
@@ -649,12 +664,12 @@ class MultiCloser(wxWindow):
         self.down = False
 
     def OnPaint(self,evt):
-        dc = wxPaintDC(self)
-        dc.SetBackground(wxBrush(wxRED,wxSOLID))
+        dc = wx.PaintDC(self)
+        dc.SetBackground(wx.Brush(wx.RED,wx.SOLID))
         dc.Clear()
 
     def CalcSizePos(self,parent):
-        pw,ph = parent.GetSizeTuple()
+        pw,ph = parent.GetSize()
         x = pw - SH_SIZE
         w = SH_SIZE
         h = SH_SIZE + 2
@@ -669,33 +684,33 @@ class MultiCloser(wxWindow):
 #----------------------------------------------------------------------
 
 
-class EmptyChild(wxWindow):
+class EmptyChild(wx.Window):
     def __init__(self,parent):
-        wxWindow.__init__(self,parent,-1, style = wxCLIP_CHILDREN)
+        wx.Window.__init__(self,parent,-1, style = wx.CLIP_CHILDREN)
 
 
 #----------------------------------------------------------------------
 
 
 def DrawSash(win,x,y,direction):
-    dc = wxScreenDC()
+    dc = wx.ScreenDC()
     dc.StartDrawingOnTopWin(win)
-    bmp = wxEmptyBitmap(8,8)
-    bdc = wxMemoryDC()
+    bmp = wx.EmptyBitmap(8,8)
+    bdc = wx.MemoryDC()
     bdc.SelectObject(bmp)
-    bdc.DrawRectangle((-1,-1), (10,10))
+    bdc.DrawRectangle(-1,-1, 10,10)
     for i in range(8):
         for j in range(8):
             if ((i + j) & 1):
-                bdc.DrawPoint((i,j))
+                bdc.DrawPoint(i,j)
 
-    brush = wxBrush(wxColour(0,0,0))
+    brush = wx.Brush(wx.Colour(0,0,0))
     brush.SetStipple(bmp)
 
     dc.SetBrush(brush)
-    dc.SetLogicalFunction(wxXOR)
+    dc.SetLogicalFunction(wx.XOR)
 
-    body_w,body_h = win.GetClientSizeTuple()
+    body_w,body_h = win.GetClientSize()
 
     if y < 0:
         y = 0
@@ -717,8 +732,8 @@ def DrawSash(win,x,y,direction):
     h = body_h
 
     if direction == MV_HOR:
-        dc.DrawRectangle((x,y-2), (w,4))
+        dc.DrawRectangle(x,y-2, w,4)
     else:
-        dc.DrawRectangle((x-2,y), (4,h))
+        dc.DrawRectangle(x-2,y, 4,h)
 
     dc.EndDrawingOnTop()