[Python.NET] binding python objects to treenodes

Guy Robinson guy at r-e-d.co.nz
Sun Sep 11 14:38:12 CEST 2005


Hello,

Is there a way to bind a python object to a treeView node? I have the following 
treenode based class:

class dataNode(WinForms.TreeNode):

     def __init__(self,name,total):
         self.Text = name
         self.Total = total

And I add the node as such:

self.treeView1.Nodes.Add(dataNode("testnode",3))

But when I try and access the attributes it doesn't work?

    for node in self.treeView1.Nodes:
       print node.Total

Or should I keep the nodes in a list and access by index?

Any help appeciated.

Guy





More information about the PythonDotNet mailing list