3

I am developing the GUI for my application using wxpython and have most of the features down, except in the main frame/window I want to have a box for choosing a file (in this case, the input will have to be an excel file). Something similar to the standard filebrowser that is accessed whenever you choose "open" from a menu. Below is an image to show exactly what I want...

enter image description here

2
  • 2
    FileDialog? Commented Mar 24, 2015 at 8:55
  • According to the screenshot +1 for @PeterWood should be exactly what the OP asked for. Commented Mar 24, 2015 at 9:14

2 Answers 2

4

You probably want a wx.FileDialog. It provides access to the default file dialog of the OS your app is running in. You can see an example of how it's used in the wxPython demo package. This tutorial also has some screenshots and sample code:

The screenshot you show appears to be an interface to actually open the dialog. You can easily create that using sizers and basic widgets. Then just bind the open button to a handler that will show the dialog.

You might also want to take a look at the FileBrowseButton from wx.lib.filebrowsebutton (also in the demo).

There are a few other related widgets which you might be interested in too: wx.DirDialog, MultiDirDialog or wx.GenericDirDialog.

Sign up to request clarification or add additional context in comments.

3 Comments

I got that figured out, thanks. I want to make a box right above the button that shows the path that is currently selected...would i use a panel for this?
And how do I move this button? I am having a hell of a time trying to get it halfway between the top and bottom of the window, but to the right: imgur.com/vcnjWGT
To show the path, you can use a TextCtrl or a StaticText widget. Either way, I would just put them on the same panel as the button. In your use case, I would use nested sizers. You can put the image and a vertical box sizer inside of a horizontal box sizer. Then in the vertical sizer, you would add a spacer, then the button, then another space. See the following for more info: blog.pythonlibrary.org/2015/02/19/…
0

Assuming you know the basics of wxPython you can use wx.GenericDirCtrl and wx.ListCtrl to make nice browser

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.