473,666 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change the combo box lists as my wish

............... ...
self.diskList = ['3','4','5']
self.cB = wxComboBox(self ,-1,wxDefaultPosi tion,wxDefaultS ize,self.diskLi st)
............... ...

The code is executed initially.
If i want to update only the diskList, what could i do?
Jul 18 '05 #1
1 2423
On Mon, 2004-11-01 at 13:48 +0800, Austin wrote:
............... ..
self.diskList = ['3','4','5']
self.cB = wxComboBox(self ,-1,wxDefaultPosi tion,wxDefaultS ize,self.diskLi st)
............... ..

The code is executed initially.
If i want to update only the diskList, what could i do?


I take it you want the list and the wxComboBox tied together so that
updating the python list automatically updates the wxComboBox. There is
no built-in way to do this. However, you could do something like this:

import wx

class CBList(list):
def __init__(self, combobox):
list.__init__(s elf)
self.combobox = combobox

def __setitem__(sel f, key, value):
list.__setitem_ _(self, key, value)
self.combobox.S etString(key, value)

def __delitem__(sel f, key):
list.__delitem_ _(self, key)
self.combobox.D elete(key)

def append(self, value):
list.append(sel f, value)
self.combobox.A ppend(value)
class MyFrame(wx.Fram e):
def __init__(self, parent, id, title):
wx.Frame.__init __(self, parent, id, title)
cb = wx.ComboBox(sel f, -1)
choices = CBList(cb)

choices.append( 'test 1')
choices.append( 'test 2')
choices[0] = 'replace test 1'
del choices[1]

if __name__ == '__main__':
app = wx.PySimpleApp( )
frame = MyFrame(None, -1, 'test')
frame.Show(True )
app.MainLoop ()
Regards,
Cliff

--
Cliff Wells <cl************ @comcast.net>

Jul 18 '05 #2

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

Similar topics

3
5292
by: Diane Yocom | last post by:
Has anybody ever seen or written code for ASP that would mimic Access' multi-column combo box? Specifically, I have a drop down box that lists about 100 five-digit codes. Each of these codes has a long text description that explains what the code represents. I'd like to be able to show the code plus description when the drop down list is dropped down, but just the code when the list is not displayed, so that I don't have to have a...
2
1989
by: Sami | last post by:
Am not really clear on differences and preferences for looking up person / acct by key number using one of these. Preferred - list or combo? Please explain in detail why. Thanks!
3
2573
by: joni b | last post by:
I need help limiting the options shown in a combo box. I have two combo boxes that appear in a datasheet view subform. The form looks like an Excel spreadsheet, which is what the user prefers. Among the fields in the table are two combo boxes: 1) Product Family 2) Products When the user is adding data, the Products list is easily limited to only the products in the product family using an unbound combo box. I
2
1973
by: taras.di | last post by:
Hi everyone, I've been reading up on how to create a drop down box who's context is dynamically produced based on the value of a previous select box. I've read a lot about some of the browsers not properly readjusting the width of a dynamically produced drop down box, and some browsers having problems adjusting the height and widths (most notably NN). Most solutions involve manually refreshing the browser window and/or padding the...
2
7979
by: Greg Strong | last post by:
Hello All, Is it possible to change table field lookup properties in code? I've been able to change other field properties in code, however so far no luck with field lookup properties. What I've done for test purposes is use a text input file for the table field lookup properties. I thought that I'd start first by just changing the 'Display Control' property. Thanks to Allen Browne for some ideals per...
1
1997
by: Meaney | last post by:
Hi, I have a form with 4 combo boxes. They are used for selecting SchoolName (lists 28 names), LocationName (lists 4 geographic locations), EquipmentName (lists 14 equipment types) and ObservationNumber (lists count number 1-3). All of the the combo boxes contain two columns. The first column is visible and displays the common name that the user can identify. The second column is the bound column and is hidden. This column (2) lists the...
2
12425
by: Eric Layman | last post by:
Hi, I have a radio button and a combo box. Upon changing a value for radio button, the combo box values will be dynamically updated. I have an idea on how to go abt doing it but Im stuck into converting into code.
3
2403
by: sparks | last post by:
This should be easy to do...well I thought so a combo box that needs mult entry types. if the columns are something like this 1 Caucasian 2 Hispanic 3 African American
9
16798
by: frys | last post by:
Access 2003 Windows XP I have a form that is for tracking attendance at programs. the main form is the program information, and the sub form is the attendance information. I have 5 homes and need to switch between each home at any given time. Currently i use a tab form with 5 subforms attached filtering the attendance data for each home. What i wish to do is select a home from a combo/list box and have 1 subform show me the data...
40
2208
by: HSXWillH | last post by:
I have a large query with 6 selection fields that I allow the user to choose any and all from 1 single input form. The 6 option fields on Form SearchForm are: Track, Distance, Surface, Track_Condition, Final_Pos and Race_Type. The 6 particular combo boxes are cboTrack, cboDistance, cboSurface, cboTrkCond, cboFinalPos and cboRaceType. I've set up a query/filter that works using the selection criteria !!etc... in alternating manners so...
0
8449
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, 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...
1
8556
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
8642
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
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...
1
6198
isladogs
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...
0
4198
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
4371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2774
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
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.