SetItemPyData() Clarification

Hi Rich,

Rich Shepard wrote:

  With the following,

  def setWidgets(self, msg):
    nat = self.polTree.SetItemPyData(self.natID, self.appData.polNat)
    print 'natID = ', self.natID, '\npolNat = ', self.appData.polNat

I get this in the console:

natID = <wx._controls.TreeItemId; proxy of C++ wxTreeItemId instance at
_e8ff4408_p_wxTreeItemId> polNat = [(u'air_quality',), (u'water_quality',), (u'slope_stability',),
(u'habitats',), (u'ESA_species',), (u'wetlands',), (u'ground_water',),
(u'hydrology',)]

  natID is the ID for that child of the root of the wx.TreeCtrl(), but the
list in polNat does not appear in the tree. I've read the API doc and it
appears that I'm calling Set.ItemPyData() correctly, at least as far as the
number of arguments and their format, but the list is not displayed.

  Another clue stick, please.

Maybe you should have a glass of red instead :wink: , it just about always help me.

I think you misunderstand SetItemPyData, I believe it is like in a listctrl.SetClientData.

SetClientData associates ADDITIONAL information you want to have available later on for that item, it does not show in the listctrl. I use this with listctrl to keep a db reference (i.e. a primary key), I do the same in combobox.

I haven't used the TreeCtrl but in a treeListCtrl I use "AppendItem" and "SetPyData", so looking at the doc for TreeCtrl I would guess you would use "AppendItem" and "SetItemPyData".

I am off for the day and anyhow my other glass of wine is waiting :slight_smile: .

Werner