[Tutor] tkMessageBox options
Dragonfirebane at aol.com
Dragonfirebane at aol.com
Mon Jul 26 23:31:01 CEST 2004
Hello all,
I'm reading a tutorial on Tkinter, but its a little sparing on the details.
It says to change the icon for <tkMessageBox.asquestion> I have to use options,
but it doesn't say how. I tried to implement it myself using different
variations of the code below, but each time I got:
Traceback (most recent call last):
File "C:/Program Files/hello.py", line 16, in -toplevel-
filerror()
File "C:/Program Files/hello.py", line 6, in filerror
if tkMessageBox.askquestion(title="File Error",message="Cannot open this
file:\n%s\nWould you like to open a different file?" % fn, icon='WARNING'):
File "C:\PROGRA~1\lib\lib-tk\tkMessageBox.py", line 91, in askquestion
return _show(title, message, QUESTION, YESNO, **options)
TypeError: _show() got multiple values for keyword argument 'icon'
I don't know what I'm doing wrong or right or where to go from here. Any help
would be appreciated.
def filerror():
try:
fn = raw_input("Name of file to open: ")
fp = open(fn)
except:
if tkMessageBox.askquestion(title="File Error",message="Cannot open
this file:\n%s\nWould you like to open a different file?" % fn, icon='WARNING'):
filerror()
return
else:
for line in fp.readlines():
print line
import tkMessageBox
filerror()
Thanks in advance,
Orri
Email: dragonfirebane at aol.com
AIM: singingxduck
Programming Python for the fun of it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040726/0f16ec34/attachment.html
More information about the Tutor
mailing list