The -before option in pack does in fact work, and would save time regenerating all the widgets.
Mick On Mon, Jul 26, 2010 at 8:41 PM, Russell E. Owen <ro...@uw.edu> wrote: > In article <29254237.p...@talk.nabble.com>, petroff <petr...@seznam.cz> > wrote: > >> 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) >>... > > You could try the "before" option to the pack method. I've not used it > myself and I'm not sure it'll work. > > Personally I would lay out all the buttons every time you remove or > insert one. If you use the grid manager (which I usually use because it > is more flexible than pack): > - keep the buttons in a collection, e.g.: a list of > (button_name, button) so you can sort it by calling the sort method > - to add one, ungrid all in the current collection with grid_remove or > grid_forget (the latter is fine in this case since you're not going to > regrid it in the same place) > - add the new button to the collection > - grid all buttons in the collection > > -- Russell > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss@python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss