If I use wxNotebook.RemovePage I don’t get the error anymore. I really need to stop posting to this thing when I’m half asleep.
Tyler Foster
···
----- Original Message -----
From: Tyler foster
Sent: Friday, June 07, 2002 7:12 AM
Subject: [wxPython] wxNotebook AddPage DeletePage Problem
I’m using windows 2000 wxpython 2.3.2 and python 2.1. wxNotebook.AddPage and wxNotebook.DeletePage both work. But if I delete a page and try to recreate it, the app crashes. If anyone has an idea on what might be going on please let me know. Here is the error and source.
Error:
The instruction at “0x0109adad” referenced memory at “0xafafb00b”. The memory could not be “read”
Source:
def _init_coll_ptchartnotebook_Pages(self, parent):
parent.AddPage(bSelect = true, imageId = -1, pPage = self.htmlWindow1, strText = ‘Assessment’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow2, strText = ‘Care Plan’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow3, strText = ‘Medication Log’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow4, strText = ‘Accident Log’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow5, strText = ‘Belongings Inventory’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow6, strText = ‘Resident Directive’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow7, strText = ‘Psychoactive Medication Consent’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow8, strText = ‘Resident Information’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow9, strText = ‘Resident Information Release’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow10, strText = ‘Medication Assistance Consent’)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow11, strText = “Resident’s Rights”)
parent.AddPage(bSelect = false, imageId = -1, pPage = self.htmlWindow12, strText = “Resident’s Death Form”)
def _init_ctrls(self, prnt):
wxFrame.init(self, id = wxID_PTCHARTFRAME, name = ‘’, parent = prnt, pos = wxPoint(198, 100), size = wxSize(870, 646), style = wxDEFAULT_FRAME_STYLE, title = ‘Patient Chart’)
self._init_utils()
self.SetClientSize(wxSize(856, 586))
self.panel1 = wxPanel(id = wxID_PTCHARTFRAMEPANEL1, name = ‘panel1’, parent = self, pos = wxPoint(0, 0), size = wxSize(856, 586), style = wxTAB_TRAVERSAL)
self.ptchartnotebook = wxNotebook(id = wxID_PTCHARTFRAMEPTCHARTNOTEBOOK, name = ‘ptchartnotebook’, parent = self.panel1, pos = wxPoint(0, 75), size = wxSize(856, 512), style = 0)
self.htmlWindow1 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW1, name = ‘htmlWindow1’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow2 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW2, name = ‘htmlWindow2’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow3 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW3, name = ‘htmlWindow3’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow4 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW4, name = ‘htmlWindow4’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow5 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW5, name = ‘htmlWindow5’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow6 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW6, name = ‘htmlWindow6’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow7 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW7, name = ‘htmlWindow7’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow8 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW8, name = ‘htmlWindow8’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow9 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW9, name = ‘htmlWindow9’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow10 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW10, name = ‘htmlWindow10’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow11 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW11, name = ‘htmlWindow11’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self.htmlWindow12 = wxHtmlWindow(id = wxID_PTCHARTFRAMEHTMLWINDOW12, name = ‘htmlWindow12’, parent = self.ptchartnotebook, pos = wxPoint(0, 0), size = wxSize(848, 486))
self._init_coll_ptchartnotebook_Pages(self.ptchartnotebook)
print “loading pages”
self.htmlWindow1.LoadPage(‘Assessment.html’)
self.htmlWindow2.LoadPage(‘CarePlan.html’)
self.htmlWindow3.LoadPage(‘MedLog.html’)
self.htmlWindow4.LoadPage(‘InjuryLog.html’)
self.htmlWindow5.LoadPage(‘Belongings.html’)
self.htmlWindow6.LoadPage(‘DeathDirective.html’)
self.htmlWindow7.LoadPage(‘MedConsent.html’)
self.htmlWindow8.LoadPage(‘ResInfo.html’)
self.htmlWindow9.LoadPage(‘ResInfoRelease.html’)
self.htmlWindow10.LoadPage(‘AssistConsent.html’)
self.htmlWindow11.LoadPage(‘ResRights.html’)
self.htmlWindow12.LoadPage(‘ResDeath.html’)
print “pages loaded”
def OnDeleteformButton(self, event):
pagetodelete = self.ptchartnotebook.GetSelection()
self.ptchartnotebook.DeletePage(pagetodelete)
def OnAddpageitems0Menu(self, event):
print “1”
self.ptchartnotebook.AddPage(bSelect = true, imageId = -1, pPage = self.htmlWindow12, strText = “Residents Death Form”)
print “2”
self.htmlWindow12.LoadPage(‘ResDeath.html’)
print “3”
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com