Member Avatar for rickyfre

OK geniuses! I have to use python 2.4 and 2.5 here and my programs ideally work with both versions. This area of code was working in 2.4 and 2.5 versions until replacing my computer. Python did not get ported over so I reloaded with new downloads from the web. (both 2.4 and 2.5 and applicable wx python for each version). Now in order for this code to work in version 2.5 I must change the spelling of Color to Colour...Is there some kind of fix for 2.5 that I can add? (Code also works as is with 2.6 python).
Thanks in advance for your inputs....

ricky

bBlk = wx.Color(  0,  0,  0)
bWht = wx.Color(255,255,255)
bGrn = wx.Color(  0,255,  0)
bYel = wx.Color(255,255,  0)
bRed = wx.Color(255,  0,  0)
bGry = wx.Color(128,128,128)
dRed = wx.Color( 96,  0,  0)
dGrn = wx.Color(  0, 96,  0)

I think Python gets the locale from your computer, so perhaps that changed with the installation. You can try
locale.setlocale() and see if it helps.

In python 2.6, I have both

>>> import wx
>>> wx.Color
<class 'wx._gdi.Colour'>
>>> wx.Colour
<class 'wx._gdi.Colour'>

You could add a piece of code like

import wx
if hasattr(wx, "Color"):
    wx.Colour = wx.Color
else:
    wx.Color = wx.Colour

I think it has to do more with the version of wxPython than Python itself.

Member Avatar for rickyfre

Thanks everyone! I found a version wxPython2.8-win32-ansi-2.8.9.1-py25.exe on one of my old computers and loaded it instead of the 2.9.9.1 version I had loaded from the internet. The problem is fixed.

ricky

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.