Error with Tkinter and tkMessageBox

F

Fabio Z Tessitore

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
 
K

kyosohma

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
 
F

Fabio Z Tessitore

Il Tue, 31 Jul 2007 19:12:48 +0000, kyosohma ha scritto:
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

You're right. But the problem I have is always there. Tkinter doesn't
work properly and I don't understand why.
Thanks!
 
F

Fabio Z Tessitore

Il Tue, 31 Jul 2007 18:45:57 -0400, jim-on-linux ha scritto:
Try This:

def reply():
showinfo('ciao','hello')

I've tried without success ... thanks

I've also discovered that when I (or some other prog using tkinter)
display menu, the underscore is an ugly little black box. So, tkinter
don't work fine on my machine. What a pity!

thanks, all, bye
 
J

John McMonagle

Fabio said:
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
What window manager are you using ?
 
F

Fabio Z Tessitore

Il Thu, 02 Aug 2007 13:54:46 +1000, John McMonagle ha scritto:

What window manager are you using ?

Hi John,

I'm using gnome, with gdm. Do you think the problem is this? I'm going to
try with another one ...

bye
 
F

Fabio Z Tessitore

I've tried to use Twm and SURPRISE! it works!!!

Can you say why? How can I fix the prob with Gnome?

Thanks
 
J

John McMonagle

Fabio said:
I've tried to use Twm and SURPRISE! it works!!!

Can you say why? How can I fix the prob with Gnome?

Thanks

I don't know why it doesn't work correctly on the version of gnome which
you are running (I run KDE). Perhaps the question needs to be posed to
a gnome group ?
 
F

Fabio Z Tessitore

Il Fri, 03 Aug 2007 12:38:09 +1000, John McMonagle ha scritto:
I don't know why it doesn't work correctly on the version of gnome which
you are running (I run KDE). Perhaps the question needs to be posed to
a gnome group ?

Thank you, very much, John.
Best wishes.

Bye
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top