469,645 Members | 1,971 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Multiple selections in Tix Hlist

I'm trying to implement multiple selection functionality in a Tix Hlist
using a control-click. I've bound control-click to a function that uses
selection_set to add to the selection, but it doesn't seem to work.
Only the last clicked item appears selected (highlighted) in the
display and the return from info_selection only ever contains the last
2 items, rather than all the items I have control-clicked.

It's odd, because if I set up the list and then set up a breakpoint, I
can set multiple selections at the debug command line and it works as I
would expect.

My other problem is that there is no "selection_unset()" method, for
using a control click to individually unselect one item from the list.
There is only selection_clear(), which clears all selections. Am I
missing something?

Below is some sample code:


from Tix import *

class ControlClickTest:

def __init__(self, master):
root = master
modalPane = Toplevel(root)
self.listBox = HList(modalPane)
items = ['1','2','4','6','8']
for item in items:
self.listBox.add(item, itemtype=TEXT, text=item)
self.listBox.bind('<Control-Button-1>', self.ctrlClick)

def ctrlClick(self, event):
print "control click!"
index = self.listBox.nearest(event.y)
print self.listBox.info_selection()

if __name__ == "__main__":
Any ideas?


Jul 19 '05 #1
1 3335
To answer my own question:


does all the work for you.


Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Craig B. | last post: by
2 posts views Thread by Steffen Loringer | last post: by
18 posts views Thread by =?Utf-8?B?TGkgV2VuZw==?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.