[Tutor] easygui

Alan Gauld alan.gauld at yahoo.co.uk
Sun Aug 27 04:14:58 EDT 2017


On 27/08/17 03:07, George Sconyers via Tutor wrote:
> Hello all. Need some help with easygui which my son is trying to run for a book he is working in.

I'm not sure what the current status of easygui is, I read
somewhere that it had been discontinued. But if you are
still finding a download for 2.7 then it should
presumably work... Ok, I see that the code is still
available, and being Tkinter based should still work
but the project was frozen in 2013.

> Using Python 2.7 we downloaded easygui and put it in an executable path. 
> Code is:import easyguieasygui.msgbox("Hello there")

The code appears to be mangled by the mail system. I assume you mean

import easygui
easygui.msgbox("Hello there")

> No popup occurs, cusor changes to a cross and no longer process mouse clicks.> When we click on the bash shell the program terminates,

I assume from the bash reference that you are using either Linux
or MacOSX?

> script.py: line 2: syntax error near unexpected token  '"Hello there"
> 'script.py: line 2: 'easygui.msgbox("Hello there")'

How exactly are you running the program?
The message format does not look like a normal Python
traceback message.

BTW you can do very similar style coding to easygui using
raw Tkinter. You need to add the following 4 lines at the
top of your file (this is for Python v3):

import tkinter
import tkinter.messagebox as mb
tk = tkinter.Tk()
tk.withdraw()    # hide the default blank window

Now you can use the various message boxes etc in a
very similar style to easygui:

mb.showinfo("Title here", "Text here")
mb.askyesno("Title", "Are you well?")

dir(mb)

will show the other options available.
You can also import tkinter.filedialog,colorchooser and font.

Just in case you can't get easygui to work.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list