473,396 Members | 1,714 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,396 software developers and data experts.

How to change the combo box lists as my wish

..................
self.diskList = ['3','4','5']
self.cB = wxComboBox(self,-1,wxDefaultPosition,wxDefaultSize,self.diskList)
..................

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

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__(self)
self.combobox = combobox

def __setitem__(self, key, value):
list.__setitem__(self, key, value)
self.combobox.SetString(key, value)

def __delitem__(self, key):
list.__delitem__(self, key)
self.combobox.Delete(key)

def append(self, value):
list.append(self, value)
self.combobox.Append(value)
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title)
cb = wx.ComboBox(self, -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
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...
2
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
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....
2
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...
2
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...
1
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...
2
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...
3
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
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...
40
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
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...

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.