I want to allow changing in (sorted) list of buttons: self.ADRbuttons=[B1,B2...] REMOVE => button.destroy (it works correctly) ADD is a problem; I don't know how to insert button on correct location in button panel (pack method)
[part of code] class ADRButton(Button): def __init__(self, apObj, data, index, master=None, **d): txt = data[index]["jmeno"] Button.__init__(self, master,text=txt,command=lambda x=index: apObj.selectADR(x), **d) self.pack(fill=X,padx=5, pady=2) class App(Tk): def loadADR(self): self.datADR = (...) ### SORTED LIST, I'm going to use PICKLE for load/save ### def __init__(self, master=None): Tk.__init__(self, master) self.loadADR() self.selectedADR = -1 .... fADR=Frame(self,width=90,bg="#707070") fADR.pack_propagate(0) fADR.pack(side=LEFT,fill=Y) Frame(fADR,height=20,bg="#707070").pack(side=TOP,fill=X,fill=Y) self.ADRbuttons=[] for i in range(len(self.datADR)): self.ADRbuttons.append(ADRButton(self,self.datADR,i,fADR, activebackground="white", anchor='w', justify=LEFT)) .... -- View this message in context: http://old.nabble.com/add-remove-button-in-runtime-tp29254236p29254236.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss