"""Enhancement to built-in Tk Listbox.""" # Copyright (C) 1998-1999 Kevin O'Connor # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import Tkinter import string import operator ########################################################################### ############################# My Listbox ############################# class MyListbox(Tkinter.Listbox): """Ughh.. The standard Tk Listbox is essentially useless in its current form. This is an attempt to add at least some functionality.""" def __init__(self, master=None, cnf={}, **kw): defset = {'exportselection':0} #, 'takefocus':0} cnf.update(kw) self.cmd1 = cnf.get('command') if self.cmd1 is not None: del cnf['command'] defset.update(cnf) Tkinter.Listbox.__init__(self, master, defset) if self.cmd1 is not None: btags = self.bindtags() self.bindtags((btags[1], btags[0]) + btags[2:]) self.bind('