Your program was adding each entry to the combobox as the displayed value
in the textbox but not creating a list for the combobox to hold all the items. So
you only saw the last one added.
You can just append each new entry to a growing list and then use
comboBox.SetItems(list) as below…
import wx
import os, sys
import string
import re
import wx.lib.dialogs
class MyFrame1(wx.Frame):
def init(self, parent, id, title):
wx.Frame.init(self, parent,-1,title,wx.DefaultPosition,wx.Size(450,200))
self.mainpa = wx.Panel(self,-1,wx.DefaultPosition, wx.DefaultSize)
self.samplelist = []
self.combo1= wx.ComboBox(self.mainpa,-1,"",(120,70),(105,-1),self.samplelist,
wx.CB_DROPDOWN)
path=os.getcwd()
for entry in os.listdir(path):
if os.path.isdir(entry):
print 'entry %s' % entry
self.samplelist.append(entry)
self.combo1.SetItems(self.samplelist)
ok = wx.Button(self.mainpa, -1, 'Ok',wx.Point(300,100))
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame1(None, -1, 'Make Directory Structure')
frame.Show(True)
self.SetTopWindow(frame)
return True
app = MyApp(0)
app.MainLoop()
···
On Nov 19, 2007 4:23 PM, Thippana, Prasoonadevi pthippan@mc.com wrote:
Hi,
Can somebody help me with the combobox problem.When I start the my GUI application, it should upload all the directories from the path into the combo box.
I created 2 directories in my path. When I run this program, it Sets up one directory and when I click it, it just disappears.
Thanks in advance for the help.
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org