better looking directory chooser for tk?

Discussion in 'Ruby' started by Roger Pack, Oct 9, 2009.

  1. Roger Pack

    Roger Pack Guest

    Currently in windows with Tk
    if I run
    Tk.chooseDirectory

    it gives me the cruddy "teeny windows" version that forces you to start
    at my computer to navigate through, and the window can't be expanded,
    even.

    Anybody know how I can get a better looking directory chooser? I know
    it's possible, since other programs have the normal ones.
    Thanks!
    -r
    --
    Posted via http://www.ruby-forum.com/.
    Roger Pack, Oct 9, 2009
    #1
    1. Advertising

  2. From: Roger Pack <>
    Subject: better looking directory chooser for tk?
    Date: Fri, 9 Oct 2009 22:20:58 +0900
    Message-ID: <>
    > Currently in windows with Tk
    > if I run
    > Tk.chooseDirectory
    >
    > it gives me the cruddy "teeny windows" version that forces you to start
    > at my computer to navigate through, and the window can't be expanded,
    > even.


    Please see the section "Standard Dialogs" on
    http://www.tkdocs.com/tutorial/windows.html (at TkDocs site).
    The dialog is a standard one on a Windows version of Tk.

    To give an initial directory, please use 'initialdir' option
    (e.g. Tk.chooseDirectory:)initaildir=>'c:\ruby').
    Its full option is:
    :)initialdir=>'dir-when-pops-up',
    :parent=>logical-parent-widget,
    :title=>"title-string-of-dialogbox",
    :mustexist=>boolean-value)
    Please read the Tcl/Tk's man page of "tk_chooseDirectory" about
    the option values.

    > Anybody know how I can get a better looking directory chooser? I know
    > it's possible, since other programs have the normal ones.


    If you hate the standard dialogs, you must create your own dialogs.
    However, if the "other programs" which you said are written in Tcl/Tk
    (Tcl/Tk script only, or with some Tcl/Tk extensions which work on your
    environment), you can load and use them on Ruby/Tk.

    For example, the standard "tk_chooseDirectory" dialog on Unix (Linux)
    is written in pure Tcl/Tk (see <tklib-dir>/choosedir.tcl).
    So, you can use it on Windows.
    The following replaces Tk.chooseDirectory method to the Unix version.
    ------------------------------------------------------------------
    Tk.load_tclscript(File.join(Tk::TK_LIBRARY, "choosedir.tcl"))
    def Tk.chooseDirectory(params = {})
    Tk.tk_call('::tk::dialog::file::chooseDir::', params)
    end
    ------------------------------------------------------------------
    --
    Hidetoshi NAGAI ()
    Hidetoshi NAGAI, Oct 9, 2009
    #2
    1. Advertising

  3. Roger Pack

    Roger Pack Guest

    > For example, the standard "tk_chooseDirectory" dialog on Unix (Linux)
    > is written in pure Tcl/Tk (see <tklib-dir>/choosedir.tcl).
    > So, you can use it on Windows.


    Excellent. I will look into the pure tk one.
    Thanks!
    -r
    --
    Posted via http://www.ruby-forum.com/.
    Roger Pack, Oct 10, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Unlv?=

    File Chooser...

    =?Utf-8?B?Unlv?=, Sep 16, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,221
    =?Utf-8?B?UHVQdQ==?=
    Dec 2, 2005
  2. Szymon Madejczyk
    Replies:
    2
    Views:
    528
    Szymon Madejczyk
    Sep 15, 2003
  3. dinesh prasad
    Replies:
    0
    Views:
    453
    dinesh prasad
    Oct 19, 2003
  4. Chris Berg
    Replies:
    0
    Views:
    779
    Chris Berg
    Oct 27, 2003
  5. Replies:
    0
    Views:
    363
Loading...

Share This Page