[Bio-Linux] Biolinux 8, pymol and Tkinter error using the builder function

Tim Booth tbooth at ceh.ac.uk
Wed May 27 09:39:09 EDT 2015


Hi Chiara,

Confirmed this on my machine.  This is a bad bug as it makes a whole
chunk of Pymol functionality unavailable.  As you say, it seems to be an
issue with tkinter, but very specific to calling grid_info(), which is
only used once in the Pymol code.

Therefore, rather than attempt to debug tkinter (which is probably
beyond me!) I've added a workaround patch.  I've also upgraded the Pymol
package from 1.7.0 to 1.7.2.1 while I was at it.  The new package should
appear in the software updater for you now.

If you are interested, here is the patch:

tbooth at balisaur$ cat 32_workaround_grid_info_bug.patch                
--- a/modules/pmg_tk/skins/normal/builder.py
+++ b/modules/pmg_tk/skins/normal/builder.py
 
     def toggleChemProtein(self):
-        if self.chemFrame.grid_info():
-            self.chemB.configure(relief=RAISED)
-            self.chemFrame.grid_forget()
-            self.protB.configure(relief=SUNKEN)
-            self.protFrame.grid(row=1, column=2, rowspan=4, sticky=W)
-        else:
-            self.chemB.configure(relief=SUNKEN)
-            self.chemFrame.grid(row=1, column=2, rowspan=4, sticky=W)
-            self.protB.configure(relief=RAISED)
-            self.protFrame.grid_forget()
+        #Nasty workaround for grid_info bug in Ubuntu 14.04.
+        try:
+            if self.chemFrame.grid_info(): raise TypeError()
+            #If we get to here it means the chemFrame is not active
+            self.protFrame.grid_forget()
+            self.chemFrame.grid(row=1, column=2, rowspan=4, sticky=W)
+            self.protB.configure(relief=RAISED)
+            self.chemB.configure(relief=SUNKEN)
+        except TypeError:
+            self.chemFrame.grid_forget()
+            self.protFrame.grid(row=1, column=2, rowspan=4, sticky=W)
+            self.chemB.configure(relief=RAISED)
+            self.protB.configure(relief=SUNKEN)
 
 ############################################################

Hopefully that sorts it.

Cheers,

TIM

On Wed, 2015-05-27 at 10:55 +0200, chiara cocconcelli wrote:
> Hi all,
> 
> I'm using Biolinux 8 with pymol from the repositories but I am
> encountering a tkinter-related bug. Steps to reproduce:
> 
> 
> 1) open pymol
> 
> 2) in the list of buttons on the right click the Builder one
> 
> 3) in the panel that opens click Protein on the left
> 
> 
> the function is not called and this error is raised:
> 
> Error: 1
> <type 'exceptions.TypeError'> Exception in Tk callback
>   Function: <bound method Builder.toggleChemProtein of
> <pmg_tk.skins.normal.builder.Builder instance at 0x7ffb82e56ea8>>
> (type: <type 'instancemethod'>)
>   Args: ()
> Traceback (innermost last):
>   File "/usr/lib/python2.7/dist-packages/Pmw/Pmw_1_3/lib/PmwBase.py",
> line 1747, in __call__
>     return apply(self.func, args)
>   File
> "/usr/lib/python2.7/dist-packages/pmg_tk/skins/normal/builder.py",
> line 1458, in toggleChemProtein
>     if self.chemFrame.grid_info():
>   File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2000, in grid_info
>     self.tk.call('grid', 'info', self._w))
> <type 'exceptions.TypeError'>: coercing to Unicode: need string or
> buffer, _tkinter.Tcl_Obj found
> 
> 
> I can provide debugging on request and I have a bit of python
> understanding, please let me know how I can best diagnose this problem
> 
> thanks in advance,
> 
> regards
> 
> _______________________________________________
> Bio-Linux mailing list
> Bio-Linux at nebclists.nerc.ac.uk
> http://nebclists.nerc.ac.uk/mailman/listinfo/bio-linux

-- 
Tim Booth <tbooth at ceh.ac.uk>
NERC Environmental Bioinformatics Centre 

Centre for Ecology and Hydrology
Maclean Bldg, Benson Lane
Crowmarsh Gifford
Wallingford, England
OX10 8BB 

http://environmentalomics.org/bio-linux
+44 1491 69 2297




More information about the Bio-linux-list mailing list