mercredi 10 juillet 2019

Why don't my checkbox's return a value when selected?

I want to insert data into a lib based on the selections from a check box but my checkbox never changed the lib address it is assigned to.

i have tried this code outside of a class structure and it works fine, however i think my formatting may be wrong as i had to modify some things for it to work in a class structure but i cant figure out why the checkbox doesn't effect the lib address it is assigned to.

           else:
                self.ph[Manager.index] = IntVar()
                self.chk_btn = Checkbutton(self.top, text ="waddup %s" 
                    %Manager.index, variable = self.ph[Manager.index])

       Button(self.top, text = "Submit", command = lambda arg1 = True : 
       self.create_tabs(arg1)).pack()

       Button(self.top, text = "DESTROY", command = exit).pack(pady = 5)


       def create_tabs(self, arg):
             count = 0
             self.TabS = tk.Tk()                                
             self.TabS.title("TabZZZ")         
             self.tabitha = ttk.Notebook(self.TabS) 
             while count < Manager.index:
                if self.ph[count].get():
                    Manager.tab[count]= ttk.Frame(self.tabitha)        
                    self.tabitha.add(Manager.tab[count], text='waddup %s' %count)      
                    self.tabitha.pack(expand=1, fill="both")  
                    ButtonTest(Manager.tab[count], count)
                count += 1
                Button(self.TabS, text = "DESTROY", command = exit).pack()
                self.TabS.mainloop()

i wand when i run this for the first window to pop up with a bunch of check boxes a select and destroy button, this does work then when you click some of the check boxes i want select to open a new window, TabZZZ, with a tab for each check box selected and a destroy button in those tabs. However currently when you chose some check boxes and hit select it just pulls up a new window with a destroy button and no tabs. i have tried setting the starting value of the ph lib to 1 which causes two tabs to be opened no matter which check boxes are picked when you select.

because of all that i think my mistake is in this line: self.chk_btn = Checkbutton(self.top, text ="waddup %s" %Manager.index, variable = self.ph[Manager.index]) but i am not sure.

Any help or suggestions on things to try would be appreciated!




Aucun commentaire:

Enregistrer un commentaire