Tkinter Listbox itemconfigure method
Martin Franklin
martin.franklin at westerngeco.com
Wed May 23 11:15:10 EDT 2001
All,
As the subject says the Tkinter Listbox widget does not support
the itemconfigure method so here is small hack to get it working:-
from Tkinter import *
class MyListbox(Listbox):
def __init__(self, master, **kw):
Listbox.__init__(self, master, kw)
def itemconfigure(self, idx=None, cnf=None, **kw):
"""Configure resources of an item at index=idx.
The values for resources are specified as keyword
arguments. To get an overview about the allowed keyword
arguments call the method without arguments.
"""
if cnf is None and not kw:
cnf = {}
for x in self.tk.split(
self.tk.call(self._w,
'itemconfigure', idx)):
cnf[x[0][1:]] = (x[0][1:],) + x[1:]
return cnf
if type(cnf) == StringType and not kw:
x = self.tk.split(self.tk.call(
self._w, 'itemconfigure', idx, '-'+cnf))
return (x[0][1:],) + x[1:]
self.tk.call((self._w, 'itemconfigure', idx) +
self._options(cnf, kw))
Thanks,
Martin.
More information about the Python-list
mailing list