]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/GridEnterHandler.py
Script updates
[wxWidgets.git] / wxPython / demo / GridEnterHandler.py
index 719c622ef07bdb6e362fddc158a811c0856bfeaf..bdcd8ccb7d8e392930f5f35de52430e8a09a7bcf 100644 (file)
@@ -1,11 +1,12 @@
-from wxPython.wx import *
-from wxPython.grid import *
+
+import  wx
+import  wx.grid as  gridlib
 
 #---------------------------------------------------------------------------
 
 
 #---------------------------------------------------------------------------
 
-class NewEnterHandlingGrid(wxGrid):
+class NewEnterHandlingGrid(gridlib.Grid):
     def __init__(self, parent, log):
     def __init__(self, parent, log):
-        wxGrid.__init__(self, parent, -1)
+        gridlib.Grid.__init__(self, parent, -1)
         self.log = log
 
         self.CreateGrid(20, 6)
         self.log = log
 
         self.CreateGrid(20, 6)
@@ -15,11 +16,11 @@ class NewEnterHandlingGrid(wxGrid):
         self.SetColSize(0, 150)
         self.SetColSize(5, 150)
 
         self.SetColSize(0, 150)
         self.SetColSize(5, 150)
 
-        EVT_KEY_DOWN(self, self.OnKeyDown)
+        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
 
 
     def OnKeyDown(self, evt):
 
 
     def OnKeyDown(self, evt):
-        if evt.KeyCode() != WXK_RETURN:
+        if evt.KeyCode() != wx.WXK_RETURN:
             evt.Skip()
             return
 
             evt.Skip()
             return
 
@@ -29,8 +30,10 @@ class NewEnterHandlingGrid(wxGrid):
 
         self.DisableCellEditControl()
         success = self.MoveCursorRight(evt.ShiftDown())
 
         self.DisableCellEditControl()
         success = self.MoveCursorRight(evt.ShiftDown())
+
         if not success:
             newRow = self.GetGridCursorRow() + 1
         if not success:
             newRow = self.GetGridCursorRow() + 1
+
             if newRow < self.GetTable().GetNumberRows():
                 self.SetGridCursor(newRow, 0)
                 self.MakeCellVisible(newRow, 0)
             if newRow < self.GetTable().GetNumberRows():
                 self.SetGridCursor(newRow, 0)
                 self.MakeCellVisible(newRow, 0)
@@ -42,9 +45,9 @@ class NewEnterHandlingGrid(wxGrid):
 
 #---------------------------------------------------------------------------
 
 
 #---------------------------------------------------------------------------
 
-class TestFrame(wxFrame):
+class TestFrame(wx.Frame):
     def __init__(self, parent, log):
     def __init__(self, parent, log):
-        wxFrame.__init__(self, parent, -1, "Simple Grid Demo", size=(640,480))
+        wx.Frame.__init__(self, parent, -1, "Simple Grid Demo", size=(640,480))
         grid = NewEnterHandlingGrid(self, log)
 
 
         grid = NewEnterHandlingGrid(self, log)
 
 
@@ -53,9 +56,9 @@ class TestFrame(wxFrame):
 
 if __name__ == '__main__':
     import sys
 
 if __name__ == '__main__':
     import sys
-    app = wxPySimpleApp()
+    app = wx.PySimpleApp()
     frame = TestFrame(None, sys.stdout)
     frame = TestFrame(None, sys.stdout)
-    frame.Show(true)
+    frame.Show(True)
     app.MainLoop()
 
 
     app.MainLoop()