[Tutor] tkinter message & button questions
Cranky Frankie
cranky.frankie at gmail.com
Wed Nov 30 15:32:37 CET 2011
Peter Otten <__peter__ at web.de> wrote:
To: tutor at python.org
Subject: Re: [Tutor] tkinter message & button questions
Message-ID: <jb38s2$9gg$1 at dough.gmane.org>
Content-Type: text/plain; charset="ISO-8859-1"
<<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()
>>
Peter thanks again. The msg_widget is still resizing vertically
depending on the lenght of the quote, but at least now the horizontal
sizing is staying the same. Ideally the msg_widget would be the *same
size*, no matter what the quote length is, but since this program is
really just a learning exercise and to show database adminstrators a
simple Python GUI application I can live with it.
The syntax you used, like "root.geometry("400x100")", I have not seen
before, and I've done a lot of searching. Again, much of the tkinter
stuff I see seems to be based on Python 2.6. If there is a definitive
book or reference on using tkinter in Python 3.x I'd really like to
know about it.
Thanks again Peter, Wayne, and everyone else on the tutor list, you
guys are great.
--
Frank L. "Cranky Frankie" Palmeri
More information about the Tutor
mailing list