473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

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:

#!/usr/bin/python

from Tix import *

class ControlClickTest:

def __init__(self, master):
root = master
modalPane = Toplevel(root)
self.listBox = HList(modalPane)
self.listBox.pack()
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)
root.wait_window(modalPane)

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

if __name__ == "__main__":
ControlClickTest(Tk())
Any ideas?

Peter

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

HList(selectmode="extended")

does all the work for you.

Peter

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jeffgeorge | last post by:
Trying to create multiple acct reports based on the selection in a list box. I've set the list box for multiple selections, and in the report data source, I have a SQL statement which is reading...
2
by: Craig B. | last post by:
I am relativly new to access 2000 and am having some trouble with a report. I am not sure what I want to do is something I can do in access. I want to be able to choose from a combo box multiple...
2
by: Steffen Loringer | last post by:
Hi all, may be an easy question: How can I allow multiple selections in a dropdownlist? Thanks Steffen
1
by: Yvonne | last post by:
We have a Contacts database which categorises our Contacts by three categories eg Country, Language and Skills. It has a combo box ( not bound) which is populated from a union query that gets its...
4
by: tbayse | last post by:
Hello, I have a question about making multiple selection queries in Access. I am running windows XP and Access 2003. Up until this point I had a form where a user would make single selections from...
1
by: Zak | last post by:
Hello, I need some help trying to grab the data selected from a checkboxlist. The checklist is acting like a menu. The first selection is accepted but not the multiple ones. For example is the...
18
by: =?Utf-8?B?TGkgV2VuZw==?= | last post by:
Hi, Is there a way for TreeView to have multiple selections? But I am not talking about its checked boxes. I want a way similar to ListView with MultiSelect = True. So I can use or key and...
0
by: Gunnar Hurtig | last post by:
Hi All I am relatively new to Tkinter and am putting a wraparound to the ATNF ASAP program. In one part I present several long lists in list boxes for selection. My code will remember the multiple...
0
by: Germaris | last post by:
Hi there! Is it possible to make multiple selections in a ComboBox ? i.e. make n consecutive selections and store them in an array or make n selections in the open list of the CB by using (for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.