tkinter - How to create a tree view with checkboxes in Python -


i've been using tkinter , tix write small program. i'm @ point need tree view checkboxes (checkbuttons) can select items tree view. there easy way this? i've been looking @ ttk.treeview () , looks easy tree view there way insert checkbutton view?

a simple code snippet appreciated.

i'm not limited ttk. do; long have example or docs can make work

enter image description here

import tix  class view(object):     def __init__(self, root):         self.root = root         self.makechecklist()      def makechecklist(self):         self.cl = tix.checklist(self.root, browsecmd=self.selectitem)         self.cl.pack()         self.cl.hlist.add("cl1", text="checklist1")         self.cl.hlist.add("cl1.item1", text="subitem1")         self.cl.hlist.add("cl2", text="checklist2")         self.cl.hlist.add("cl2.item1", text="subitem1")         self.cl.setstatus("cl2", "on")         self.cl.setstatus("cl2.item1", "on")         self.cl.setstatus("cl1", "off")         self.cl.setstatus("cl1.item1", "off")         self.cl.autosetmode()      def selectitem(self, item):         print item, self.cl.getstatus(item)  def main():     root = tix.tk()     view = view(root)     root.update()     root.mainloop()  if __name__ == '__main__':     main() 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -