Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100505 > unrolled thread
| Started by | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| First post | 2015-12-16 13:18 +0000 |
| Last post | 2015-12-18 09:27 +0000 |
| Articles | 8 — 5 participants |
Back to article view | Back to comp.lang.python
Tk alternative to askopenfilename and askdirectory? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-16 13:18 +0000
Re: Tk alternative to askopenfilename and askdirectory? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-12-16 09:18 -0500
Re: Tk alternative to askopenfilename and askdirectory? Lorenzo Sutton <lorenzofsutton@gmail.com> - 2015-12-16 17:24 +0100
Re: Tk alternative to askopenfilename and askdirectory? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-16 17:08 +0000
Re: Tk alternative to askopenfilename and askdirectory? Rick Johnson <rantingrickjohnson@gmail.com> - 2015-12-16 16:28 -0800
Re: Tk alternative to askopenfilename and askdirectory? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-17 14:14 +0000
Re: Tk alternative to askopenfilename and askdirectory? Christian Gollwitzer <auriocus@gmx.de> - 2015-12-18 09:32 +0100
Re: Tk alternative to askopenfilename and askdirectory? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-18 09:27 +0000
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2015-12-16 13:18 +0000 |
| Subject | Tk alternative to askopenfilename and askdirectory? |
| Message-ID | <n4robu$9bs$1@news2.informatik.uni-stuttgart.de> |
Is there an alternative to Tk's askopenfilename() and askdirectory()? I want to select a files and directories within one widget, but askopenfilename() let me only select files and askdirectory() let me only select directories. -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2015-12-16 09:18 -0500 |
| Message-ID | <mailman.9.1450275483.30845.python-list@python.org> |
| In reply to | #100505 |
On Wed, 16 Dec 2015 13:18:54 +0000 (UTC), Ulli Horlacher
<framstag@rus.uni-stuttgart.de> declaimed the following:
>Is there an alternative to Tk's askopenfilename() and askdirectory()?
>
>I want to select a files and directories within one widget, but
>askopenfilename() let me only select files and askdirectory() let me only
>select directories.
I've only seen one place that allows such -- and that is a full
windowing desktop environment, for use with cut/copy/paste operations...
And might be implemented behind the scenes by doing individual selects and
maintaining a list of the file system objects thus included. I've never
seen an application file/directory requester that allowed for a mix (anyone
remember the W3.x requester? Separate boxes for drive, directory, and file
within directory)
askopenfilename()/askdirectory() are simple convenience functions meant
for use where one is not going to implement a full GUI application using
lower level widgets. Anything more complex should be done with full dialog
design -- say a two column "available -> selected" system, where single
clicking on name in the available column selects it and either some [->]
button or a double click moves it to the selected column... But how you
differentiate between a double click to select a directory vs a double
click to move into the directory is beyond me.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Lorenzo Sutton <lorenzofsutton@gmail.com> |
|---|---|
| Date | 2015-12-16 17:24 +0100 |
| Message-ID | <mailman.15.1450283090.30845.python-list@python.org> |
| In reply to | #100505 |
On 16/12/2015 14:18, Ulli Horlacher wrote: > Is there an alternative to Tk's askopenfilename() and askdirectory()? > > I want to select a files and directories within one widget, but > askopenfilename() let me only select files and askdirectory() let me only > select directories. > > I guess it would help if you could provide some information on your use case and what you want to achieve ;) Lorenzo.
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2015-12-16 17:08 +0000 |
| Message-ID | <n4s5q7$cs3$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #100517 |
Lorenzo Sutton <lorenzofsutton@gmail.com> wrote: > On 16/12/2015 14:18, Ulli Horlacher wrote: > > Is there an alternative to Tk's askopenfilename() and askdirectory()? > > > > I want to select a files and directories within one widget, but > > askopenfilename() let me only select files and askdirectory() let me only > > select directories. > > > > > > I guess it would help if you could provide some information on your use > case and what you want to achieve ;) A (Windows) user shall upload files and/or directories. For this, he needs to select them. In the current implementation, the user has to decide first whether he wants to upload a file or a directory. I want to eliminate this step. http://fex.rus.uni-stuttgart.de/fop/rC2meOrd/X-20151216180501.png drag&drop works only for files with ASCII filenames. -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | Rick Johnson <rantingrickjohnson@gmail.com> |
|---|---|
| Date | 2015-12-16 16:28 -0800 |
| Message-ID | <db95e995-55a0-4256-80c5-6aeb777696b5@googlegroups.com> |
| In reply to | #100505 |
On Wednesday, December 16, 2015 at 7:19:25 AM UTC-6, Ulli Horlacher wrote: > Is there an alternative to Tk's askopenfilename() and askdirectory()? > > I want to select a files and directories within one widget, but > askopenfilename() let me only select files and askdirectory() let me only > select directories. Oh i understand. What you opine for is something like: askOpenFileOrDir() -- which displays a dialog from which a file or directory can be selected by the user.
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2015-12-17 14:14 +0000 |
| Message-ID | <n4ug0f$vh$2@news2.informatik.uni-stuttgart.de> |
| In reply to | #100543 |
Rick Johnson <rantingrickjohnson@gmail.com> wrote: > Oh i understand. What you opine for is something like: askOpenFileOrDir() > -- which displays a dialog from which a file or directory can be selected > by the user. Yes, exactly! Now: how? -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Date | 2015-12-18 09:32 +0100 |
| Message-ID | <n50g6o$g4n$1@dont-email.me> |
| In reply to | #100505 |
Am 16.12.15 um 14:18 schrieb Ulli Horlacher: > Is there an alternative to Tk's askopenfilename() and askdirectory()? > > I want to select a files and directories within one widget, but > askopenfilename() let me only select files and askdirectory() let me only > select directories. Tk calls out into the native file manager to perform the file/open operation (on Win&Mac, on Unix it brings it's own). Unfortunately, these dialogs do not have an option to select both directories and files. This means you would have to do your own. You wouldn't need to start from scratch, however - Schelte Bron has created a very nice dialog as a replacement for the (oldfashioned, dull) standard dialog in Tk: http://wiki.tcl.tk/15897 It would be feasible to tweak it a bit to allow for directory and file selection. It is written in Tcl, however, but that is not a problem in itself, you could call it from Python in a similar way that tk_getOpenFile is implemented. Concerning your drag&drop problem, it is only possible if you go for a Tk main window, then you could use TkDND. It is not in the standard install, but it can be bundled *without installation*, because Tcl extensions use a mechanism called stubs, which ensures broad binary compatibility. The only drawback: you will not have a single .py file, but since on Windows you deliver using pyinstaller, that should not be an issue. Christian
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2015-12-18 09:27 +0000 |
| Message-ID | <n50ji4$j57$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #100585 |
Christian Gollwitzer <auriocus@gmx.de> wrote: > Tk calls out into the native file manager to perform the file/open > operation (on Win&Mac, on Unix it brings it's own). This means, on Windows the user gets a "well known" file/directory browser? Then this is an important feature! Anything new and unknown is bad for a standard Windows user. > scratch, however - Schelte Bron has created a very nice dialog as a > replacement for the (oldfashioned, dull) standard dialog in Tk: > > http://wiki.tcl.tk/15897 > > It would be feasible to tweak it a bit to allow for directory and file > selection. It is written in Tcl Oh boy, last time, I hacked with Tcl was in 1993 :-} I remember Tcl as a horrible programming language. > Concerning your drag&drop problem, it is only possible if you go for a > Tk main window, then you could use TkDND. It is not in the standard > install, but it can be bundled *without installation*, because Tcl > extensions use a mechanism called stubs, which ensures broad binary > compatibility. The only drawback: you will not have a single .py file, > but since on Windows you deliver using pyinstaller, that should not be > an issue. Ok, I put it on my TODO-List :-) IF I have some day some spare time... -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web