The TablePrint.py demo raise a error when printpreview:
File
"/usr/lib/python2.4/site-packages/wx-2.5.5-gtk2-unicode/wx/lib/printout.py", line 176, in GetNow
full = str(wx.DateTime_Now()) # get the current date and time
in print format
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in
position 1: ordinal not in range(128)
This error happens because, in my language, Saturday(Sat) is
Sábado(Sáb).
I change the offending line to, full = unicode(wx.DateTime_Now()), and
now the printpreview runs ok.
The TablePrint.py demo raise a error when printpreview:
File
"/usr/lib/python2.4/site-packages/wx-2.5.5-gtk2-unicode/wx/lib/printout.py", line 176, in GetNow
full = str(wx.DateTime_Now()) # get the current date and time
in print format
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in
position 1: ordinal not in range(128)
This error happens because, in my language, Saturday(Sat) is
Sábado(Sáb).
Thanks. I'll correct this by fixing wx.DateTime.__str__.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
The TablePrint.py demo raise a error when printpreview:
File
"/usr/lib/python2.4/site-packages/wx-2.5.5-gtk2-unicode/wx/lib/printout.py", line 176, in GetNow
full = str(wx.DateTime_Now()) # get the current date and time
in print format
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in
position 1: ordinal not in range(128)
This error happens because, in my language, Saturday(Sat) is
Sábado(Sáb).
Thanks. I'll correct this by fixing wx.DateTime.__str__.
That GetNow function is pretty bogus anyway since the string representation of a wx.DateTime is dependent on platform and locale. I think that it will only work as intended on Windows in an English locale, so it will need to be rewritten as well.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
That GetNow function is pretty bogus anyway since the string representation of a wx.DateTime is dependent on platform and locale. I think that it will only work as intended on Windows in an English locale, so it will need to be rewritten as well.
Ricardo, please replace the GetNow method with this one and let me know if that works for you.
def GetNow(self):
now = wx.DateTime.Now()
date = now.FormatDate()
time = now.FormatTime()
return date, time
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Sáb, 2005-04-09 às 12:17 -0700, Robin Dunn escreveu:
Robin Dunn wrote:
> That GetNow function is pretty bogus anyway since the string
> representation of a wx.DateTime is dependent on platform and locale. I
> think that it will only work as intended on Windows in an English
> locale, so it will need to be rewritten as well.
>
Ricardo, please replace the GetNow method with this one and let me know
if that works for you.
def GetNow(self):
now = wx.DateTime.Now()
date = now.FormatDate()
time = now.FormatTime()
return date, time
It works.
See image attached.
For a cosmetic reason maybe it's better to change the indent argument to
-1, in the TablePrint.py demo.
for example:
prt.SetHeader("Printed: ", type = "Date & Time", align=wx.ALIGN_RIGHT,
indent = -1, colour = wx.NamedColour('BLUE'))