From: Jack Jansen Date: Mon, 31 Mar 2003 15:10:46 +0000 (+0000) Subject: Added 1-page introductions to creating GUIs in Python and the OSA X-Git-Tag: v2.3c1~1309 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=71ad9fb74ff367e0c89f3fce34febd4eae2a4e2b;p=thirdparty%2FPython%2Fcpython.git Added 1-page introductions to creating GUIs in Python and the OSA interface. --- 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 000000000000..e715de4aef1b --- /dev/null +++ b/Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html @@ -0,0 +1,55 @@ + + + + + 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:

+ + + +

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:

+ + + + + diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html b/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html index b020d2f79a45..849548b5cf7e 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 @@
  • Running Python scripts from the Finder
  • Running Python scripts from the Unix Shell +
  • Creating a User Interface with MacPython +
  • Controlling other Applications from MacPython
  • Installing additional functionality with the Package Manager
  • 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 000000000000..9d2fe0e10323 --- /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

    + +
    +pythonw .../Lib/plat-mac/gensuitemodule.py --help +
    + +

    from a terminal window.

    + +

    Creating a scriptable application in Python

    + +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. + + +