Reg:Getting text value of checkbox

Post here if you need help with creating a Graphical User Interface in Python.

Reg:Getting text value of checkbox

Postby Vibha » Thu Sep 19, 2013 3:33 pm


Below is the code for creation of tree view with checkbox dynamically based on path of file given but i am facing problem in reading the text(that is the list of files in a directory) next to checkbox when checkbox is checked in..
Can anyone help me in reading the text next to checkbox?

Code: Select all
import Tix,os
class View(object):
   def __init__(self, root,path):
       self.root = root
   def makeCheckList(self,path): = Tix.CheckList(self.root,browsecmd=self.selectItem)
       abspath = os.path.abspath(path)
       root_node ="CL1", text=abspath)
       self.process_directory(root_node, abspath)"CL1", "off")
   def process_directory(self, parent, path):
       i = 1
       for p in os.listdir(path):
           abspath = os.path.join(path, p)     
           isdir = os.path.isdir(abspath)
           oid =".Item"+str(i), text=p)
 ".Item"+str(i), "off")
           i = i + 1
           if isdir:
               self.process_directory(oid, abspath)
   def selectItem(self, item):
       print item,
def main():
   root = Tix.Tk()
   project_path = "path of file"//Give the path
   view = View(root,path=project_path)
if __name__ == '__main__':
Last edited by stranac on Thu Sep 19, 2013 3:55 pm, edited 1 time in total.
Reason: Added code tags, locked post
Posts: 2
Joined: Thu Sep 19, 2013 3:26 pm

Return to GUI

Who is online

Users browsing this forum: No registered users and 1 guest