Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
71ad9fb7
Commit
71ad9fb7
authored
Mar 31, 2003
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added 1-page introductions to creating GUIs in Python and the OSA
interface.
parent
007fadd5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
0 deletions
+108
-0
Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html
...ources/app/Resources/English.lproj/Documentation/gui.html
+55
-0
Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html
...rces/app/Resources/English.lproj/Documentation/index.html
+2
-0
Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
.../app/Resources/English.lproj/Documentation/scripting.html
+51
-0
No files found.
Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html
0 → 100644
View file @
71ad9fb7
<!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>
Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html
View file @
71ad9fb7
...
...
@@ -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>
...
...
Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
0 → 100644
View file @
71ad9fb7
<!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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment