[chimera-dev] Programming a Table
Darren Weber
dweber at cgl.ucsf.edu
Wed Nov 3 09:42:57 PDT 2010
Hi Elisabeth,
I'm not entirely clear about what the problem is in the traceback.
I do see a potential problem in your assignment to 'b'. I would use:
b = []
for a in chimera.selection.currentAtoms():
b.append(a.serialNumber)
I hope that helps.
Take care,
Darren
On 11/03/2010 08:22 AM, Elisabeth Ortega wrote:
> Dear all,
>
> I'm trying to do a script that shows in a table an array of numerical
> values.
> One little script that shows what I'm trying to do is:
>
> from chimera import runCommand as run
>
> run("sel")
> b=[]
> for a in chimera.selection.currentAtoms():
> b=a.serialNumber
>
> from CGLtk.Table import SortableTable
>
> t=SortableTable(b)
> t.addColumn("serial", "Serial", format=None)
> t.setData(b)
> t.launch()
>
> With this little script I'm trying to show in a column of the table
> the serial number of the atoms of my system. But when I execute that,
> I got a message in the Python Shell that says:
>
> Traceback (most recent call last):
> File "/home/eortega/intento-tabla.py", line 11, in <module>
> t=SortableTable(b)
> File "CHIMERA/share/CGLtk/Table.py", line 489, in __init__
> File "CHIMERA/lib/python2.5/lib-tk/Tkinter.py", line 2442, in __init__
> Widget.__init__(self, master, 'frame', cnf, {}, extra)
> File "CHIMERA/lib/python2.5/lib-tk/Tkinter.py", line 1923, in __init__
> BaseWidget._setup(self, master, cnf)
> File "CHIMERA/lib/python2.5/lib-tk/Tkinter.py", line 1901, in _setup
> self.tk <http://self.tk> = master.tk <http://master.tk>
> AttributeError: 'int' object has no attribute 'tk'
>
> And I don't understand it. How can I build successfully my table?
>
> Thank you very much
>
> Best
> Elisabeth Ortega
> Universitat Autònoma de Barcelona
>
>
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
>
More information about the Chimera-dev
mailing list