Re: [Tutor] filtering listed directories
On 23/08/15 00:42, Laura Creighton wrote: In a message of Sat, 22 Aug 2015 14:32:56 +0100, Alan Gauld writes: 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. -- Alan G I asked the question on tkinter-discuss, but the question hasn't shown up yet. In the meantime, I have found this: http://www.ccs.neu.edu/research/demeter/course/projects/demdraw/www/tickle/u3/tk3_dialogs.html which looks like, if we converted it to tkinter, would do the job, since all it wants is a list of files. I have guests coming over for dinner, so it will be much later before I can work on this. (And I will be slow -- so if you are a wizard at converting tk to tkinter, by all means feel free to step in here. :) ) Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor Thanks Laura, unfortunately I know next to nothing of tk, so I'll have wait. No worries, This in not an urgent thing, and is mostly a learning exercise, as I have a cli tool to do what what I'm aiming to write using Tkinter. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] filtering listed directories
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 ;) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] filtering listed directories
wxPython has a SHOWHIDDEN checkbox for turning exactly this on and off, but if you wanted to exclude all .pyc files while leaving the rest alone, I don't see a way to do that, either, right now. QT has a ton of options including showing hidden files. The common problem we seem to be up against is that the gui packages really want to use the native OS file dialogs whenever possible, and the people making such dialogs -- at least in some OSes, never dreamed that somebody would ever want to exclude only certain files (as opposed to only match certain files). Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] filtering listed directories
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. Laura Thanks Laura, 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. Chris ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] filtering listed directories
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. Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] filtering listed directories
On 23/08/15 09:31, Chris Roy-Smith wrote: There is a FileSelectDialog in Tix that has a dircmd option according to the Tix documentation. 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. This combo looks like the best solution if I can find how to make it work. Its the logical solution and I'm astounded that none of the common GUIs seem to offer it. (Although I've been building GUIS for over 20 years and never needed it until now! So maybe not so surprising). I'm hoping to buy out some time over the next couple of days to seriously explore the Tix dialogs. 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 This is true and it is because Tkinter has used the underlying GUI toolkit rather than building open/save from scratch. (Native Tk offers no standard dialogs for file operations!) However there is another option in the shape of the Dialog module which is designed to allow you to easily build a custom dialog of your own design. This could be done using the Tix tree view widget for example and you could then build in a file filter operation. (A search may even reveal that somebody has done this already... I think that's what the Tk code Laura posted was doing)) I can only assume that windows users don't get this problem. Its got nothing to do with the OS, the same limitations apply in all cases. They have taken the minimum subset of options when they built the common dialogs. But the standard Windows dialog doesn't offer exclusion options either, so even if they had offered platform specific hooks, it would not have helped on Windows. wxPython does the same, so has the same limitations. Do any of the other graphical packages avoid this problem? The GTk dialogs on my Linux box have slightly more sophisticated options so I'd guess that PyGTK at least will offer more in the API (But even they don't appear to have filter out capability). PyQt/SIDE probably offers more too but I don't know very much about Qt. One possibility on Windows is that the list of folders shown is con trolled by the users registry settings in the file explorer. You can choose to hide system files in the Explorer view and that sets a registry flag. I haven't checked but its possible that the Windows open/save dialogs respect that setting. But that's just a guess! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] filtering listed directories
In a message of Sat, 22 Aug 2015 12:20:31 +1000, Chris Roy-Smith writes: 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. The options are listed here: http://effbot.org/tkinterbook/tkinter-file-dialogs.htm or http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/tkFileDialog.html Unfortunately, they do not help. There is all sorts of help for 'only show things that match a certain pattern' but not for 'only show things that do not match a certain pattern'. (Or maybe my pattern-making skill is at fault, but I don't think so.) tix (tkinter extensions) https://wiki.python.org/moin/Tix have some more file dialogs, so maybe there is joy there. This seems utterly crazy to me -- you surely aren't the first person who wanted to exclude certain directories in a file dialog. I will look more later this afternoon in my old tkinter files. I must have wanted to do this at one point, mustn't I? puzzled, Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] filtering listed directories
In a message of Sat, 22 Aug 2015 14:32:56 +0100, Alan Gauld writes: 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. -- Alan G I asked the question on tkinter-discuss, but the question hasn't shown up yet. In the meantime, I have found this: http://www.ccs.neu.edu/research/demeter/course/projects/demdraw/www/tickle/u3/tk3_dialogs.html which looks like, if we converted it to tkinter, would do the job, since all it wants is a list of files. I have guests coming over for dinner, so it will be much later before I can work on this. (And I will be slow -- so if you are a wizard at converting tk to tkinter, by all means feel free to step in here. :) ) Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] filtering listed directories
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. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor