Please send questions to
st10@humboldt.edu .
'''
easyguiEx2.py - playing with easygui, built atop Tkinter
(note that I wimped out and just put the downloaded easygui.py
in the same directory as this example). This variant saves the
choices made in a local file ice_cream_prefs.txt.
(note that this example is adapted from:
http://www.ferg.org/easygui/
adapted by: Sharon Tuttle
last modified: 10-26-06
'''
from easygui import *
import sys
resultsFile = open("ice_cream_prefs.txt", 'a')
while 1:
msgbox("Hello, EasyGui world! - now with file results")
msg = "What is your favorite flavor?"
title = "Ice Cream Survey"
choices = ["Vanilla", "Chocolate", "Strawberry", "Spam", "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
resultsFile.write(str(choice) + "\n");
msgbox("You chose: " + str(choice), "Survey Result")
msg = "Do you want to continue?"
title = "Please Confirm"
# show a confirm/cancel dialog
if ccbox(msg, title):
pass # user chose Continue
else:
resultsFile.close()
sys.exit(0) # user chose Cancel