pyGUI & wake a sleeping Mac example.
I started playing around with pyGUI a year or two ago, which allows fast gui development on OS X, Windows, and Linux from Python. I’m really liking it. I wrote a liitle app to wake up Macs awhile back and packaged it as a standard Mac bundle. In theory the raw Python should run on Windows, but be aware that I use arp. Anyway, this app will wake a sleeping Macintosh with either an IP or MAC address. This is a very simple example of a basic window, textbox, and button, but I was playing! I also wrote a little calculator, mostly done minus a few bugs, but it’s an example of pyGUI and I likely will never do anything else with it.
If you’re unsure of how to package a Python App Bundle I’ll walk you through it now. Install XCode. Create your Python program. Right click your script and select Open With, Build Applet.App. Python version 2.6 would not work with pyGUI so I selected 2.5. Now you need to right click your new app bundle and select Show Package Contents. Drill down into Resources folder. Copy the GUI folder in the pyGUI (I keep the pyGUI download handy on my desktop) lib and paste it into Resources. Your app should run with a GUI now since it has the pyGUI libraries available. To change the icon, just get an icon you like and use Icon Composer, which is in Utilities in the Development folder. Drag the image into the box and save as the same name as the icns in Resources in the app bundle. Copy over it and you’re set. I have not tested bundling on Lion, but the bundled apps run fine.