Python 3 and easygui problem

Chris Rebert clp2 at rebertia.com
Sun Feb 22 16:41:39 EST 2009


On Sun, Feb 22, 2009 at 1:20 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> Chris Rebert wrote:
>>
>> On Sat, Feb 21, 2009 at 8:46 PM, Peter Anderson
>> <peter.anderson at internode.on.net> wrote:
>>>
>>> I have just installed Python 3. I have been using Tkinter and easygui
>>> (with
>>> Python 2.5.4) for any GUI needs. I have just started to port some of my
>>> existing scripts to Python 3 and discovered problems with easygui.
>>>
>>> I was using the following script for testing:
>>
>> <snip>
>>
>>> File "C:\Python30\lib\site-packages\easygui.py", line 824, in __choicebox
>>> choices.sort( lambda x,y: cmp(x.lower(), y.lower())) # case-insensitive
>>> sort
>>> TypeError: must use keyword argument for key function
>>
>> Change the line to
>>
>> choices.sort(key=lambda x,y: cmp(x.lower(), y.lower()))
>
> The key function must take one arg, not two, as with Gabriel's solution:
> str.lower.

Yeah, I was too quick on the trigger and mixed up key and cmp.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list