0

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):
    flag=0
    if self.drive_w.get()==2:
    flag=1
    oc_files = []
    root_dir = []
    for d in string.ascii_uppercase:
    if os.path.exists('%s:\' % d):
    root_dir.append('%s:\' % d)

        frame3=Frame(self)
        frame3.pack(fill=BOTH)
    
        for dr in sorted(root_dir):
            chk_drive = Checkbutton(frame3, text= dr, variable= self.drive_w)
            chk_drive.pack(side=RIGHT,padx=5,pady=55)
    else:
        "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)

2
Contributors
2
Replies
28
Views
7 Months
Discussion Span
Last Post by Pandey_1
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.