Re: Error with Tkinter and tkMessageBox
- From: kyosohma@xxxxxxxxx
- Date: Tue, 31 Jul 2007 19:12:48 -0000
On Jul 31, 12:30 pm, Fabio Z Tessitore <fabioztessit...@xxxxxxxxx>
wrote:
hi all,
this Tkinter very simple code work fine:
##########################
from Tkinter import *
win = Tk()
win.mainloop()
##########################
but if I try to open a message box, it happens:
Exception in Tkinter callback
Traceback (most recent call last):
File "lib-tk/Tkinter.py", line 1348, in __call__
return self.func(*args)
File "/home/fabio/Desktop/prova.py", line 5, in reply
showinfo(title='ciao', message='hello')
File "lib-tk/tkMessageBox.py", line 84, in showinfo
return _show(title, message, INFO, OK, **options)
File "lib-tk/tkMessageBox.py", line 75, in _show
res = Message(**options).show()
File "lib-tk/tkCommonDialog.py", line 52, in show
s = w.tk.call(self.command, *w._options(self.options))
TclError: bad pad value "2m": must be positive screen distance
##############################
from Tkinter import *
from tkMessageBox import *
def reply():
showinfo(title='ciao', message='hello')
win = Tk()
but = Button(win, text='press me', command=reply)
but.pack()
win.mainloop()
##############################
these are versions:
python: 2.4.4 or 2.5.1
Tkinter.TclVersion: 8.4
Tkinter.TkVersion: 8.4
can anyone help me?
thanks
I'm not sure, but I don't think you need the "win" variable at all. I
can get it to work as follows:
<code>
from Tkinter import *
from tkMessageBox import showinfo
def reply():
showinfo(title='ciao', message='hello')
Button(text='press me', command=reply).pack(fill=X)
mainloop()
</code>
Mike
.
- Follow-Ups:
- Re: Error with Tkinter and tkMessageBox
- From: Fabio Z Tessitore
- Re: Error with Tkinter and tkMessageBox
- References:
- Error with Tkinter and tkMessageBox
- From: Fabio Z Tessitore
- Error with Tkinter and tkMessageBox
- Prev by Date: Re: standalone process to interact with the web
- Next by Date: Re: Plotting Images
- Previous by thread: Error with Tkinter and tkMessageBox
- Next by thread: Re: Error with Tkinter and tkMessageBox
- Index(es):