[PYTHONMAC-SIG] MacSpeech
Mark Alford
alford@IAS.EDU
Fri, 6 Mar 1998 16:57:34 -0500 (EST)
I'm sorry about my earlier "missent" attempt.
Please ignore it.
Here is a clearer description of my problem.
I've been having a problem using Tkinter and MacSpeech together,
on a PowerPC laptop. I'm running Mac System 8, with Python 1.5b3.
I've created a script that displays the problem (see below).
On the laptop, this script invariably dies
the *second* time I run it. How it dies depends on how much
memory is allocated to Python. Usually it freezes up
the whole machine, or gives "error type 112".
I'd be very grateful if anyone else could verify that this happens
(and perhaps suggest a cure...)
The laptop is a Powerbook 3400c, with 80M of RAM.
#----------- Example script, dies on *second* running -----------
from Tkinter import *
import macspeech
class MacSpeaker: # taken and simplified from grail.py in Mac speech demo
def __init__(self):
self.voices = []
self.nvoices = macspeech.CountVoices()
self.curvoice = 1
def _newvoice(self):
vd = macspeech.GetIndVoice(self.curvoice)
sc = vd.NewChannel()
self.curvoice = self.curvoice + 1
if self.curvoice > self.nvoices:
self.curvoice = 1
return sc
def newvoices(self, n):
self.voices = []
for i in range(n):
self.voices.append(self._newvoice())
# The class for the main window:
class Box(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent)
self.speaker = MacSpeaker() # open up the speaker
nv = self.speaker.nvoices
print nv
# Here is where it freezes upon the second running if nv is 22,
# the full number of voices available
# *******>>>>>>
self.speaker.newvoices(nv)
bb = Box()
bb.mainloop()
#--------------- End of example script --------------------
----------------------------------------------------------------------
Mark Alford
School of Natural Sciences
Institute for Advanced Study
Princeton, NJ 08540
U.S.A.
----------------------------------------------------------------------
_______________
PYTHONMAC-SIG - SIG on Python for the Apple Macintosh
send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
_______________