Questions regarding Naming or Identifying and Destroying dyanamic widgets

for Detroying the pages. Does anyone have ideas why I'm getting the above errors,
and how they could be avoided?

I expect that these are because you are not removing the page from the
notebook, so the notebook still expects it to exist.

That seems to be it. Removing first cleared up the errors. Thank you.

2. The next thing I have to deal with is that invoking the onFileClose method will only Destroy
the last page created. I think I understand the reason for this -- the onFileOpen method

You can get the current page in the notebook with notebook.GetPage(), or
you can get the page number of the current page with
notebook.GetSelection. Once you have the page num then you can remove a
page with notebook.RemovePage(pageNum) which leaves the page window
still existing if you want to reuse it later, or you can remove the page
from the notebook and destroy it at the same time with
notebook.DeletePage(pageNum)

Again, thank you... either way works. The Notebook.DeletePage() method seems the
cheapest and most like what I wanted, since there is no reason I can see to keep the
page once it is off the panel.

There is where I have my third problem: I can't seem to figure out how to GetId.

Widgets, menu items, toolbar items, and some other things all have a
GetId() method that returns either the ID you gave it when creating the
item, or the autogenerated ID if you gave it wx.ID_ANY.

Very much, thank you. I was making the standard newbie error of trying to overcomplicate
things. I kept trying variations on self.MyMenu.GetId(self.MyMenuItem)... which had me
flumoxed.

5. Another related question: It seems unlikely, but is there any possble way to create
dynamic variable names? I mean dynamically generate a string that is "imported" or
"applied" to namespace so that it can be used as a variable name? IE

A namespace is basically just a Python dictionary, so you could do it by
assigning values to the namespace's dictionary. For example, to
dynamically assign something to self you could do this:

  self.__dict__['NewVarName'] = value

But personally I try to avoid things like that. It sounds to me like
you just want to make a list of your pages, or information about your
pages, or something like that. You can then access each item using
standard Python List syntax.

Ah, so it can be done. but whith your help I no longer see any reason to do so,
at least for this project. Thank you for all the help... These Destruction issues
had me stumped for 3 days.

ยทยทยท

----- Original Message ----
From: Robin Dunn <robin@alldunn.com>
To: wxPython-users@lists.wxwidgets.org
Sent: Wednesday, August 9, 2006 1:46:04 PM
Subject: Re: [wxPython-users] Questions regarding Naming or Identifying and Destroying dyanamic widgets

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org