I have following list of text positions with all values being set to '-999'
as default:
List = [(70, 55), (170, 55), (270, 55), (370, 55),
(70, 85), (170, 85), (270, 85), (370, 85)]
for val in List:
self.depth = wx.TextCtrl(panel, -1, value='-999', pos=val,
size=(60,25))
I have indexed list and corresponding values at them such as:
indx = ['2','3']
val = ['3.10','4.21']
I want to replace index locations '2' and '3' with values '3.10' and '4.21'
respectively in 'List' and keep the rest as '-999'. Any suggestions?
Hi,
to manipulate the list elements, you can set directly the respective
positions (zero-based).
lst = list("ABCDEF")
lst
['A', 'B', 'C', 'D', 'E', 'F']
lst[2] = "CCCCCC"
lst
['A', 'B', 'CCCCCC', 'D', 'E', 'F']
however, if you need to work with multiple texctrl widgets, you need
to reference them in some way - either via variables
textctrl_0 = wx.TextCtrl(...)
textctrl_1 = wx.TextCtrl(...)
...
textctrl_1.SetValue(...)
if there are many widgets like this, you can collect them in a dict or
a list and access them from there:
textctrls_dct = {}
textctrls_dct[0] = wx.TextCtrl(...)
textctrls_dct[0].SetValue(...)
hth,
vbr
···
2013/12/20 Ibraheem Khan <ibraheem.khan99@gmail.com>: