I'm a new user and am starting to "get it" but do have a question about the choice list referenced in wx.Choice. My app reads and stores data from a number of files and I would like to add the ID of each file read to the list that appears in the choice box. I've tried a number of ways to do this, none of which have worked properly. Ideally, the list referenced by wx.Choice would be updated each time a file is read but that takes place in another class in my code and I have been unable to discover a way to append each new file identifier to the choice list, nor can I see how to get the choice list to "refresh" when the list is pulled down. I do maintain a list of files in another part of the code but have not been able to get wx.Choice to use that list - it only shows the list as it is when the app starts , which is empty.
My environment: Windows98SE, the latest versions of Python/wxWidgets and many years of programming experience - just not much in Python.
Thanks,
Lou Gregory
You have several methods in Choice:
for example:
self.Append("A new item")
as it is used in the "Choice" Demo
Delete, Clear, AppendItems, ...
The Choice should refresh itself.
···
On Thu, 09 Feb 2006 19:19:57 -0600, "anothermoi@sbcglobal.net" <anothermoi@sbcglobal.net> wrote:
I'm a new user and am starting to "get it" but do have a question about
the choice list referenced in wx.Choice. My app reads and stores data
from a number of files and I would like to add the ID of each file read
to the list that appears in the choice box. I've tried a number of ways
to do this, none of which have worked properly. Ideally, the list
referenced by wx.Choice would be updated each time a file is read but
that takes place in another class in my code and I have been unable to
discover a way to append each new file identifier to the choice list,
nor can I see how to get the choice list to "refresh" when the list is
pulled down. I do maintain a list of files in another part of the code
but have not been able to get wx.Choice to use that list - it only shows
the list as it is when the app starts , which is empty.
My environment: Windows98SE, the latest versions of Python/wxWidgets and
many years of programming experience - just not much in Python.
Thanks,
Lou Gregory
--
Franz Steinhaeusler
Franz Steinhaeusler wrote:
I'm a new user and am starting to "get it" but do have a question about
the choice list referenced in wx.Choice. My app reads and stores data
from a number of files and I would like to add the ID of each file read
to the list that appears in the choice box. I've tried a number of ways
to do this, none of which have worked properly. Ideally, the list
referenced by wx.Choice would be updated each time a file is read but
that takes place in another class in my code and I have been unable to
discover a way to append each new file identifier to the choice list,
nor can I see how to get the choice list to "refresh" when the list is
pulled down. I do maintain a list of files in another part of the code
but have not been able to get wx.Choice to use that list - it only shows
the list as it is when the app starts , which is empty.
My environment: Windows98SE, the latest versions of Python/wxWidgets and
many years of programming experience - just not much in Python.
Thanks,
Lou Gregory
You have several methods in Choice:
for example:
self.Append("A new item")
as it is used in the "Choice" Demo
Delete, Clear, AppendItems, ...
The Choice should refresh itself.
--
Franz Steinhaeusler
You also need to catch the event that causes the choice to appear:
self.Bind(wx.EVT_LEFT_DOWN, self.doChoiceActivated)
def doChoiceActivated(self, event):
'''The user clicked on the choice item.'''
self.populate()
event.Skip()
def populate(self):
currentSelection = self.GetStringSelection()
self.Clear()
for item in items: # items contains the new strings to put in the choice
self.Append(item)
self.SetStringSelection(currentSelection) # keep something in sel box
These functions come from classes -- I left out those details.
···
On Thu, 09 Feb 2006 19:19:57 -0600, "anothermoi@sbcglobal.net" > <anothermoi@sbcglobal.net> wrote:
--
Jeffrey Barish