+
+ Creating a User Interface with MacPython
+
+
+
+
+
+
Creating a User Interface with MacPython
+
+
There are a number of packages that allow creation of a user interface
+for your Python code, each of which has its own merits:
+
+
+
The Carbon package gives low-level access to the old Macintosh toolbox
+ calls for windows, events, dialogs and more. The FrameWork module
+ wraps these in a minimal framework. For documentation see the Macintosh
+ Library section of the Python Language and runtime
+ documentation and the Human Interface Toolbox section of
+ Apple's Carbon Documentation.
+ This solution is compatible with MacPython-OS9.
+
+
The W framework is built on top of this, and easier to use.
+ The MacPython IDE uses W. Some documentation is available on
+ Corran Webster's website.
+ Compatible with MacPython-OS9.
+
+
+
For new work, however, one of the following packages may be better suited.
+They may be available out of the box in this distribution, otherwise you
+can install them through the Package Manager:
+
+
+
PyObjC allows complete access to Cocoa.
+ In technical terms it is a
+ bidirectional bridge between Python and Objectve-C, similar to Apple's Java
+ bridge. Probably the best choice for Mac OS X-only applications, but at the
+ time of this writing PyObjC is still in beta.
+
+
wxPython gives Python programs
+ access to the wxWindows GUI toolkit. Many people consider this
+ the best open source cross-platform GUI solution available today.
+
+
Tkinter is the oldest cross-platform GUI toolkit for Python, bridging Python
+ to Tcl/Tk. If you install AquaTk it creates a native user interface on Mac OS X.
+ Documented in the Library section, Tkinter subsection of the
+ Python Language and runtime documentation. Tkinter
+ is not available for MacPython-OS9.
+
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html b/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
new file mode 100644
index 00000000000..9d2fe0e1032
--- /dev/null
+++ b/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
@@ -0,0 +1,51 @@
+
+
+
+
+ Controlling other Applications from MacPython
+
+
+
+
+
+
Controlling other Applications from MacPython
+
+
Python has a fairly complete implementation of the Open Scripting
+Architecure (OSA, also commonly referred to as AppleScript), allowing
+you to control scriptable applications from your Python program,
+and with a fairly pythonic interface. The following pieces of
+AppleScript and Python are rougly identical (XXXX Not true right now!):
+
+
+tell application "Finder"
+ get name of window 1
+end tell
+
+
+
+import Finder
+
+f = Finder.Finder()
+print f.get(Finder.window(1).name)
+
+
+
To send AppleEvents to an application you must first create the Python
+modules interfacing to the terminology of the application (what
+Script Editor calls the "Dictionary"). Use the IDE menu command
+File->Generate OSA Suite... for this. For more control run
+
+You can also create a scriptable application in Python, but this is not
+very well documented. For Carbon
+applications you should look at the MiniAEFrame module.
+
+
+