Tkinter Packing Strangeness: Buttons packed above others
- by Parand
I'm sure I'm doing something obvious wrong here, but I can't see it. I end up with the "Should be on top" label packed at the bottom instead of at the top. What am I doing wrong?
from Tkinter import *
class SelectAction(Frame):
buttons = {}
def callback(self):
print "Callback"
def createWidgets(self):
logo_label = Label(text="Should be on top").pack(fill=X)
for name, text, callback in (
('setup_account', 'Account Settings', self.callback),
('do_action', 'Do Something', self.callback),
):
self.buttons[name] = Button(self, text=text, command=callback).pack(fill=X)
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
if __name__ == "__main__":
root = Tk()
app = SelectAction(master=root)
app.mainloop()
root.destroy()