tictactouc@altern.org wrote:
Hello world!!!
Ok, I've undestand how to fill a wxListBox with selected files.
But, why I can't fill my ListBox with this code?
Is there an another way to do this?class MainWindow(wxFrame):
def __init__(self,parent,id,title):
wxFrame.__init__(self,parent,-4, title, size = ( 500,600),
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)barre_de_menu = wxMenuBar()
file_menu01 = wxMenu()
file_menu01.Append(ID_OPEN, "Open...\\tCtrl+O", "Cliquez sur Open pour ouvrir un fichier") barre_de_menu.Append(file_menu01, "&File") self.SetMenuBar(barre_de_menu)EVT_MENU(self, ID_OPEN, self.OnOpen)
def OnOpen(self, event):
""" Open a file"""
dirname = 'c:\\media'
dlg = wxFileDialog(self, "Choose a file :", dirname, "", "*.*", wxOPEN|wxMULTIPLE) #
if dlg.ShowModal() == wxID_OK:
self.filename=dlg.GetFilename()
self.dirname=dlg.GetDirectory()
event = Form1(frame, -1)
for path in dlg.GetPaths(): event.lb1.Append(path)
Since you are creating a new panel here you need to do something to change it from it's very small default size so it will fill the frame so the listbox will be visible. Sending a size event to the frame woud do it since this it only non-bar child. Or putting it in a sizer and calling Layout would do it too.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!