tkFileDialog

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gheorghe Postelnicu

    #1

    tkFileDialog

    In our example, try replacing the last line with

    print file.name

    ---------- Forwarded message ----------
    From: cdroulers@hotma il.com
    To: python-list@python.org
    Date: 8 Nov 2006 11:01:08 -0800
    Subject: Problem getting a file pathname with tkFileDialog
    Hello,
    I am working on a school project that requires me to get the path of a
    filename for future treatment.
    I've tried getting a file with tkFileDialog.as kopenfile.


    *************** *************** **************
    import tkFileDialog
    file = tkFileDialog.as kopenfile()
    print file
    *************** *************** **************


    It prints the opened files stuff, but I just can not find how to get
    that path as a string. I've searched around google and the present
    group, and found no documentation on the file class used with
    tkFileDialog. Does someone have a solution for that?

    Thank you

    Christian




    --
    Gheorghe Postelnicu, PhD
    MGH, Harvard Medical School
  • James Stroud

    #2
    Re: tkFileDialog

    Gheorghe Postelnicu wrote:
    ---------- Forwarded message ----------
    From: cdroulers@hotma il.com
    To: python-list@python.org
    *************** *************** **************
    import tkFileDialog
    file = tkFileDialog.as kopenfile()
    print file
    *************** *************** **************
    Its ill-advised to assign to built in types (e.g. "file").
    It prints the opened files stuff, but I just can not find how to get
    that path as a string. I've searched around google and the present
    group, and found no documentation on the file class used with
    tkFileDialog. Does someone have a solution for that?
    import tkFileDialog
    afile = tkFileDialog.as kopenfile()
    print afile.name

    James

    --
    James Stroud
    UCLA-DOE Institute for Genomics and Proteomics
    Box 951570
    Los Angeles, CA 90095


    Comment

    Working...