-
-
Notifications
You must be signed in to change notification settings - Fork 108
Path Chooser Input
The Pathchooserinput widget allows the user to choose a file or directory. It's a compound widget made of an entry and a button. The user can enter a path directly on the entry widget or click on the button to search a path using the standard tk dialogs (askopenfilename, askdirectory)
It has the following properties:
image: the image to show in the search button.
type: type of the chooser, allowed values are "file" and "directory". By default is set to "file"
path: the current path value, entered by the user or set up by code.
textvariable: an optional textvariable that is assigned to the entry widget.
The Pathchooserinput generates a virtual event named <<PathChooserPathChanged>> when the path is changed. More specifically when:
- the user changed the text and pressed <Enter> key inside the entry
- the user changed the text and the entry loses the focus
- the user selected a path using the search button.
You can connect to this event by code or using the Bindings tab of the widget Property Editor (see demo).
To get (or set) the path value use the "path" property:
# pathchooser, an instance of PathChooserInput widget.
# get current value
current_value = pathchooser.cget('path')
# set path value
pathchooser.configure(path='/home/my_initial_dir')
Example files are here.
Example on video
- Requirements
- Installation
- Launch
- Screens:
- Step-by-Step Examples:
- Completed Examples
- Tips
- Additional widget sets
- Known Issues
- FAQ
- Troubleshooting:
- Communicating: