[Pythonmac-SIG] PyObjC

2005-06-15 Thread Jan Erik Moström
I'm currently looking around for what tools I should use for writing Mac
applications with GUIs. I've previously done this using either Java (no fun
and Swing based programs doesn't look good) or REALbasic, but would like to
use something else.

I've looked at Cocoa and Objective-C (haven't done any programming) but I
don't really like the syntax of Objective-C. So I've been considering using
Python instead, my previous experience of Python is "standard" shell scripts
and CGI scripts.

This might seem like a really stupid question but since I don't haven't used
Cocoa/Objective-C or PyObCj/Python I would like to ask a question: if I
decide to use Python are there limitations on what I can do? (for example not
being able to use UI widget XXX)

jem
-- 
Jan Erik Moström, www.mostrom.pp.se
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] PyObjC

2005-06-15 Thread Michael Hudson
Jan Erik Moström <[EMAIL PROTECTED]> writes:

> I'm currently looking around for what tools I should use for writing Mac
> applications with GUIs. I've previously done this using either Java (no fun
> and Swing based programs doesn't look good) or REALbasic, but would like to
> use something else.

Use PyObjC.  This is such an easy question! :)

> I've looked at Cocoa and Objective-C (haven't done any programming) but I
> don't really like the syntax of Objective-C. So I've been considering using
> Python instead, my previous experience of Python is "standard" shell scripts
> and CGI scripts.
>
> This might seem like a really stupid question but since I don't
> haven't used Cocoa/Objective-C or PyObCj/Python I would like to ask
> a question: if I decide to use Python are there limitations on what
> I can do? (for example not being able to use UI widget XXX)

Not that you'll notice.

Cheers,
mwh

-- 
  Lisp does badly because we refuse to lie.  When people ask us if 
  we can solve insoluble problems we say that we can't, and because 
  they expect us to lie to them, they find some other language
  where the truth is less respected.   -- Tim Bradshaw, comp.lang.lisp
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] PyObjC

2005-06-15 Thread Jan Erik Moström
Michael Hudson <[EMAIL PROTECTED]> 2005-06-15 10:35:

>Use PyObjC.  This is such an easy question! :)

I kind of expected that answer ;-)

>> This might seem like a really stupid question but since I don't
>> haven't used Cocoa/Objective-C or PyObCj/Python I would like to ask
>> a question: if I decide to use Python are there limitations on what
>> I can do? (for example not being able to use UI widget XXX)
>
>Not that you'll notice.

Care to give some details? 

jem
-- 
Jan Erik Moström, www.mostrom.pp.se
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] PyObjC

2005-06-15 Thread Michael Hudson
Jan Erik Moström <[EMAIL PROTECTED]> writes:

> Michael Hudson <[EMAIL PROTECTED]> 2005-06-15 10:35:
>
>>Use PyObjC.  This is such an easy question! :)
>
> I kind of expected that answer ;-)
>
>>> This might seem like a really stupid question but since I don't
>>> haven't used Cocoa/Objective-C or PyObCj/Python I would like to ask
>>> a question: if I decide to use Python are there limitations on what
>>> I can do? (for example not being able to use UI widget XXX)
>>
>>Not that you'll notice.
>
> Care to give some details? 

Like what?  AFAICT you can't fully use NSInvocation from PyObjC, but
you don't want to.  Stuff like that.

Cheers,
mwh

-- 
  > so python will fork if activestate starts polluting it?
  I find it more relevant to speculate on whether Python would fork
  if the merpeople start invading our cities riding on the backs of 
  giant king crabs. -- Brian Quinlan, comp.lang.python
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Tricky question?

2005-06-15 Thread Schollnick, Benjamin

> > If you want it more automated, System Profiler is scriptable, so
> > one of
> > the Python AppleScript interfaces could be used.
> 
> I highly recommend that you forget that it has a scriptable  
> interface, and just use the command-line app as I had 
> suggested in my  
> previous message.. less overhead and more likely to actually do what  
> you want.

How did I forget about this?  I must be too highly trained
And not have a Macintosh for development

I'll explore the System Profiler, especially since it can output in
XML.  I already have code to import XML data files, so I could probably
adopt
that for use  (Or just scrape the text data)

Thanks for the suggestions!

- Benjamin
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] macspeech for MacOSX

2005-06-15 Thread Noboru Yamamoto

Hi,

Attached file, macspeechX.py, is a replacement for macspeech module 
which used to be included in the Mac-Python distribution.
As name indicates, it works with MacOSX and has similar, if not same, 
interfaces found in the old macspeech module.


It requires ctypes module newer than 0.9.6 and Mac OSX 10.{2,3.4}.
Python interpreter come with MacOSX may not work, at least for me,
so you might need to build and install python from the source code.
Python 2.4.1 and ctypes 0.9.6 should work well.

I hope someone will think it is useful.

Thanks,

Noboru Yamamoto
Accelerator Lab.
KEK, JAPAN
#!/usr/local/bin/python
"""
macspeechX.py ; Python Interface to Speech Syntheis Mangaer on Macintosh OSX.
requires; ctypes module(0.9.6 or later) and latest python interpreter.
Python interpreter pre-installed on OS may not work with latest ctypes module.

macspeechX tryed to simulate old macspeech module bundled with python(in
Pre-MacOSX era). The document for macspeech module should work on macspeechX 
module.

(c) Noboru Yamamoto(KEK,JAPAN),2005
"""
import ctypes
from ctypes import cdll,byref
#load speachSynthesis dll
__SS_Available=None

try:

__ssdll=cdll.LoadLibrary("/System/Library/Frameworks/ApplicationServices.framework/Frameworks/SpeechSynthesis.framework/Versions/Current/SpeechSynthesis")
__SS_Available=1
except:
raise "Speech Systheis is not available on this machine"

#
def C2PStr(aStr):
return "%c%s"%(len(aStr),aStr)
#constants
_kNoEndingProsody = 1
_kNoSpeechInterrupt = 2
_kPreflightThenPause = 4

_kNeuter=0
_kMake=1
_kFemale=2

_kImmediate=0
_kEndOfWord=1
_kEndOfSentence=2

# classes
class NumVersion(ctypes.Structure):
_fields_=[("nonRelRev",ctypes.c_ubyte),
  ("stage",ctypes.c_byte),
  ("minorAndBugRev",ctypes.c_ubyte),
  ("majorRev",ctypes.c_ubyte)]

class VoiceSpec(ctypes.Structure):
_fields_=[ ("creator",ctypes.c_ulong),
   ("id",ctypes.c_ulong),
   ]

class VoiceDescription(ctypes.Structure):
_fields_=[ ("length",ctypes.c_long),
   ("Voice",VoiceSpec),
   ("version",ctypes.c_long),
   ("name",ctypes.c_char*64),
   ("comment",ctypes.c_char*256),
   ("gender",ctypes.c_short),
   ("age",ctypes.c_short),
   ("script",ctypes.c_short),
   ("language",ctypes.c_short),
   ("region",ctypes.c_short),
   ("reserved",ctypes.c_long*4), 
   ]

class SpeechChannelRecord(ctypes.Structure):
_fields_=[("data",ctypes.c_long*1)]

# classes for macspeech
__ssdll.GetVoiceDescription.argtypes=[VoiceSpec, 
ctypes.POINTER(VoiceDescription) ]

class SpeechChannel:
__ssdll=globals()["__ssdll"]
__ssdll.NewSpeechChannel.argtypes=[ctypes.POINTER(VoiceSpec), 
   
ctypes.POINTER(ctypes.POINTER(SpeechChannelRecord))]

def __init__(self,v=None):
if not v:
v=Voice(0)
self.channel=ctypes.pointer(SpeechChannelRecord())

status=SpeechChannel.__ssdll.NewSpeechChannel(byref(v),byref(self.channel))
 
def __del__(self):
SpeechChannel.__ssdll.DisposeSpeechChannel(self.channel)

def SpeakText(self,s):
status=SpeechChannel.__ssdll.SpeakText(self.channel, s, len(s))
return status

def SpeakBuffer(self,  s, l, c=0):
status=SpeechChannel.__ssdll.SpeakText(self.channel, s, 
ctypes.c_ulong(l), ctypes.c_long(c))
return status

def Stop(self):
status=SpeechChannel.__ssdll.StopSpeech(self.channel)
return status

def StopAt(self,where=_kImmediate):
status=SpeechChannel.__ssdll.StopSpeechAt(self.channel,where)
return status

def Pause(self,where=_kImmediate):
status=SpeechChannel.__ssdll.PauseSpeechAt(self.channel,where)
return status

def Continue(self):
status=SpeechChannel.__ssdll.ContinueSpeech(self.channel)
return status

def GetPitch(self):
pitch=ctypes.c_long(0)
status=SpeechChannel.__ssdll.GetSpeechPitch(self.channel, byref(pitch))
self.pitch=pitch.value
return pitch.value

def SetPitch(self, pitch):

status=SpeechChannel.__ssdll.SetSpeechPitch(self.channel,ctypes.c_long(pitch))
self.pitch=pitch
return pitch

def GetRate(self):
rate=ctypes.c_long(0)
status=SpeechChannel.__ssdll.GetSpeechRate(self.channel,byref(rate))
self.rate=rate.value
return self.rate

def SetRate(self,rate):

status=SpeechChannel.__ssdll.SetSpeechRate(self.channel,ctypes.c_long(rate))
self.rate=rate
return rate

class Voice:
__ssdll=globals()["__ssdll"]
__ssdll.GetVoiceDescription.argtypes=[ctypes.POINTER(VoiceSpec), 
ctypes.POINTER(VoiceDescription) ]

def __init__(self,ind=1):
self.voice=VoiceSpec()
Voice.__ssdll.GetIndVoice(ind, byre

[Pythonmac-SIG] Newbie....(for now)

2005-06-15 Thread Robert Herbstzuber
Hello to all
I've been writing PHP web apps for about 3 years now and I took one  
JAVA course over that time.
I'm looking to get into "real" programming and I've chosen Python as  
my intro to it.
I"ve installed the framework build of 2.4.1 on my Tiger install and  
i've tried to read a lot of documentation.
As with most help it is too advanced for where I am right now or it  
isn't OS X specific enough. So I'm going to try to turn here

Question1:
When you install something like SciPy.py how do you know if you have  
the dependents that you need.
Is there a way to list installed packages? I looked at package  
manager and it just doesn't seem mature. Maybe I'm just using it wrong.

Question2:
Where are the packages installed?

Question3:
Are there a good example of Python programs on a site somewhere?

Cheers and thanks.
Robert


Robert Herbstzuber
http://bostonmacosx.dyndns.org/
http://rjhcc.dyndns.biz/
-

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] what's the plural of "Emacs"?

2005-06-15 Thread Charles Hartman
I'd like to reintroduce myself to Emacs, so I went looking for "the  
Mac version". There seem to be at least two, maybe more, even just  
from Apple. Can anyone give me the thumbnail version of why I should  
get one or another?

Charles Hartman

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] what's the plural of "Emacs"?

2005-06-15 Thread Bob Ippolito

On Jun 15, 2005, at 5:38 PM, Charles Hartman wrote:

> I'd like to reintroduce myself to Emacs, so I went looking for "the
> Mac version". There seem to be at least two, maybe more, even just
> from Apple. Can anyone give me the thumbnail version of why I should
> get one or another?

Emacsen?

Apple only offers one emacs, the one that ships with Mac OS X, unless  
you're just talking about listings on ?

I've heard that some people are happy with the Carbonized GNU Emacs  
(I think it can be compiled from CVS, but there are various binaries  
available), and Kevin Walzer is working on an AquaMacs  distribution, which I've  
heard mixed things about.

-bob

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] what's the plural of "Emacs"?

2005-06-15 Thread eichin
> Apple only offers one emacs, the one that ships with Mac OS X, unless  

