Unicode + SuperUltraAllNewGetItNow Python Upgrade questions: ASP/VBScript->Python

Jason Cunliffe jasonic at nomadicsltd.com
Wed Sep 6 16:44:09 EDT 2000


Hello

I am using a COMobjects for creating swf flash files. It is called 'Bukoo
Flash Objects' and it available at:
http://www.geocities.com/yiyisun/bukoo/.

One of the ASP[=VBScript] examples I am now converting to Python includes
this code:

    ' Create a Font
    Set font = Server.CreateObject("swfobjs.swfObject")
    with font
        .MakeFont "MyFont"
        .AddGlyph "Arial", "Bukoo", AscW("B")
        .AddGlyph "Arial", " ", AscW(" ")
        .AddGlyph "Arial", "is coming soon", AscW("I")
    end with

Where AscW("B"), AscW(" "),AscW("I")  render  Bold, Normal or Italic font.

In my wrox VBScript reference it says:
AscW(string)        returns the unicode character code for the first
character in a string

Please can anyone tell me what python function I can use ro replace
VBScript's AscW()

In Python the above example converts to:

bukfont = win32com.client.Dispatch("swfobjs.swfObject")

bukfont.MakeFont("MyFont")
bukfont.AddGlyph("Arial", "Bukoo", <pythonAscW() function goes here> )
bukfont.AddGlyph( "Arial", " ", <pythonAscW() function goes here> )
bukfont.AddGlyph("Arial", "is coming soon",<pythonAscW() function goes
ere>  )
--

I looked at 'Python Unicode Tutorial' page at
http://www.reportlab.com/i18n/python_unicode_tutorial.html
It is a great page but has some fragile warnings in the 'Installation and
Setup' about problems on Windows and PythonWin.
This applies to me. Also it is not version specific which is a shame. I
guess you just hafta know..

Q1. What version of Python now includes Unicode ?
[sorry to be dense about this but the recent embarassment of Python riches
plus other major software upgrades I am using this month has my head
spinning]

Q2. What unciode strategy can I use to make it work now with Python 1.5.2
[Win98se, PythonWin]?
I am running Python 1.5.2 on Win98se and I need to find an solution which
will work for others who I know also have 1.5.2 and may not be so ready to
upgrade just yet [Zope on Linux reasons etc]

Q3. This has to be very easy...
What can I enter as hardcode or via a little dictionary  which will return
the correct values for AscW("B"), AscW("I"), AscW("") as above?
There are only a few options when it comes to setting th font.. where can I
find out what these strings are ?

It seems upgrading to Unicode version Python is good thing.
Q4. Can I do this easily overwriting my current c:\program files\python
folder wihtout damage to all the packages and moduesl in there?

Q5. Does anyone know if UnicodePython will run ok with Zope 2.2.1 ?

Thanks
- Jason
________________________________________________________________
Jason CUNLIFFE = NOMADICS.(Interactive Art and Technology).Design Director






More information about the Python-list mailing list