Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browse function in python

I've implemented a browse button in my program. Now, I'm wondering how i can take that file the user browsed for, and gain it's location/"file path" on the user's system.

So basically, the user browses for an image file, and then i want to move that image to a new folder in the program's directory, called "import". I plan to do so using command prompt, with a copy command. I just don't know how to code the event for the browse button. can you guys give me a simple code to use for this scenario?

like image 421
user715578 Avatar asked Apr 18 '26 21:04

user715578


1 Answers

In a wxPython wxFrame:

dialog = wx.FileDialog(
    self, "Choose some files...", self._defaultDirectory, "",
    "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif", wx.FD_OPEN|wx.FD_MULTIPLE)
if dialog.ShowModal() == wx.ID_OK:
    paths = dialog.GetPaths()
dialog.Destroy()
like image 183
erbridge Avatar answered Apr 21 '26 09:04

erbridge