[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] textboxes and buttons (solved)



Hi,

 >  > > >I suprisingly solved the problem. It was one of encoding.
 >  > > >I replaced:
 >  > > >
 >  > > > self._text = self._text[:self._caret] + event.unicode +  
 >  > > >self._text[self._caret:]
 >  > > >
 >  > > >with
 >  > > >
 >  > > > self._text = self._text[:self._caret] + str(event.unicode) +  
 >  > > >self._text[self._caret:]
 >  > > >
 >  > > >in ocempgui's Editable.py, and everything seems dandy once  
 >  > > >everything is cx_freezed.
 >  > > [...]
 >  > >
 >  > > This will break the box with encodings different from US-ASCII like e.g.
 >  > > ISO-8859-15 (latin-1 with EURO symbol) and various others. Do you
 >  > > have a cx_freze example I can easily use to track that issue down, so
 >  > > that I can fix that error?
 >  > 
 >  > I just tried cx_freze with a small hello world example shipping with
 >  > OcempGUI. Freezing is done just fine (no errors), but the usual
 >  > 'freesansbold.ttf' exception is coming up on running the built
 >  > binary. No matter in which ways I added it to the zip, the built binary
 >  > denies to work.
 >  > 
 >  > Long story short: build process is fine on my side, so I my first guess
 >  > is that the encoding error is raised by your code in some way.
 >  > 
 >  > Regards
 >  > Marcus
 >  
 > > Matthieu TC <matthieutc@xxxxxxxxx>:
 > >
 > > >I suprisingly solved the problem. It was one of encoding.
 > > >I replaced:
 > > >
 > > > self._text = self._text[:self._caret] + event.unicode +  
 > > >self._text[self._caret:]
 > > >
 > > >with
 > > >
 > > > self._text = self._text[:self._caret] + str(event.unicode) +  
 > > >self._text[self._caret:]
 > > >
 > > >in ocempgui's Editable.py, and everything seems dandy once  
 > > >everything is cx_freezed.
 > > [...]
 > >
 > > This will break the box with encodings different from US-ASCII like e.g.
 > > ISO-8859-15 (latin-1 with EURO symbol) and various others. Do you
 > > have a cx_freze example I can easily use to track that issue down, so
 > > that I can fix that error?
 > 
 > I just tried cx_freze with a small hello world example shipping with
 > OcempGUI. Freezing is done just fine (no errors), but the usual
 > 'freesansbold.ttf' exception is coming up on running the built
 > binary. No matter in which ways I added it to the zip, the built binary
 > denies to work.
 > 
 > Long story short: build process is fine on my side, so I my first guess
 > is that the encoding error is raised by your code in some way.
 > 
 > Regards
 > Marcus


I certainly don't touch or change the encoding voluntarily. Although my linux installation has always been tricky about encodings, so it may be a platform problem (e.g. my filenames cannot contain characters with accents).

I tried to input letters with accents and it did throw a "UnicodeEncodeError", which is unfortunate but not a showstopper.

As for the freesansbold.ttf, I solved it by using custom styles, which made the app look only for the fonts I wanted.
-matt