Clickable (wx)python app in OS X

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

    Clickable (wx)python app in OS X

    AAAAARRRRRRRRGG HGHGHGHGHGHGHGH GH!!!!!! 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 PythonInterpret er". Sounds easy!
    So I navigate to appname.py, Get Info, Open With, navigate to
    PythonInterpret er....WhereTF is "PythonInterpre ter"? 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?
  • Chris McD

    #2
    Re: Clickable (wx)python app in OS X

    PhysicsGenius wrote:[color=blue]
    > AAAAARRRRRRRRGG HGHGHGHGHGHGHGH GH!!!!!! 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 PythonInterpret er". Sounds easy!
    > So I navigate to appname.py, Get Info, Open With, navigate to
    > PythonInterpret er....WhereTF is "PythonInterpre ter"? 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?[/color]

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

    Chris

    Comment

    • PhysicsGenius

      #3
      Re: Clickable (wx)python app in OS X

      Chris McD wrote:[color=blue]
      > PhysicsGenius wrote:
      >[color=green]
      >> AAAAARRRRRRRRGG HGHGHGHGHGHGHGH GH!!!!!! 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 PythonInterpret er". Sounds easy! So
      >> I navigate to appname.py, Get Info, Open With, navigate to
      >> PythonInterpret er....WhereTF is "PythonInterpre ter"? 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?[/color]
      >
      >
      > Well you are opening it with pythonw so why not associate *.py with
      > pythonw or python?
      >
      > Chris[/color]

      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.framewor k/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)

      Comment

      • has

        #4
        Re: Clickable (wx)python app in OS X

        desiredusername @gmail.com (PhysicsGenius) wrote in message news:<26658f61. 0409250605.32f1 8ba2@posting.go ogle.com>...
        [color=blue]
        > So, how do I create a clickable icon that will launch my wxPython
        > program?[/color]


        Comment

        • Alex Martelli

          #5
          Re: Clickable (wx)python app in OS X

          PhysicsGenius <desiredusernam e@gmail.com> wrote:
          [color=blue]
          > AAAAARRRRRRRRGG HGHGHGHGHGHGHGH GH!!!!!! I hate Macs.[/color]

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

          *PLONK*.


          Alex

          Comment

          • Ronald Oussoren

            #6
            Re: Clickable (wx)python app in OS X


            On 25-sep-04, at 19:35, PhysicsGenius wrote:
            [color=blue]
            > Chris McD wrote:[color=green]
            >> PhysicsGenius wrote:[color=darkred]
            >>> AAAAARRRRRRRRGG HGHGHGHGHGHGHGH GH!!!!!! 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 PythonInterpret er". Sounds easy!
            >>> So I navigate to appname.py, Get Info, Open With, navigate to
            >>> PythonInterpret er....WhereTF is "PythonInterpre ter"? 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?[/color]
            >> Well you are opening it with pythonw so why not associate *.py with
            >> pythonw or python?
            >> Chris[/color]
            >
            > 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.framewor k/Resources/PythonLauncher.
            > It still brings up a Terminal window, but at least the app launches
            > from a click.[/color]

            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.lp roj"],
            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.
            [color=blue]
            >
            > Mac OS X: It Just Works (poorly)[/color]

            No, it works differently :-)

            Comment

            • Greg Ewing

              #7
              Re: Clickable (wx)python app in OS X

              has wrote:[color=blue]
              > desiredusername @gmail.com (PhysicsGenius) wrote in message news:<26658f61. 0409250605.32f1 8ba2@posting.go ogle.com>...
              >[color=green]
              >> So, how do I create a clickable icon that will launch my wxPython
              >> program?[/color]
              >
              > http://pythonmac.org/wiki/BundleBuilder[/color]

              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


              Comment

              Working...