[Tutor] filtering listed directories

Chris Roy-Smith chris_roysmith at internode.on.net
Sat Aug 22 04:20:31 CEST 2015


Hi,
environment: Python 2.7, Ubuntu 12.4 Linux

I am trying to get the list of directories shown by 
tkFileDialog.askdirectory to not show hidden files (starting with .)

this code results in lots of hidden directories listed in the interface 
making things harder than they need to be for the user.

#! /usr/bin/python
import Tkinter, tkFileDialog
root = Tkinter.Tk()
root.withdraw()

dirname = 
tkFileDialog.askdirectory(parent=root,initialdir="/home/chris/",title='Pick 
a directory')

How can I filter out these hidden directories?
Help(tkFileDialog) doesn't help me as it just shows **options, but 
doesn't show what these options might be.


More information about the Tutor mailing list