473,770 Members | 6,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

custom Tkinter ListBox selectMode

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( '<ButtonReleas e-1>', self.itemClicke d )

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
1 4332
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='mul tiple' 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.zmz 5(17;8(%,5.Z65\ '*9--56l7+-'])"
Jul 21 '05 #2

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

Similar topics

2
3808
by: Nicolas Favre-Félix | last post by:
Hello, I have a little problem using Tkinter: I'd like to make a interface with 3 labels on the left, facing with 3 Entry on the right, a button below Entrys, and a Listbox under all. I could place the Labels and Entrys, but the Listbox is just in column 0, and I want it to take all the width (column 0 + column 1) here is the code: #########################
4
5336
by: Patrick L. Nolan | last post by:
Our Tkinter application has a big ScrolledText widget which is a log of everything that happens. In order to prevent people from making changes, we have it in DISABLED mode except when the program wants to write a new entry. This works OK, except that sometimes we want to copy out of piece of the contents and paste it in another window. When it's DISABLED, it appears that we can't even select a portion of the text. Is this an...
0
1414
by: Jeffrey Barish | last post by:
I have an application that produces two listboxes. I would like to be able to select one of the items in the first listbox and one of the items in the second listbox. However, when I make my selection in the second listbox, the selected item in the first listbox gets deselected. Is there a way to do this? I tried setting selectmode to MULTIPLE, but that option only allows me to select multiple items in one of the listboxes (both of...
2
5138
by: Zhang Le | last post by:
Hello, Is there a quick way to replace the content of a single item in tkinter's listbox? Currently my solution is to first delete the item, then insert a new item at the same position. I think there may be better way. Zhang Le
2
11571
by: Harlin Seritt | last post by:
Whenever I set up something similar: vals = for v in vals: listbox.inset(END, v) I notice that when this listbox is displayed, there is never a default value. How can I make sure that one of the indices is selected by default?
5
2365
by: chad | last post by:
Hi, Im new to C#, and I have a question. I can't figure out how to set the listbox control top select multiple items in a ListBox. I have tried using the following code, but C# VS 2005 PE does not have SelectionMode : listbox.SelectionMode = SelectionMode.MultiExtended;
3
11281
by: Bernard Lebel | last post by:
Hello, Is there an option or a way to allow the selection of multiple entries in the Listbox widget? I could not find any, and would like to allow the end user to select multiple entries. Thanks Bernard
0
1426
by: Svenn Bjerkem | last post by:
Hi, Armed with Programming Python 3rd Edition and Learning Python 2nd edition I try to write an application which I at first thought was simple, at least until I was finished with the GUI and then wanted to start putting some data into it. As you will see, the program is not yet finished but I post what I have so far.
0
964
by: rahulnag22 | last post by:
Hi, I am using a listbox in selectmode = MULTIPLE, I can get the current selected item in the listbox from index = "ACTIVE" , but is there a way to convert this "ACTIVE" to get the current selection index as a number. For multiple selectmode listboxes it returns a tuple of selected indexes, so I would have to write some extra code to get the current active selection index from the tuple, instead I was hoping there would be a way to get...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10057
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.