def main(self, standalone=False): """Create interactive browser window. keyword arguments standalone -- Set to true, if the browser is not attached to other windows """ window = _Tkinter.Tk() sc = _TreeWidget.ScrolledCanvas(window, bg="white",\ highlightthickness=0, takefocus=1) sc.frame.pack(expand=1, fill="both") item = _ReferrerTreeItem(window, self.get_tree(), self) node = _TreeNode(sc.canvas, None, item) node.expand() if standalone: window.mainloop()
def test2(): # test w/o scrolling canvas root = Tk() root.configure(bd=0) canvas = Canvas(root, bg="white", highlightthickness=0) canvas.pack(expand=1, fill="both") item = FileTreeItem(os.curdir) node = TreeNode(canvas, None, item) node.update() canvas.focus_set() #if __name__ == '__main__': # test() import tkinter as tk from idlelib import TreeWidget if __name__ == '__main__': root = tk.Tk() root.configure(bd=0) canvas = tk.Canvas(root, bg="white", highlightthickness=0) canvas.pack(expand=1, fill="both") item = TreeWidget.FileTreeItem("/") #item=['1','2','3'] node = TreeWidget.TreeNode(canvas, None, item) node.update() canvas.focus_set() root.mainloop()
pass rootObj = MyRootObj() # attach EDM objects to Root object if they are not in the ignore list for key in objList.keys(): name = objList[key] try: exec 'con = PyKernel.retrieve(g.%s,"%s")' % (name, key) setattr(rootObj, key, con) except: pass # start Tk session root = Tk() root.title(os.path.basename(sys.argv[0])) root.configure(bd=0) sc = TreeWidget.ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1) sc.frame.pack(expand=1, fill="both") item = RootItem('/', rootObj, True) item.GetText() node = TreeWidget.TreeNode(sc.canvas, None, item) node.update() root.mainloop()