Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JFileChooser for Python?

I was wondering if there is something similar to Java's JFileChooser for Python?

JFileChooser is a graphical front end to choose a file.

Preferably something that is already with Python. Maybe with Tkinter.

like image 640
Nope Avatar asked Dec 23 '22 13:12

Nope


2 Answers

wxPython (www.wxpython.org) provides the wx.FileDialog class which will give you a native file selection dialog on any of the supported platforms (Mac, Linux or Windows).

like image 111
Wayne Koorts Avatar answered Jan 03 '23 19:01

Wayne Koorts


Easiest way I ever found to do this (using PyGTK and Kiwi):

from kiwi.ui.dialogs import open as open_dialog

chosen_path = open_dialog('Select a file', folder='/start/folder')

if chosen_path is not None:
    # do something ...
like image 20
Ali Afshar Avatar answered Jan 03 '23 21:01

Ali Afshar