By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,733 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,733 IT Pros & Developers. It's quick & easy.

custom Tkinter ListBox selectMode

P: n/a
Hello,

I've written a simple GUI which contains a listbox to hold some information.
I've found that the click-selection schemes provided by Tkinter are
insufficient for my needs. Essentiall I need to impletement a custom
selectMode. As a first go, I've attempted to implement a click-on-click-off
mode. So for each entry, a click on that entry toggels its selection mode.
A click on any entry does not affect the selection mode of any other entry.

I attempted to implement this by binding

myListBoxWidget.bind( '<ButtonRelease-1>', self.itemClicked )

Where my itemClicked() method determines which item was clicked on then
toggels it's selection state.


So, what's my problem? Well, it doesn't work. The SINGLE selectMode
(default) seems to always take over. I'm tempted to set a simple timer
callback for a short duration which redoes the selection set after the
built-in hander has had a chance to do its thing, but that seems like such a
kludge to me. Any suggestions on how I can implement a custom selectMode?

Thanks for your input.

Ron
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
On Fri, 1 Jul 2005 20:19:20 -0400, Ron Provost <ro****@cox.net> wrote:
Hello,

I've written a simple GUI which contains a listbox to hold some information.
I've found that the click-selection schemes provided by Tkinter are
insufficient for my needs. Essentiall I need to impletement a custom
selectMode. As a first go, I've attempted to implement a click-on-click-off
mode. So for each entry, a click on that entry toggels its selection mode.
A click on any entry does not affect the selection mode of any other entry.


What you describe is exactly the behavior you get when you set selectmode='multiple' on a list box; see:
http://www.tcl.tk/man/tcl8.3/TkCmd/listbox.htm#M57

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])"
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.