X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..922ba68045d84789ab1dfceb4d1aa1b6e2c5e810:/wxPython/demo/pyTree.py?ds=inline diff --git a/wxPython/demo/pyTree.py b/wxPython/demo/pyTree.py index 47283527f1..e463fffa10 100644 --- a/wxPython/demo/pyTree.py +++ b/wxPython/demo/pyTree.py @@ -24,7 +24,7 @@ beautifully documented... """ from wxPython import wx -import string # Don't use it, but it's fun expanding :-) +import sys, string # Don't use it, but it's fun expanding :-) #---------------------------------------------------------------------- @@ -83,6 +83,7 @@ class pyTree(wx.wxTreeCtrl): wx.EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemCollapsed) wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged) self.output = None + self.Expand(self.root) def SetOutput(self, output): @@ -111,6 +112,8 @@ class pyTree(wx.wxTreeCtrl): will again figure out what the offspring is. """ item = event.GetItem() + if self.IsExpanded(item): # This event can happen twice in the self.Expand call + return obj = self.GetPyData( item ) lst = dir(obj) for key in lst: @@ -161,7 +164,8 @@ def runTest(frame, nb, log): This method is used by the wxPython Demo Framework for integrating this demo with the rest. """ - thisModule = __import__(__name__, globals()) + #thisModule = __import__(__name__, globals()) + thisModule = sys.modules[__name__] win = wx.wxFrame(frame, -1, "PyTreeItemData Test") split = wx.wxSplitterWindow(win, -1) tree = pyTree(split, -1, thisModule) @@ -185,7 +189,7 @@ if __name__ == '__main__': def __init__(self): """Make a splitter window; left a tree, right a textctrl. Wow.""" import __main__ - wx.wxFrame.__init__(self, wx.NULL, -1, "PyTreeItemData Test", + wx.wxFrame.__init__(self, None, -1, "PyTreeItemData Test", wx.wxDefaultPosition, wx.wxSize(800,500)) split = wx.wxSplitterWindow(self, -1) tree = pyTree(split, -1, __main__)