tkinter errors out without clear message

2014-05-21 Thread Kai Song
Dear Python community,

I have been trying to make Tkinter work on my Scientific Linux 6 (SL6)
system. The python version is the SL6 default Python/2.6.6, and the tkinter
is also from SL6 repository, tkinter-2.6.6-51.el6.x86_64.

I was able to import _tkinter and Tkinter, and the _test() will bring up an
empty window, but it will then fail without any actual error message. I
think it's when it tries to create buttons. I tried to use python gdb to
debug through the code, but It's hard to pin point the problem.

Here is the output:
[kai@localhost ~ ]$ python
Python 2.6.6 (r266:84292, Nov 21 2013, 12:39:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type help, copyright, credits or license for more information.
 import _tkinter
 import Tkinter
 Tkinter._test()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib64/python2.6/lib-tk/Tkinter.py, line 3757, in _test
label = Label(root, text=text)
  File /usr/lib64/python2.6/lib-tk/Tkinter.py, line 2466, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
  File /usr/lib64/python2.6/lib-tk/Tkinter.py, line 1932, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError


I also tried to build python/2.7.5 from scratch, and this problem still
there. So, I suspect it could be due to system configuration, but without
actual error message, I don't know how to fix this. Did any of you come
across similar issues for Tkinter? Any advice would be greatly appreciated!

Thanks in advance!

Kai

-- 
Kai Song
ks...@lbl.gov 1.510.495.2180
1 Cyclotron Rd. Berkeley, CA94720, MS-50B 3209
High Performance Computing Services (HPCS)
Lawrence Berkeley National Laboratory - http://scs.lbl.gov
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tkinter errors out without clear message

2014-05-21 Thread Kai Song
Hi Terry,

Thanks for your reply!


 Nasty. I have seen TclErrors, but with a message.

 Here is a simple test I just ran (from within Idle) on Win7, 2.7.6.

  import Tkinter as tk
  root = tk.Tk()
  tk.Label(root, text = 'label text').pack()
  tk.mainloop()

 and I see a window with label with text.

 tk._test() works too, with slightly more involved window.


I tried this, but it panics in the same way when running tk.Label(). Again,
I can see an empty window after root=tk.Tk().



 You said you tried 2.7.5. I believe 2.7.6 has some tkinter bug fixes.
 There is also the issue that TkVersion == 8.5 is underspecied -- there are
 multiple bugfix releases. The 2.7 Windows installer has been installing
 8.5.2, which has some bugs, but 2.7.7 will install 8.5.13, which is much
 better.


Sure, I can try with some other combinations of python/tk versions.
However, I tried on other SL6 machines, they have the same version (SL6.5),
and same tests work on those systems. So, the python/2.6.6 and tk-6.5.7
should work...

I can't recall how I set up these systems differently, but I am worried
that there are other non-tk/python related issues... I am just curious if
there are other ways to debug this other than python gdb?

Thanks again for your help!

Kai



-- 
Kai Song
ks...@lbl.gov 1.510.495.2180
1 Cyclotron Rd. Berkeley, CA94720, MS-50B 3209
High Performance Computing Services (HPCS)
Lawrence Berkeley National Laboratory - http://scs.lbl.gov
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tkinter errors out without clear message

2014-05-21 Thread Kai Song
Hi Terry,

I managed to find the problem! As you suggested, I installed newer version
of tk/8.5.15. Then, the same test will still fail, but the error message
has content now. It complains about missing font. I did some google, then
fix it by installing dejavu-sans-fonts.

I laughed when I found the problem, and indeed, this small bug has bothered
me for a whole day.

Thanks again for your help. I would probably spend hours and days before
even think about trying newer version tk. :)

Best,

Kai



On Wed, May 21, 2014 at 1:55 PM, Kai Song ks...@lbl.gov wrote:

 Hi Terry,

 Thanks for your reply!


 Nasty. I have seen TclErrors, but with a message.

 Here is a simple test I just ran (from within Idle) on Win7, 2.7.6.

  import Tkinter as tk
  root = tk.Tk()
  tk.Label(root, text = 'label text').pack()
  tk.mainloop()

 and I see a window with label with text.

 tk._test() works too, with slightly more involved window.


 I tried this, but it panics in the same way when running tk.Label().
 Again, I can see an empty window after root=tk.Tk().



 You said you tried 2.7.5. I believe 2.7.6 has some tkinter bug fixes.
 There is also the issue that TkVersion == 8.5 is underspecied -- there
 are multiple bugfix releases. The 2.7 Windows installer has been installing
 8.5.2, which has some bugs, but 2.7.7 will install 8.5.13, which is much
 better.


 Sure, I can try with some other combinations of python/tk versions.
 However, I tried on other SL6 machines, they have the same version (SL6.5),
 and same tests work on those systems. So, the python/2.6.6 and tk-6.5.7
 should work...

 I can't recall how I set up these systems differently, but I am worried
 that there are other non-tk/python related issues... I am just curious if
 there are other ways to debug this other than python gdb?

 Thanks again for your help!

 Kai



 --
 Kai Song
 ks...@lbl.gov 1.510.495.2180
 1 Cyclotron Rd. Berkeley, CA94720, MS-50B 3209
 High Performance Computing Services (HPCS)
 Lawrence Berkeley National Laboratory - http://scs.lbl.gov




-- 
Kai Song
ks...@lbl.gov 1.510.495.2180
1 Cyclotron Rd. Berkeley, CA94720, MS-50B 3209
High Performance Computing Services (HPCS)
Lawrence Berkeley National Laboratory - http://scs.lbl.gov
-- 
https://mail.python.org/mailman/listinfo/python-list