| 1 | |
| 2 | from wxPython.wx import * |
| 3 | |
| 4 | class someData: |
| 5 | def __init__(self, data="spam"): |
| 6 | self.data = data |
| 7 | |
| 8 | class errApp(wxApp): |
| 9 | def OnInit(self): |
| 10 | frame = wxFrame(NULL, -1, "Close to get an error", wxDefaultPosition, |
| 11 | wxSize(200,200)) |
| 12 | |
| 13 | tree = wxTreeCtrl(frame, -1, wxDefaultPosition, wxDefaultSize) |
| 14 | |
| 15 | root = tree.AddRoot("Spam") |
| 16 | tree.SetPyData(root, someData()) |
| 17 | #tree.SetPyData(root, "A string") |
| 18 | #tree.SetPyData(root, ["a list", "A string"]) |
| 19 | |
| 20 | frame.Show(true) |
| 21 | self.SetTopWindow(frame) |
| 22 | self.frame = frame |
| 23 | return true |
| 24 | |
| 25 | |
| 26 | app = errApp(0) |
| 27 | app.MainLoop() |
| 28 | print "got to the end" |
| 29 | |