From: Andrew W. <and...@al...> - 2006-10-26 01:40:52
|
Hello, I'm trying to use the getWidth() function on a text object, I get the following error on both Ming-0.0.3 and the latest CVS build. >>python text.py Traceback (most recent call last): File "text.py", line 16, in ? i.moveTo(160-t.getWidth("fnar! fnar!")/2, 120+t.getAscent()/2) File "/usr/lib/python2.4/site-packages/ming.py", line 503, in getWidth return mingc.SWFText_getStringWidth(self.this, string) TypeError: Type error. Got fnar! fnar!, expected _p_unsigned_char Any idea's what's wrong here? The original code is #!/usr/bin/env python from ming import * f = SWFFont("ArialSpecialG1.fdb") t = SWFText() t.setFont(f) t.setColor(0x80, 0x00, 0x80) t.setHeight(60) t.addString("fnar! fnar!") m = SWFMovie() m.setDimension(320, 240) i = m.add(t) i.moveTo(160-t.getWidth("fnar! fnar!")/2, 120+t.getAscent()/2) #print 'Content-type: application/x-shockwave-flash' m.save("text.swf") Thanks Andrew |