[Tutor] tkinter message & button questions
Peter Otten
__peter__ at web.de
Tue Nov 29 19:39:04 CET 2011
Cranky Frankie wrote:
> I changed the quote program to use the grid manager:
>
> http://www.pastie.org/2939778
>
> Still, the message widget box keeps resizing based on the length of
> the quote. I'm thinking it has to be something to do with the message
> widget itself, not the pack vs. grid manager.
I've no experience with the place layout manager, but the following seems to
be what you want:
root = Tk()
win = Frame(root)
win.place(relheight=1, relwidth=1)
label_widget = Label(win, text="Welcome to Quote of the Day")
label_widget.pack(side=TOP, expand=YES, fill=BOTH)
msg_widget = Message(
win, anchor=NW, justify=LEFT, width=1000, bd=2,
bg="white", relief=SOLID, text=choose_quote())
msg_widget.pack(fill=BOTH)
next_button = Button(win, text="Next Quote", command=display_quote)
next_button.pack(side=LEFT)
quit_button = Button(win, text="QUIT", fg="red", command=quit)
quit_button.pack(side=RIGHT)
root.geometry("400x100")
root.mainloop()
More information about the Tutor
mailing list