[Tutor] filtering listed directories
chris_roysmith at internode.on.net
Sun Aug 23 10:31:34 CEST 2015
On 23/08/15 18:13, Laura Creighton wrote:
> In a message of Sun, 23 Aug 2015 13:09:41 +1000, Chris Roy-Smith writes:
>> On 22/08/15 23:32, Alan Gauld wrote:
>>> On 22/08/15 11:43, Laura Creighton wrote:
>>>>> 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.
>>>> tix (tkinter extensions) https://wiki.python.org/moin/Tix
>>>> have some more file dialogs, so maybe there is joy there.
>>> There is a FileSelectDialog in Tix that has a dircmd option
>>> according to the Tix documentation.
>>> However, I've played about with it and can't figure out how
>>> to make it work!
>>> There is also allegedly a 'hidden' check-box subwidget
>>> that controls whether hidden files are shown. Again I
>>> couldn't find how to access this.
>>> But maybe some questions on a Tix (or Tk) forum might
>>> get more help? Once you know how to do it in native
>>> Tcl/Tk/Tix you can usually figure out how to do it
>>> in Python.
>> Thanks for the Tcl tk hint, so I searched for info for tcl tk.
>> Unfortunately the options appear to be the same as offered by tkinter. I
>> had hoped that the cause of my problem would be that I'm still to learn
>> that bit ;)
> No, the problem is that the tk widget is badly designed. Not only is
> there only minimal pattern support matching, but there is no way to
> subclass the thing and feed it your own list of file and directory
> names. It really is a case of "Do not open. No user-servicable
> parts to be found within." which is frustrating.
I don't use idle but wondered how it handled hidden directories, and
found that it also shows them. I guess I'll have to be inconsistent
using the title bar to warn users and trap inappropriate selections
sending the user back to try again. I can only assume that windows users
don't get this problem.
Do any of the other graphical packages avoid this problem? I guess I
should try the appropriate news groups.
More information about the Tutor