Hi,
I am getting a list of exceptions generated when I close the application.
This is a
partial list below:
Exception exceptions.TypeError: 'call of non-function (type None)' in
<method wx
PenPtr.__del__ of wxPen instance at 013A07C4> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in
<method wx
PenPtr.__del__ of wxPen instance at 013A079C> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in
<method wx
PenPtr.__del__ of wxPen instance at 013A0744> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in
<method wx
PenPtr.__del__ of wxPen instance at 013A071C> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in
<method wx
PenPtr.__del__ of wxPen instance at 012AEA84> ignored
etc.
I guess this has to do with the order that things are destroyed. When I run
the panel containing the pens in its own frame, everything works properly.
When the panel is included as part of a larger application, I get this
problem.
This is the way that I close the main frame on the larger application:
class mainFrame(wxFrame):
def __init__(self):
wxFrame.__init__(self, NULL, -1, "Scopal", (-1,-1),(800,600))
EVT_CLOSE(self, self.OnCloseWindow)
EVT_IDLE(self, self.OnIdle)
if wxPlatform == '__WXMSW__':
self.icon = wxIcon('bitmaps/Scopal.ico', wxBITMAP_TYPE_ICO)
self.SetIcon(self.icon)
try:
lock.startUp() #set
g.statusBar= self.CreateStatusBar()
myMenu(self) #start Menu
mainPanel(self)
except:
self.Destroy() # causes main loop to exit
traceback.print_exc() # and you still get your trace
serial.closePort()
def OnIdle(self, event):
pass
#print "now idle"
#time.sleep(0.01)
def OnCloseWindow(self, event):
serial.closePort() #sets up the port for IO
self.Destroy()
def OnExit(self, event):
serial.closePort() #sets up the port for IO
self.Close(true)
This is the same as for the test frame for the pannel that works, but I
don't have serial.closePort().
The way I set up the pens is:
class BC_canvas(wxScrolledWindow):
'''Override the DoDrawing_TraceList and DoDrawing_Continious methods'''
def __init__(self,parent):
wxScrolledWindow.__init__(self, parent, -1, style= wxSUNKEN_BORDER)
self.SetBackgroundColour(wxNamedColor("WHITE"))
self.xscale=1
self.yscale=1
#Coloured pens defintition
self.penListBlue = [
wxPen(wxColour(210,210,255),.2,wxSOLID), #5
wxPen(wxColour(140,140,255),.2,wxSOLID),
wxPen(wxColour(60,60,255),.2,wxSOLID),
wxPen(wxColour(0,0,220),.2,wxSOLID),
wxPen(wxColour(0,0,150),.2,wxSOLID)] #1
self.penListRed = [
wxPen(wxColour(255,210,210),.2,wxSOLID),
wxPen(wxColour(255,140,140),.2,wxSOLID),
wxPen(wxColour(255,60,60),.2,wxSOLID),
wxPen(wxColour(220,0,0),.2,wxSOLID),
wxPen(wxColour(150,0,0),.2,wxSOLID)]
self.penRed = wxPen(wxRED,.1)
self.penGrey = wxPen(wxLIGHT_GREY,.1)
self.penGreyWide = wxPen(wxLIGHT_GREY,2.0,wxSOLID)
self.penBlack= wxPen(wxBLACK,.1)
Any idea on how I can eliminate the exceptions when I exit?
Using W2000, wxPython 2.3.0 and python 2.0
Regards,
Gordon Williams