[Pythonmac-SIG] Beginner's Q 's

Peter Sommerfeld peter.sommerfeld@gmx.de
Thu, 11 Nov 1999 00:32:50 +0100


Hi Craig, I'll bite :)

Craig Hagerman <craig@osa.att.ne.jp> wrote:
[lots snipped]

> 1.  The Mac pdf documentation doesn't make it clear to me what Pythons
> capabilities and limitations are for Mac specific programming.

Very few limitations if it is fast enough. Most MacOS toolbox calls are
available for nearly each and everything. Look into the Mac-Folder and
into Mac:PlugIns. The latter are shared libraries. If you really miss
something you can write it as shared library in C/C++ and add it to python.
Will rarely be neccesary.

> I know that AppleScript and Python are different beasts but it would be
> helpful to understand ways that they are similar; as in what kinds of
> things could I do with either language, and how they are different;
> ie. what kinds of things could I do in AppleScript and NOT in Python?

Dunno much about AppleScript. It's main goal is to handle applications
from your desktop and not a general purpose language like Python. It's
not platform-independent and (probably) much slower.

> 2.  I don't mind learning at the command line but I would be far more
> comfortable dealing with a GUI as the end result.

Start PythonIDE instead of the interpreter and you'll feel comfortable.
Later you can write your own GUI.

> I understand that Tkinter has some issues on the Mac. At the risk of
> asking a really stupid question... would it be possible to use RealBasic
> to create a GUI but use Python for the scripting and Apple Events to
> communicate between the two. I suspect the answer is no but I think it
> would be great if I could.

Should be possible. But using mac-toolbox is probably better because the
AppleEvents layer adds additional overhead and complexity and is slow.
Forget TKinter on mac. May be wxPython or Amulet will someday arrive at
the Mac as portable GUI-Toolkit. But at first and now, stick with the
mac-toolbox (imho, of course).

> 3.  My understanding is that it is possible to use Python to create simple
> applications on the Mac. (Or is this a misunderstanding - it is possible to
> create applications with Python AND C together ??)

Python is a full fledged programming language, not a tool for simple
applications only.  You can make applications out of a mixture of C/C++
and Python or any other language. Presently the Metrowerks compiler is
used but you can add shared MPW-libs. The bottom-line is to porototype
everything in Python first, than profile it, improve your algorithms,
profile it again and then add a few C-modules at hot-spots. But most
can be done in Python.

> I am interested in doing
> this to learn more about (a) OO programming and (b) Mac programming.
> (Python was the OVERWHELMING recommendation when I asked sources what to
> learn as a first step into OOP.)

Nice to hear :)

Read the sources !!! Python often is like pseudo-code. Start with one of the
simple examples and extend it. Look at

    http://developer.apple.com/macos/intro.html

for an intro and more informations about the Mac. There is somewhere on
python.org a link for a beginners mailing-list (not Mac-Specific).

-- Peter

BTW: use a subject line in your mail please.