Quantcast

help: _tkinter.TclError appears when calling tkMessageBox.showinfo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

help: _tkinter.TclError appears when calling tkMessageBox.showinfo

focalization
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.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: help: _tkinter.TclError appears when calling tkMessageBox.showinfo

Michael Lange
Hi,

Thus spoketh focalization <[hidden email]>
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.
_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: help: _tkinter.TclError appears when calling tkMessageBox.showinfo

focalization
Hi, Michael:

Thanks a lot, the same problem appears when running the equivalent  tk code:
    $ wish
    % tk_messageBox -type ok -message "aaaaaaa" -icon info
Seems the tk does not run correctly in my environment.
If possible, please give me more clue about this problem.
I will get back to you after getting to learn more knowledge about tk:)

Best regards
Focalization



>
> 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?


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: help: _tkinter.TclError appears when calling tkMessageBox.showinfo

focalization
The possible reason has been found (still not clear about the root cause).
Multiple tk in my environment lead to some collision.

There have 3 tk in my environments:
/usr/local/lib/tk8.5 with 8.5.11
/usr/lib/tk8.5 with 8.5.11
/usr/share/tk8.5 with 8.5.7, which should be installed by rpm in fedora

So, after I remove the /usr/local/lib/tk8.5 and /usr/lib/tk8.5, the code works now.
Also the code for wish from Michael works, also.
    tk_messageBox -type ok -message "aaaaaaa" -icon info
Loading...