Greetings,
I was wondering if anyone can suggest a more efficient way writing the following similar methods. I have about 12 of these and would like to reduce their number and optimize my code by removing such redundant methods.
:: guiComT1 & guiComT2 are imported classes from different py files ::
:: speed is not an issue as the largest of the ListBoxes will only have
about 30 or so rows.
...
def onUpdateListBox_T1 (self, name, box):
ct = getattr(self.guiComT1, box).GetItemCount()
ct=+1
ndata = { ct : (name)}
items = ndata.items()
for key, data in items:
index = getattr(self.guiComT1, box).InsertStringItem(ct, data)
getattr(self.guiComT1, box).SetStringItem(index, 0, data)
getattr(self.guiComT1, box).SetItemData(index, key)
def onUpdateListBox_T2 (self, name, box):
ct = getattr(self.guiComT2, box).GetItemCount()
ct=+1
ndata = { ct : (name)}
items = ndata.items()
for key, data in items:
index = getattr(self.guiComT2, box).InsertStringItem(ct, data)
getattr(self.guiComT2, box).SetStringItem(index, 0, data)
getattr(self.guiComT2, box).SetItemData(index, key)
...
Thanks,
Scott
···
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: 6/8/2005