[Tkinter-discuss] help: _tkinter.TclError appears when calling tkMessageBox.showinfo

Michael Lange klappnase at web.de
Tue Feb 14 12:19:05 CET 2012


Hi,

Thus spoketh focalization <hxs7709 at tom.com> 
unto us on Mon, 13 Feb 2012 18:29:53 -0800 (PST):

> I have searched the web, and can not find any clue about it.
> Please give me some clue about where is the possible root cause of this
> problem?
> Thanks a lot.
> 
> #code
> import Tkinter
> import tkMessageBox
> tkMessageBox.showinfo('aaaaaaaaaa')
> 
> #error
> Traceback (most recent call last):
>   File "/home/xshuang/workspace/CPP/pydemo/src/test.py", line 4, in
> <module> tkMessageBox.showinfo('aaaaaaaaaa')
>   File "/usr/local/lib/python2.7/lib-tk/tkMessageBox.py", line 83, in
> showinfo
>     return _show(title, message, INFO, OK, **options)
>   File "/usr/local/lib/python2.7/lib-tk/tkMessageBox.py", line 72, in
> _show res = Message(**options).show()
>   File "/usr/local/lib/python2.7/lib-tk/tkCommonDialog.py", line 48, in
> show s = w.tk.call(self.command, *w._options(self.options))
> _tkinter.TclError: bad attribute "-type": must be -alpha, -topmost,
> -zoomed, or -fullscreen
> 
> #how to reproduce
> 1. In Fedora 12, no problem appears with default python. 
> But, after using the following command to update python, yum reinstall
> tcl.i686 / tk.i686 / tkinter / tklib, the above problem appears.
> 
> 2. In Windows, no problem appears.
> 

from here it looks like a bug in the Tk version that comes with your
Fedora version update.
Oddly, the error message reported by Tk is the same I get here when I try
to pass an illegal option to a window's wm_attributes command. I have no
idea though why this command should be called in this context. I am not
sure which exactly is the handler in Tk that decides which command to run
when tk_messageBox is called, but it seems to do something weird here.
Maybe you can try and run directly the equivalent Tk code from a
terminal:

    $ wish
    % tk_messageBox -type ok -message "aaaaaaa" -icon info

which is basically what the tkMessageBox Python module does. Does this
produce the same error?

Best regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Spock: The odds of surviving another attack are 13562190123 to 1, Captain.


More information about the Tkinter-discuss mailing list