There is one application where two radio buttons are available.i.e default and custom. If custom is selected then one panel will be visible which contain available drives list of not selected checkbox which are generated based on list but while i am doing such things it generate checkbox many time while i am selecting custom again and again.It must be generated only once.if i select default radio then panel should be not visible.

  1. How to make panel in tkinter or which widget will be used to hide and show checkbox?
  2. how to generate check button on window properly?

    def drive_select(self):
    if self.drive_w.get()==2:
    oc_files = []
    root_dir = []
    for d in string.ascii_uppercase:
    if os.path.exists('%s:\' % d):
    root_dir.append('%s:\' % d)

        for dr in sorted(root_dir):
            chk_drive = Checkbutton(frame3, text= dr, variable= self.drive_w)
        "do something"

    self.drive_w = IntVar()
    self.drive_w.set(1) # Default value i.e. Default drive
    sscan =[("Default",1),("Custom",2)]

    for txt,val in sscan:
    radiobtn_scan = Radiobutton(frame2,text=txt,variable=self.drive_w,value=val,command=self.drive_select)
    radiobtn_scan.pack(side=LEFT, padx=5, pady=5)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.