Can somebody test these two shorts applications? Robin?
They are not working ok on my platform.
I informed Vadim Zeiltin about the problems.
(I hope I didn't make a programming error)
···
#####################################################
#####################################################
#-------------------------------------------------------------------
# Grid1.py, wxgrid in a dialog window
#
# win98, python 2.2, wxPython 2.3.3pre2
# wxmsw233h.dll: time stamp 04/05/02 12.57p size 4373553
# file ver 0.0.0.0
# (infos from MS dependency walker)
#
# problems
# - cannot quit a cell in edit mode when hitting the ESC key
# - if cell in edit mode, ENTER pops up a new window!
# - check self.gg.CreateGrid(3, 2) in Dlg: grid is not desplayed
#-------------------------------------------------------------------
from wxPython.wx import *
from wxPython.grid import *
#-------------------------------------------------------------------
class DlgGrid1(wxDialog):
def __init__(self, parent, id):
wxDialog.__init__(self, parent, id, "DlgDataGrid1",
wxPoint(10, 10), wxSize(500, 400))
self.gg = wxGrid(self, -1, wxPoint(10, 10), wxSize(400, 300),
wxSIMPLE_BORDER)
#with the following next line, grid is not desplayed
#~ self.gg.CreateGrid(3, 2)
self.gg.CreateGrid(30, 20) #display ok
#-------------------------------------------------------------------
class MyPanel(wxPanel):
def __init__(self, parent, id):
wxPanel.__init__(self, parent, id)
but1 = wxButton(self, 1001, "Grid", wxPoint(20, 20), wxDefaultSize)
EVT_BUTTON(self, 1001, self.OnClick1)
def OnClick1(self, event):
win = DlgGrid1(self, -1)
ret = win.ShowModal()
print ret
ret.Destroy()
#-------------------------------------------------------------------
class MyFrame(wxFrame):
def __init__(self, parent, id):
wxFrame.__init__(self, parent, id, "Grid1", wxPoint(10,10),
wxSize(300, 300))
panel = MyPanel(self, -1)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
print 'OnCloseWindow'
self.Destroy()
#-------------------------------------------------------------------
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1)
frame.Show(true)
self.SetTopWindow(frame)
return true
#-------------------------------------------------------------------
def main():
print 'main is running...'
app = MyApp(0)
app.MainLoop()
#-------------------------------------------------------------------
if __name__ == "__main__" :
main()
#eof-------------------------------------------------------------------
#####################################################
#####################################################
#-------------------------------------------------------------------
# Grid2.py, wxgrid in a main window
#
# win98, python 2.2, wxPython 2.3.3pre2
# wxmsw233h.dll: time stamp 04/05/02 12.57p size 4373553
# file ver 0.0.0.0
# (infos from MS dependency walker)
#
# problem
# cannot quit a cell in edit mode when hitting the ESC key, ENTER key works
fine
# check self.gg.CreateGrid(3, 2) in MyPanel: grid is not desplayed
#-------------------------------------------------------------------
from wxPython.wx import *
from wxPython.grid import *
#-------------------------------------------------------------------
class MyPanel(wxPanel):
def __init__(self, parent, id):
wxPanel.__init__(self, parent, id)
self.gg = wxGrid(self, -1, wxPoint(10, 10), wxSize(400, 300),
wxSIMPLE_BORDER)
#with the following next line, grid is not desplayed
#~ self.gg.CreateGrid(3, 2)
self.gg.CreateGrid(30, 20)
#-------------------------------------------------------------------
class MyFrame(wxFrame):
def __init__(self, parent, id):
wxFrame.__init__(self, parent, id, "Grid2", wxPoint(10, 10),
wxSize(500, 400))
panel = MyPanel(self, -1)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
print 'OnCloseWindow'
self.Destroy()
#-------------------------------------------------------------------
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1)
frame.Show(true)
self.SetTopWindow(frame)
return true
#-------------------------------------------------------------------
def main():
print 'main is running...'
app = MyApp(0)
app.MainLoop()
#-------------------------------------------------------------------
if __name__ == "__main__" :
main()
#eof-------------------------------------------------------------------
#####################################################
#####################################################
Jean-Michel Fauth, Switzerland