Python 3 and easygui problem

P

Peter Anderson

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:

from easygui import *
import sys

while 1:
msgbox("Hello, world!")

msg ="What is your favorite flavor?"
title = "Ice Cream Survey"
choices = ["Vanilla", "Chocolate", "Strawberry", "Rocky Road"]
choice = choicebox(msg, title, choices)

# note that we convert choice to string, in case
# the user cancelled the choice, and we got None.
msgbox("You chose: " + str(choice), "Survey Result")

msg = "Do you want to continue?"
title = "Please Confirm"
if ccbox(msg, title): # show a Continue/Cancel dialog
pass # user chose Continue
else:
sys.exit(0) # user chose Cancel

I have changed the easygui source to Python 3 'import' and 'print'
requirements and the initial message box in the above script displays
fine fine. However the subsequent message boxes do not display and after
the script completes I get the following error message:

---------- Python 3 ----------
Traceback (most recent call last):
File "easyguidemo.py", line 10, in
choice = choicebox(msg, title, choices)
File "C:\Python30\lib\site-packages\easygui.py", line 703, in choicebox
return __choicebox(msg,title,choices,buttons)
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

Output completed (7 sec consumed)
------------------------------

Fixing this is a bit beyond my skills and I was wondering whether anyone
has any thoughts.

I am happy to post a copy of my revised easygui.py script.

Regards,
Peter
--
*Peter Anderson*
There is nothing more difficult to take in hand, more perilous to
conduct, or more uncertain in its success, than to take the lead in the
introduction of a new order of things—Niccolo Machiavelli, /The Prince/,
ch. 6
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top