Gui file browser/selector?

I’m looking for a simple drop in panda3d gui file selector for my project. I’ve been hunting through google and searching here on the forum. I found something from pandaman on code.google.com which is now defunct and inaccessible. There was something posted here in '12 (5 years ago, but the links have expired.) I realize this may not exactly be ‘easy’ because all the panda3d gui elements are drawn in opengl so we don’t have all the bells and whistles to work with.

What am I trying to do:

I have a working (python3) panda3d app written under linux. I run it by typing something like: “my_panda3d_app.py --project-dir /path/to/my/project/directory”. I managed to get the script running under windows (yikes! but woohoo), and also managed to get pyinstaller working (more yikes, but woohoo.)

However, I don’t want my casual MS windows users to have to open a command prompt and type at the command line. All I want is for my script to start when the user double clicks on it, pop up a simple file selector dialog box, allow the user to navigate to the project directory, click ok, and we are off and running.

Here is the link to my project source code (MIT license): https://github.com/UASLab/ImageAnalysis
I’m working on an aerial stitching and mapping system in python, and I’m using panda3d as my map renderer so I can apply image filters and draw each image on top of a 3d surface model so it is correctly warped/sized/placed relative to all the other images. Rambling youtube demo here: https://www.youtube.com/watch?v=ZUJb5GSh58E

All the information I’m finding on this in panda3d seems to be years old and the links expired. Can anyone help me out? Did I leave out any information that would be helpful?

Thanks in advance!

Curt.

In fact, it is simple, you need to use a python to work with directories. Need an OS module. Get a list of directories and files with the help of os.listdir and render for gui elements with assigned functions.

Hi Serega, thanks for the quick reply. I completely understand how to do the python side … scanning directories with os.listdir etc. I’m really sketchy on the panda3d side (the part you suggest is ‘simple’) that’s where I’m hoping for some help.

Thanks!

Curt.

If you are OK with it being a separate window, the Tkinter solution might be easiest for showing a file dialog:

If you only need to support Windows, you can also use a Python wrapper around the Win32 API (such as ctypes or win32api) to use the GetOpenFileNameA function:

I meant the Panda3D GUI, for example, it would be easy to create a shortcut for a program, I think I will test my theory. You can also try to write in Visual Basic, the point is to start the python interpreter by passing a parameter with the name of the project script. So the panda has almost nothing to do with it. You can choose all that pleases.

Rdb: it never even occured to me that I could run a file dialog from some other gui toolkit before handing control of the app over to panda3d. The tkinter suggestion actually seems to do exactly what I had in mind. I think I’ll run down that path for now, and check back in here if I have any further issues. Thanks again!

1 Like