Which was great until tiger - the tiger version has painful
curses-related bugs, and since it only works inside a terminal (xterm,
Terminal.app) this is a problem.

> Emacsen?

Yes.  Debian uses the term specifically, in the "packaging that
applies to multiple emacsen" (common byte-compiling hooks and such.)

http://home.att.ne.jp/alpha/z123/emacs-mac-e.html

is the one I've been using, also built pretty closely from CVS (it
even thinks it is a 22.x emacs now :) and has cool things like
do-applescript.

There's also an emacs in fink, if you want one with terminal + X11
support instead of Carbon.
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] what's the plural of

2005-06-15 Thread fghorow . 11707581
--- Charles Hartman <[EMAIL PROTECTED] wrote:
I'd like to reintroduce
myself to Emacs, so I went looking for "the  
> Mac version". There seem
to be at least two, maybe more, even just  
> from Apple. Can anyone give
me the thumbnail version of why I should  
> get one or another?
> 
> Charles
Hartman
> 

As others have opined, "emacsen" seems to be in common usage.


Others have mentioned GNU emacs in various configurations (including one
compiled for Carbon). 

I'd just like to point out that Andrew Choi (who
did(?)/was involved in(?) the http://members.shaw.ca/akochoi-emacs/index.html";>original
port of GNU Emacs to Carbon has since retired from OSX GNU Emacs 
maintainance
role, and is now completing a http://members.shaw.ca/akochoi-xemacs/index.html";>port
of XEmacs to Carbon. In plain English, this means that XEmacs runs on
OSX natively, without needing to run X11 (as in the fink version of XEmacs).
N.B. You need to compile from source, but Andrew's instructions are excellent.


Hope this helps someone else.

(As to why you'd choose between GNU Emacs
and XEmacs, that's a well known and aged fork. Google for JWZ's opinion on
the subject. In other words, it's a religious war...)

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] what's the plural of "Emacs"?

2005-06-15 Thread Charles Hartman
I was wondering about the ones in
http://www.apple.com/downloads/macosx/
I see "Carbon Emacs", "Emacs on Aqua 8.0-rc3", "AquaMacs 0.9.1" . . .

Charles Hartman


On Jun 15, 2005, at 6:50 PM, [EMAIL PROTECTED] wrote:

>> Apple only offers one emacs, the one that ships with Mac OS X, unless
>>
>
> Which was great until tiger - the tiger version has painful
> curses-related bugs, and since it only works inside a terminal (xterm,
> Terminal.app) this is a problem.
>
>
>> Emacsen?
>>
>
> Yes.  Debian uses the term specifically, in the "packaging that
> applies to multiple emacsen" (common byte-compiling hooks and such.)
>
> http://home.att.ne.jp/alpha/z123/emacs-mac-e.html
>
> is the one I've been using, also built pretty closely from CVS (it
> even thinks it is a 22.x emacs now :) and has cool things like
> do-applescript.
>
> There's also an emacs in fink, if you want one with terminal + X11
> support instead of Carbon.
> ___
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Newbie....(for now)

2005-06-15 Thread Kent Quirk
The easiest way to know if you have a package is to try to import it.
Don't forget that Python has a command-line interpreter. Just run it and
type "import SciPy" and see if it works!

If you want to learn idiomatic Python one of the best places to go is
the Python Cookbook. I'd recommend buying the book (2nd edition),
although the recipes are available online at: 
http://aspn.activestate.com/ASPN/Python/Cookbook/

By your comment about "not OS X specific" I'm guessing that you want to
build Mac GUI apps. But if you've never done application programming
before with a GUI API, you might have trouble getting into it from
Python. There are several Python tools for building GUIs, there's no
clear standard, and they all tend to assume you already know how to
build GUIs. I'm not aware of a book that attempts to do much for people
new to the concepts.

For example, PyObjC will let you do pretty much anything you can do on a
Mac in Cocoa, without writing a line of Objective C. But it's a "bridge"
to ObjC -- you really have to be able to read and understand Objective C
and Cocoa to use it.  

