| 1 | from wxPython.wx import * |
| 2 | |
| 3 | |
| 4 | class MyFrame(wxFrame): |
| 5 | def __init__(self, parent, id, title='A pxFrame!'): |
| 6 | wxFrame.__init__(self, parent, id, title, |
| 7 | wxPyDefaultPosition, wxSize(50, 50)) |
| 8 | |
| 9 | def get_filename(self): |
| 10 | dlg = wxFileDialog(self, "Choose a file", ".", "", "*.*", wxOPEN) |
| 11 | dlg.ShowModal() |
| 12 | self.file = dlg.GetPath() |
| 13 | dlg.Destroy() |
| 14 | self.Iconize(true) |
| 15 | return self.file |
| 16 | |
| 17 | |
| 18 | class FilePicker(wxApp): |
| 19 | def OnInit(self): |
| 20 | return true |
| 21 | |
| 22 | def get_filename(self): |
| 23 | dlg = wxFileDialog(NULL, "Choose a file", ".", "", "*.*", wxOPEN) |
| 24 | dlg.ShowModal() |
| 25 | self.file = dlg.GetPath() |
| 26 | dlg.Destroy() |
| 27 | return self.file |
| 28 | |