Column not updating in listbox in wxPython example ??

David Poundall david at jotax.com
Fri Nov 18 04:31:58 EST 2005


In the following example the phone number does not apear in the phone
column of the llistbox.  Can anybody tell me what I am doing wrong here
?

from wxPython.wx import *

class MyApp (wxApp) :
   def OnInit (self) :
      frame = MyFrame(NULL, -1, "Phone List")
      frame.Show(true)
      self.SetTopWindow (frame)
      return true

class MyFrame (wxFrame) :
   def __init__ (self, parent, ID, title) :

     self.lc = wxListCtrl(self,15,wxDLG_PNT(self,10,60),
           wxDLG_SZE(self,120,75),   style=wxLC_REPORT)
      EVT_LIST_ITEM_SELECTED(self,15,self.getSelect)
      self.lc.InsertColumn(0,"Name")
      self.lc.InsertColumn(1,"Phone")
      name = 'Peter'
      phone = '01753 865830'
      row = 1
      self.lc.InsertStringItem(row, name)
      self.lc.SetStringItem(row, 1, phone)

   def getSelect (self, event) :
      self.currentSel = event.m_itemIndex

app = MyApp(0)
app.MainLoop()




More information about the Python-list mailing list