Tkinter and TableList - Configure the Temporary Embedded Widgets

lee.walczak at gmail.com lee.walczak at gmail.com
Wed Aug 20 00:02:02 CEST 2008


I actually post a topic relating to my problem here:

(http://groups.google.co.uk/group/comp.lang.python/browse_thread/
thread/a073d532c4481bfe?hl=en# )

But I thought it could be useful to place an example of my problem
here aswell. This a small piece of testcode that creates a TableList.
When the cell is selected, a ComboBox Widget is used temporarily
during the editing phase. It is during this ( EditStartCmd call) that
I wish to configure the "values" of the Widget. My question is, ""How
do I do this ?""

The code below returns the error when the cell is selected. :

Traceback (most recent call last):
  File "D:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
    return self.func(*args)
  File "D:\PythonWS\TEW Test.py", line 34, in EditStartCmd
    TEW.configure(values=("This","Is","A","Test"))  # Here I "try" to
configure the Temporary Widget
AttributeError: '_tkinter.Tcl_Obj' object has no attribute 'configure'

I has also provided a normal bwidget combox box ( which I use for the
Temporary Embedded Widget). It shows the normal method of configuring
the "values" is working, just the method I assume for embedded ones it
not.

Anyone who has experience in Tkinter & Tablelist would really help me
here. It could be something really silly that I do not appreciate and
any clues would really help!

This will also be posted on http://mail.python.org/mailman/listinfo/tkinter-discuss

----------------------------------

import Tkinter
import bwidget
import tktablelist

root = Tkinter.Tk()
TestFr = Tkinter.Frame(root)
TestBox = bwidget.ComboBox(root)
TestBox.configure( values = ("1","two","4rer"))

class TableBuilder:
    def __init__(self, Frame, Titles):
        self.Table=tktablelist.TableList(Frame,
			editstartcommand=self.EditStartCmd,
            selecttype="cell",
            stretch = "all",
            width=20,
            )
        root.tk.call('tablelist::addBWidgetComboBox')
        self.Table.pack()
        self.BuildTable(Titles)

    def BuildTable(self,Titles):
        I = 0
        for Title in Titles:
            self.Table.insertcolumns("end", 0, Title)
            self.Table.columnconfigure("end",editable='yes',
editwindow="ComboBox")
            I +=1
        for row in range(10):
            self.Table.insert("end","")
            self.Table.rowconfigure("end", text=(row,row+1,row*row))

    def EditStartCmd(self, table, row, col, text):
        TEW = self.Table.editwinpath()                        # Here I
return the Temporary Widget pathname
        TEW.configure(values=("This","Is","A","Test"))  # Configure
the Temp Widget - This is wrong! what is right?

Test = TableBuilder(TestFr,['A','B','C'])
TestBox = bwidget.ComboBox(root)
TestBox.configure( text=" This Works!", values = ("1","two","4rer"))
TestFr.pack()
TestBox.pack()
Tkinter.mainloop()



More information about the Python-list mailing list