tkinter + unicode + bug or feature??

Bob van der Poel bvdpoel at kootenay.com
Fri Jan 24 15:01:16 EST 2003


Jp Calderone wrote:
> On Fri, Jan 24, 2003 at 11:28:19AM -0700, Bob van der Poel wrote:
> 
>>[snip]
>>
>>So, can I force tkinter to return non-unicode strings? Or can I write a 
>>function to convert all my Entry widget strings to be non-unicode. And, 
>>I am dreaming that this is a new problem? I recently upgraded my Linux 
>>box to mandrade 9.0 and it has installed python 2.2.1.
>>
> 
> 
>   Python MegaWidgets provides an EntryField class that lets you specify
> arbitrary validation functions for the input.  You could use it, or write
> your own mini-subclass of Entry that -just- prevents unicode input, and then
> use that class instead of Entry.  I'm not aware of a solution that will let
> you continue using Tkinter.Entry and not get unicode input (at least, one
> that isn't a dirty hack).
> 
>   Jp
> 

Okay. I'll have to look at the MegaWidget stuff later. I'm just thinking 
that doing something like string=entrywidget.get().encode('iso8859-1') 
should do the trick. Not sure, though, what encoding to use. Is there a 
pythonic way to determine the best to use?


-- 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bvdpoel at kootenay.com
WWW:   http://www.kootenay.com/~bvdpoel





More information about the Python-list mailing list