How to use tix.DirSelectDialog?
Create instance as always:
d = tix.DirSelectDialog(master=root)
This code will execute (internally) tix.DirSelectDialog.__init__(self, master)
with correct argument for self
You can treat
d = tix.DirSelectDialog(master=root)
almost like execution (internally by python) of code
tix.DirSelectDialog(self=d, master=root)# which executestix.DirSelectDialog.__init__(self=d, master=root)
but normally you can't do this.
EDIT: to run it probably you have to install Tix (Tcl/Tk extensions) for your own and use tix.Tk()
in place of tkinter.Tk()
Working example for Python 2:
import Tix as tixdef print_selected(args): print('selected dir:', args)root = tix.Tk()dialog = tix.DirSelectDialog(root, command=print_selected)dialog.popup()
Similar example for Python 3 (but I have some problem to work properly on my computer)
import tkinter.tix as tixdef print_selected(args): print('selected dir:', args)root = tix.Tk()dialog = tix.DirSelectDialog(root, command=print_selected)dialog.popup()