Clickable (wx)python app in OS X

Discussion in 'Python' started by PhysicsGenius, Sep 25, 2004.

  1. AAAAARRRRRRRRGGHGHGHGHGHGHGHGHGH!!!!!! I hate Macs.

    I have a wxPython program. It runs fine on OS X when I launch it from
    the Terminal ("pythonw appname.py") . The user wants to be able to
    click it. Two main suggestions on the Internet, neither of which
    works:

    1) "Use Platypus" So I download it, upgrade Stuffit, install both,
    figure out how to use it, create an app....and it doesn't work for
    graphical apps. Nice to know, thanks for telling me ahead of time!

    2) "Just associate .py files with PythonInterpreter". Sounds easy!
    So I navigate to appname.py, Get Info, Open With, navigate to
    PythonInterpreter....WhereTF is "PythonInterpreter"? Not on the OS X
    system anywhere and Google only finds a Python module.

    So, how do I create a clickable icon that will launch my wxPython
    program?
     
    PhysicsGenius, Sep 25, 2004
    #1
    1. Advertisements

  2. PhysicsGenius

    Chris McD Guest

    PhysicsGenius wrote:
    > AAAAARRRRRRRRGGHGHGHGHGHGHGHGHGH!!!!!! I hate Macs.
    >
    > I have a wxPython program. It runs fine on OS X when I launch it from
    > the Terminal ("pythonw appname.py") . The user wants to be able to
    > click it. Two main suggestions on the Internet, neither of which
    > works:
    >
    > 1) "Use Platypus" So I download it, upgrade Stuffit, install both,
    > figure out how to use it, create an app....and it doesn't work for
    > graphical apps. Nice to know, thanks for telling me ahead of time!
    >
    > 2) "Just associate .py files with PythonInterpreter". Sounds easy!
    > So I navigate to appname.py, Get Info, Open With, navigate to
    > PythonInterpreter....WhereTF is "PythonInterpreter"? Not on the OS X
    > system anywhere and Google only finds a Python module.
    >
    > So, how do I create a clickable icon that will launch my wxPython
    > program?


    Well you are opening it with pythonw so why not associate *.py with
    pythonw or python?

    Chris
     
    Chris McD, Sep 25, 2004
    #2
    1. Advertisements

  3. Chris McD wrote:
    > PhysicsGenius wrote:
    >
    >> AAAAARRRRRRRRGGHGHGHGHGHGHGHGHGH!!!!!! I hate Macs.
    >>
    >> I have a wxPython program. It runs fine on OS X when I launch it from
    >> the Terminal ("pythonw appname.py") . The user wants to be able to
    >> click it. Two main suggestions on the Internet, neither of which
    >> works:
    >>
    >> 1) "Use Platypus" So I download it, upgrade Stuffit, install both,
    >> figure out how to use it, create an app....and it doesn't work for
    >> graphical apps. Nice to know, thanks for telling me ahead of time!
    >>
    >> 2) "Just associate .py files with PythonInterpreter". Sounds easy! So
    >> I navigate to appname.py, Get Info, Open With, navigate to
    >> PythonInterpreter....WhereTF is "PythonInterpreter"? Not on the OS X
    >> system anywhere and Google only finds a Python module.
    >>
    >> So, how do I create a clickable icon that will launch my wxPython
    >> program?

    >
    >
    > Well you are opening it with pythonw so why not associate *.py with
    > pythonw or python?
    >
    > Chris


    I was pretty sure this was impossible, but I may
    have done it. For anyone else as frustrated as I
    was (and still am, kinda): I associated .py with
    /System/Library/Frameworks/Python.framework/Resources/PythonLauncher.
    It still brings up a Terminal window, but at
    least the app launches from a click.

    Mac OS X: It Just Works (poorly)
     
    PhysicsGenius, Sep 25, 2004
    #3
  4. PhysicsGenius

    has Guest

    has, Sep 25, 2004
    #4
  5. PhysicsGenius <> wrote:

    > AAAAARRRRRRRRGGHGHGHGHGHGHGHGHGH!!!!!! I hate Macs.


    Just the perfect approach to get any help whatsoever from those of us
    who don't.

    *PLONK*.


    Alex
     
    Alex Martelli, Sep 25, 2004
    #5
  6. On 25-sep-04, at 19:35, PhysicsGenius wrote:

    > Chris McD wrote:
    >> PhysicsGenius wrote:
    >>> AAAAARRRRRRRRGGHGHGHGHGHGHGHGHGH!!!!!! I hate Macs.
    >>>
    >>> I have a wxPython program. It runs fine on OS X when I launch it
    >>> from
    >>> the Terminal ("pythonw appname.py") . The user wants to be able to
    >>> click it. Two main suggestions on the Internet, neither of which
    >>> works:
    >>>
    >>> 1) "Use Platypus" So I download it, upgrade Stuffit, install both,
    >>> figure out how to use it, create an app....and it doesn't work for
    >>> graphical apps. Nice to know, thanks for telling me ahead of time!
    >>>
    >>> 2) "Just associate .py files with PythonInterpreter". Sounds easy!
    >>> So I navigate to appname.py, Get Info, Open With, navigate to
    >>> PythonInterpreter....WhereTF is "PythonInterpreter"? Not on the OS X
    >>> system anywhere and Google only finds a Python module.
    >>>
    >>> So, how do I create a clickable icon that will launch my wxPython
    >>> program?

    >> Well you are opening it with pythonw so why not associate *.py with
    >> pythonw or python?
    >> Chris

    >
    > I was pretty sure this was impossible, but I may have done it. For
    > anyone else as frustrated as I was (and still am, kinda): I associated
    > .py with
    > /System/Library/Frameworks/Python.framework/Resources/PythonLauncher.
    > It still brings up a Terminal window, but at least the app launches
    > from a click.


    If you asked your question on the pythonmac SIG you'd have gotten your
    answer a lot sooner :)

    The best way to build a double-clickeable application on OSX is by
    building an .app bundle that contains your application. One way to do
    this is using bundlebuilder:

    # buildapp.py
    from bundlebuilder import buildapp

    buildapp(
    name = "My Application",
    mainprogram = "TableModel.py",
    resources = ["English.lproj"],
    nibname = "MainMenu",
    )
    # end of buildapp.py

    You can now run 'python buildapp.py build' to create the application
    bundle, run 'python buildapp.py' to see some more options.

    >
    > Mac OS X: It Just Works (poorly)


    No, it works differently :)
     
    Ronald Oussoren, Sep 27, 2004
    #6
  7. PhysicsGenius

    Greg Ewing Guest

    has wrote:
    > (PhysicsGenius) wrote in message news:<>...
    >
    >> So, how do I create a clickable icon that will launch my wxPython
    >> program?

    >
    > http://pythonmac.org/wiki/BundleBuilder


    You could also try creating a bundle by hand. I tried that
    as an experiment recently, and I got it to work. From memory,
    all you need is a directory structure that contains

    NameOfApp.app/Contents/MacOS/NameOfApp

    where the final NameOfApp is the executable. This can be
    a Python script with a #! line that invokes the appropriate
    interpreter (python or pythonw). Any other modules that it
    needs can be put in the MacOS directory alongside it.

    Another way is to use AppletBuilder to create a "skeleton"
    bundle from your main .py file, and then manually add other
    required modules to the MacOS directory. That will give
    you command line emulation, ability to give it a nice icon,
    etc.

    --
    Greg Ewing, Computer Science Dept,
    University of Canterbury,
    Christchurch, New Zealand
    http://www.cosc.canterbury.ac.nz/~greg
     
    Greg Ewing, Sep 30, 2004
    #7
    1. Advertisements

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. Andrew de la Harpe

    Clickable bar graphs

    Andrew de la Harpe, Nov 3, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    492
    Agiato
    Nov 3, 2003
  2. Amir

    DataGrid Clickable Columes

    Amir, Jan 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,899
  3. z. f.

    clickable validator

    z. f., Jul 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    395
    Curt_C [MVP]
    Jul 14, 2004
  4. Corno

    any clickable control

    Corno, Sep 5, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    409
    =?Utf-8?B?RmVybmFuZG8gSHVudGg=?=
    Sep 6, 2004
  5. Bart Schelkens

    Clickable image

    Bart Schelkens, Sep 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    668
    Sanjeeb Sarangi
    Sep 9, 2004
  6. RJN
    Replies:
    1
    Views:
    2,081
    =?Utf-8?B?U2NvdHQgU2ltb25z?=
    Sep 27, 2004
  7. davout
    Replies:
    0
    Views:
    408
    davout
    Aug 4, 2004
  8. Markus
    Replies:
    2
    Views:
    680
Loading...