[wxpython-users] Grid crash when capture focus
Oswaldo Hernández
listas at soft-com.es
Wed Mar 26 05:59:33 PDT 2008
Hello,
If capture grid EVT_SET_FOCUS, and make some grid operation in the event, p=
ython crash if close the =
Frame when you are editing a cell.
I attatch a sample:
. Run it,
. Enter to edit any cell,
. When are editing the cell click on 'x' button to close the frame
-- =
*****************************************
Oswaldo Hern=E1ndez
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, aseg=FArese de que es necesario.
El medio ambiente est=E1 en nuestra mano.
-------------- next part --------------
import wx
import wx.grid as gridlib
#---------------------------------------------------------------------------
class TestGrid(gridlib.Grid):
def __init__(self, parent):
gridlib.Grid.__init__(self, parent)
self.CreateGrid(20, 6)
self.SetCellValue(1, 1, "Close Frame while editing")
# capture Focus
self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) =
=
def OnSetFocus(self, evt):
print "Grid SetFocus"
# ******************************************************************
# if make any grid operation when the frame is closing: python crash
# ******************************************************************
self.SetCellValue(0, 0, "SetFocus") =
evt.Skip()
=
#---------------------------------------------------------------------------
class TestFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "Grid Test")
grid =3D TestGrid(self)
#---------------------------------------------------------------------------
if __name__ =3D=3D '__main__':
import sys
app =3D wx.PySimpleApp()
frame =3D TestFrame(None)
frame.Show(True)
app.MainLoop()
#---------------------------------------------------------------------------
More information about the wxpython-users
mailing list