Hi,
I am a newbie in wxPython and doing a program with ListBox,
I want to select and deselect items in this box,
I have use
self.devlist = wx.ListBox(self , style=wx.LB_MUL TIPLE)
self.Bind(wx.EV T_LISTBOX, self.select_dev , self.devlist)
to create this box, but don't know how to implement self.select_dev
to find out which one is clicked
deselect it, if it was selected ( this is not working at default)
select it, if it was not (toggle)
The default behavior is, the selection is increasing, I can't deselect
any of them.
Thanks.
Lingyun 1 4605
On Aug 11, 2:53 am, Bailu <lingyun.y...@g mail.comwrote:
Hi,
I am a newbie in wxPython and doing a program with ListBox,
I want to select and deselect items in this box,
I have use
self.devlist = wx.ListBox(self , style=wx.LB_MUL TIPLE)
self.Bind(wx.EV T_LISTBOX, self.select_dev , self.devlist)
to create this box, but don't know how to implement self.select_dev
to find out which one is clicked
deselect it, if it was selected ( this is not working at default)
select it, if it was not (toggle)
The default behavior is, the selection is increasing, I can't deselect
any of them.
Thanks.
Lingyun
You should look at the wxPython demo's code for the wx.ListBox. It
looks like they use the wx.EVT_LISTBOX event. See below:
<code>
# this writes to a multiline TextCtrl
self.log.WriteT ext('EvtListBox : %s, %s, %s, %s\n' %
(event.GetStrin g(),
event.IsSelecti on(),
event.GetSelect ion(),
event.GetClient Data()))
</code>
I'm not sure, but I think it uses the SetSelection() method to select
an item, which seems to deselect the previously selected item...at
least, that's how I interpret the demo.
The demo is here: http://wxpython.org/download.php
If you need additional help, try posting to the wxPython User's group: http://wxpython.org/maillist.php
Regards,
Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrew |
last post by:
Hi I just started learning wxPython
I wanted to know how I could do this in wxPython
self.listbox.delete(0, END)
for item in self.results:
self.listbox.insert(END, item)
|
by: GJP |
last post by:
Hello.
I have two list boxes. One with a picture name, and one for the ID of that
picture (both coming from a database).
The user selects the name of the picture and presses a button, the picture
and the picture ID are then moved to other list boxes. This works ok, but
once this has been done, i dont want to delete the item from the origional
listbox, i just want to deselect it, but i cant seem to do this.
|
by: Bill Nguyen |
last post by:
I would like to be able to do the following:
Listbox1/Textbox1 contains list of all items not selected
item A
item B
item D
Listbox2//Textbox2 contains list of all items selected
|
by: deepagulati |
last post by:
Hi,
I need an urgent help from you.
When we dynamically genrate any list box (Select Box) it shows one
default value as selected.
Is there any way that we can deselect that value.
I tried with document.form_Name.ListBox_Name.options.selected =
|
by: dev.amit |
last post by:
Hello friends
Can anyone tell me how to deselect the item selected in the list box
If Me!lb_test_property.ItemsSelected.Count > 0 Then
For Each varItem In Me!lb_test_property.ItemsSelected
Me!lb_test_property.ItemsSelected = ########
Next varItem
End If
i want to know the code for the ### marked area
Thanks in advance
| |
by: shuf |
last post by:
Hello,
I am running python 2.4.4 with wxpython 2.6 on Fedora 6. I am trying to set the font color of individual elements in a listbox, but I am not able to with SetItemForegroundColour() (this method does not appear to do anything):
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# generated by wxGlade 0.4.1 on Thu Mar 22 12:15:29 2007
import wx
|
by: rahulnag22 |
last post by:
Hi,
Is it possible to have different items in a listbox in different
colors? Or is it just one color for all items in a listbox?
Thanks
Rahul
|
by: Marcpp |
last post by:
Hi, I need add to a listbox a list of items extracted from a database.
This is that I've do:
class tasques(wx.Frame):
def __init__(self, *args, **kwds):
.....
self.list_box_1_copy = wx.ListBox(self, -1, choices=,
style=wx.LB_SINGLE|wx.LB_ALWAYS_SB)
....
|
by: Soren |
last post by:
Hi,
Id like to make my own special listbox.. I want to able (at the push
of a button) to add another item to my special listbox... each item is
a panel with a label, some buttons and maybe a text control.
I've tried adding a new panel object with the stuff i want to the
sizer i'm using for my listbox (which is a panel which can contain
other panels)... and then run update() and refresh() on everything...
But it doesn't work.. i see a...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
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...
|
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,...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |
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...
| |