Re: how to open a file in some application using Tkinter i am usingTKINTER to create GUI application

Discussion in 'Python' started by Fredrik Lundh, Jan 9, 2008.

  1. brindly sujith wrote:

    > i am using TKINTER to create GUI application
    >
    > i want to know how to open a word document in open office or any other
    > application
    >
    > please send me the tkinter coding for this


    reposting the reply you received when you posted this on another mailing
    list:

    ---

    on windows, you can use the "os.startfile" function:

    import os
    os.startfile("mydocument.doc")

    (this is the same as double-clicking on a document in the file explorer)

    on other platforms, use os.system() and specify what application to run:

    import os
    os.system("someapp mydocument.doc")

    ---

    </F>
     
    Fredrik Lundh, Jan 9, 2008
    #1
    1. Advertising

  2. Fredrik Lundh

    Paul Boddie Guest

    Re: how to open a file in some application using Tkinter i am usingTKINTER to create GUI application i want to know how to open a word documentin open office or any other applicatio

    On 9 Jan, 09:24, Fredrik Lundh <> wrote:
    >


    [Opening files in applications]

    > on windows, you can use the "os.startfile" function:
    >
    > import os
    > os.startfile("mydocument.doc")
    >
    > (this is the same as double-clicking on a document in the file explorer)
    >
    > on other platforms, use os.system() and specify what application to run:
    >
    > import os
    > os.system("someapp mydocument.doc")


    Or try the desktop module which uses os.startfile on Windows, but
    employs mechanisms appropriate for other desktop environments
    elsewhere:

    http://www.python.org/pypi/desktop

    This code should do the trick:

    import desktop
    desktop.open("mydocument.doc")

    This assumes that your desktop environment knows how to handle .doc
    files, of course.

    Paul
     
    Paul Boddie, Jan 9, 2008
    #2
    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. Eric
    Replies:
    2
    Views:
    1,568
    Tommy
    Feb 13, 2004
  2. Michael Zhang
    Replies:
    2
    Views:
    888
    Eric Brunel
    Oct 14, 2004
  3. arvind
    Replies:
    1
    Views:
    585
    Russell E. Owen
    Jun 29, 2006
  4. arvind
    Replies:
    0
    Views:
    387
    arvind
    Jun 29, 2006
  5. eddie wang
    Replies:
    0
    Views:
    438
    eddie wang
    Oct 3, 2003
Loading...

Share This Page