The standard Python GUI library is tkinter, but it's clunky, limited,
and makes apps that look pretty much only like tkinter apps. 

Having not yet used wxPython, I'm not sure how "native" its apps look,
but people seem to like its power.

Good luck!

Kent


Robert H wrote:

>I've been writing PHP web apps for about 3 years now and I took one  
>JAVA course over that time.
>I'm looking to get into "real" programming and I've chosen Python as  
>my intro to it.
>I"ve installed the framework build of 2.4.1 on my Tiger install and  
>i've tried to read a lot of documentation.
>As with most help it is too advanced for where I am right now or it  
>isn't OS X specific enough. So I'm going to try to turn here

>Question1:
>When you install something like SciPy.py how do you know if you have  
>the dependents that you need.
>Is there a way to list installed packages? I looked at package  
>manager and it just doesn't seem mature. Maybe I'm just using it wrong.

>Question2:
>Where are the packages installed?

>Question3:
>Are there a good example of Python programs on a site somewhere?




___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] Aquamacs

2005-06-15 Thread Kevin Walzer
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Charles,

There are indeed various versions of Emacs out there for OS X. You can't
tell the players without a scorecard. Here's the rundown, based on
what's available at
http://www.apple.com/downloads/macosx/unix_open_source/ and elsewhere:

Carbon Emacs Package June '05: As far as I can tell, a well-maintained
build of Emacs from CVS, with the standard Emacs interface. It seems to
be released fairly regularly.

Emacs-on-Aqua: This is a Cocoa binding of Emacs, derived from the old
NeXT port of Emacs. It has a nice Aqua look and feel (unlike standard
Carbon Emacs). Its main drawback is that it's more than a full version
behind current Emacs (20.x, not 22.x). Development on it has just begun
again after being dormant for a couple of years (i.e. it was last
released for Jaguar).

Yaced (Yet Another Carbon Emacs Distribution, at
http://yaced.sourceforge.net): Pretty similar to Carbon Emacs Package
above, with some customizations geared to making it a good editing
environment for LaTeX. The maintainer, Norm Gall, also packages AucTeX.

Aquamacs, which I'm working on with David Reitter: This is a more
radical revision of Emacs: it overrides a lot of the standard Emacs
interface conventions, keyboard shortcuts, etc. and replaces them with
standard Aqua keymappings. i.e., Apple-C is the preferred method to copy
text. This is based on Carbon Emacs. I like the approach that Aquamacs
uses because I no longer have to choose between Emacs' power and
BBEdit/Textwrangler's ease of use.  If you prefer standard Emacs,
Aquamacs will probably drive you crazy.

There are probably other builds that I'm not aware of, but these are the
ones that seem to be most popular.

Let me know if you have other questions.

- --
Cheers,

Kevin Walzer, PhD
WordTech Software--Open Source Applications and Packages for OS X
http://www.wordtech-software.com
http://www.kevin-walzer.com
http://www.smallbizmac.com.
mailto:[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCsOQGJmdQs+6YVcoRAh6aAKCEpNAdyuJ/h9cjy+MhuLAVjrHWlQCdEAoH
LrGOprXPdApArcDD6LTd5d4=
=Lstc
-END PGP SIGNATURE-
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] what's the plural of "Emacs"?

2005-06-15 Thread Skip Montanaro

Bob> I've heard that some people are happy with the Carbonized GNU Emacs
Bob> (I think it can be compiled from CVS, but there are various
Bob> binaries available), and Kevin Walzer is working on an AquaMacs
Bob>  distribution,
Bob> which I've heard mixed things about.

My understanding (completely second-hand, and from the XEmacs gang, no less)
is that the guy that Carbonized (Carbonified?) GNU Emacs got disillusioned
with the GNU folk.  There are enough Mac/GNU Emacs people to keep that
running though, so it should be a reasonable option.  There is a Carbon
patch for XEmacs (contributed by the same guy) that's available as a a
branch on the XEmacs CVS repository.

Skip

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig