summaryrefslogtreecommitdiffstats
path: root/Mac/OSXResources
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-03-31 15:10:46 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-03-31 15:10:46 (GMT)
commit71ad9fb74ff367e0c89f3fce34febd4eae2a4e2b (patch)
treebe2e914a6d425d888a9c7a44492fb8552a7d1bf0 /Mac/OSXResources
parent007fadd59dfe3db2a9ae09d7e92de3d5595aa1de (diff)
downloadcpython-71ad9fb74ff367e0c89f3fce34febd4eae2a4e2b.zip
cpython-71ad9fb74ff367e0c89f3fce34febd4eae2a4e2b.tar.gz
cpython-71ad9fb74ff367e0c89f3fce34febd4eae2a4e2b.tar.bz2
Added 1-page introductions to creating GUIs in Python and the OSA
interface.
Diffstat (limited to 'Mac/OSXResources')
-rw-r--r--Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html55
-rw-r--r--Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html2
-rw-r--r--Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html51
3 files changed, 108 insertions, 0 deletions
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html b/Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html
new file mode 100644
index 0000000..e715de4
--- /dev/null
+++ b/Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+ <title>Creating a User Interface with MacPython</title>
+ <meta name="generator" content="BBEdit 6.5.3">
+ <link rel="SHORTCUT ICON" href="pythonsmall.gif">
+ <META NAME="AppleIcon" CONTENT="pythonsmall.gif">
+</head>
+<body>
+<h1>Creating a User Interface with MacPython</h1>
+
+<p>There are a number of packages that allow creation of a user interface
+for your Python code, each of which has its own merits:</p>
+
+<ul>
+ <li> The Carbon package gives low-level access to the old Macintosh toolbox
+ calls for windows, events, dialogs and more. The <tt>FrameWork</tt> module
+ wraps these in a minimal framework. For documentation see the Macintosh
+ Library section of the <a href="doc/index.html">Python Language and runtime
+ documentation</a> and the Human Interface Toolbox section of
+ <a href="help:openbook=Carbon">Apple's Carbon Documentation</a>.
+ This solution is compatible with MacPython-OS9.
+
+ <li> The <tt>W</tt> framework is built on top of this, and easier to use.
+ The MacPython IDE uses W. Some documentation is available on
+ <a href="http://www.nevada.edu/~cwebster/Python/index.html">Corran Webster's website</a>.
+ Compatible with MacPython-OS9.
+</ul>
+
+<p>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 <a href="packman.html">Package Manager</a>:</p>
+
+<ul>
+ <li> <a href="http://pyobjc.sourceforge.net/">PyObjC</a> 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.
+
+ <li> <a href="http://wxpython.sourceforge.net/">wxPython</a> gives Python programs
+ access to the wxWindows GUI toolkit. Many people consider this
+ the best open source cross-platform GUI solution available today.
+
+ <li> 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
+ <a href="doc/index.html">Python Language and runtime documentation</a>. Tkinter
+ is not available for MacPython-OS9.
+</ul>
+
+</body>
+</html>
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html b/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html
index b020d2f..849548b 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html
+++ b/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html
@@ -30,6 +30,8 @@
<li><a href="finder.html">Running Python scripts from the Finder</a>
</li>
<li><a href="shell.html">Running Python scripts from the Unix Shell</a>
+ <li><a href="gui.html">Creating a User Interface with MacPython</a>
+ <li><a href="scripting.html">Controlling other Applications from MacPython</a>
<li><a href="packman.html">Installing additional functionality with the
Package Manager</a>
</li>
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 0000000..9d2fe0e
--- /dev/null
+++ b/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+ <title>Controlling other Applications from MacPython</title>
+ <meta name="generator" content="BBEdit 6.5.3">
+ <link rel="SHORTCUT ICON" href="pythonsmall.gif">
+ <META NAME="AppleIcon" CONTENT="pythonsmall.gif">
+</head>
+<body>
+<h1>Controlling other Applications from MacPython</h1>
+
+<p>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!):</p>
+
+<blockquote><tt><pre>
+tell application "Finder"
+ get name of window 1
+end tell
+</pre></tt></blockquote>
+
+<blockquote><tt><pre>
+import Finder
+
+f = Finder.Finder()
+print f.get(Finder.window(1).name)
+</pre></tt></blockquote>
+
+<p>To send AppleEvents to an application you must first create the Python
+modules interfacing to the terminology of the application (what
+<tt>Script Editor</tt> calls the "Dictionary"). Use the IDE menu command
+<tt>File->Generate OSA Suite...</tt> for this. For more control run</p>
+
+<blockquote><tt>
+pythonw .../Lib/plat-mac/gensuitemodule.py --help
+</tt></blockquote>
+
+<p>from a terminal window.</p>
+
+<h2>Creating a scriptable application in Python</h2>
+
+You can also create a scriptable application in Python, but this is not
+very well documented. For Carbon
+applications you should look at the <tt>MiniAEFrame</tt> module.
+
+</body>
+</html>