Re: Tkinter Open dialog box

Discussion in 'Python' started by Lucas Raab, Sep 13, 2003.

  1. Lucas Raab

    Lucas Raab Guest

    Does anybody know how to make a Tkinter dialog box that would allow a user
    to select a file? Just sort of like a normal Windows, Mac, etc open dialog
    box.

    Thanks
     
    Lucas Raab, Sep 13, 2003
    #1
    1. Advertising

  2. Lucas Raab <> wrote:
    > Does anybody know how to make a Tkinter dialog box that would allow a user
    > to select a file? Just sort of like a normal Windows, Mac, etc open dialog
    > box.


    import tkFileDialog
    filename = tkFileDialog.askopenfilename()
    filenamelist = tkFileDialog.askopenfilenames()

    Does this suffice?

    Seo Sanghyeon
     
    Seo Sanghyeon, Sep 14, 2003
    #2
    1. Advertising

  3. "Seo Sanghyeon" <> schrieb im Newsbeitrag
    news:3f63b867$0$185$...
    > Lucas Raab <> wrote:
    > > Does anybody know how to make a Tkinter dialog box that would allow a

    user
    > > to select a file? Just sort of like a normal Windows, Mac, etc open

    dialog
    > > box.

    >
    > import tkFileDialog
    > filename = tkFileDialog.askopenfilename()
    > filenamelist = tkFileDialog.askopenfilenames()



    No askopenfilenames in my 8.3 version of lib-tk.....

    If Tk is not yet initialized properly, this is done implicitely. This leads
    to a funny window in the background, which however can be removed:

    from Tkinter import Tk
    import tkFileDialog
    toplevel=Tk()
    toplevel.withdraw()
    filename = tkFileDialog.askopenfilename()
    # now setup your window correctly
    toplevel.deiconify()
    # if you no not need Tk any longer you instead should:
    toplevel.destroy()

    Kindly
    Michael P
     
    Michael Peuser, Sep 14, 2003
    #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?S3Jpc2huYQ==?=

    File Open Dialog box

    =?Utf-8?B?S3Jpc2huYQ==?=, Dec 29, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    4,316
    Curt_C [MVP]
    Dec 29, 2003
  2. Ajay

    tkinter dialog box

    Ajay, Oct 13, 2004, in forum: Python
    Replies:
    0
    Views:
    489
  3. bienwell
    Replies:
    5
    Views:
    5,222
    bienwell
    Aug 13, 2006
  4. mrstevegross
    Replies:
    2
    Views:
    438
    John Posner
    Dec 17, 2009
  5. eddie wang
    Replies:
    0
    Views:
    422
    eddie wang
    Oct 3, 2003
Loading...

Share This Page