Newbie problem with Tkinter
RajGopal Srinivasan
raj at grserv.med.jhmi.edu
Sun Nov 5 17:55:08 EST 2000
Change the line
frame.pack()
to
frame.pack(expand='yes', fill='both')
raj
Rick Morneau wrote:
>
> I'm trying to use the <Configure> event in Tkinter, but it always
> returns the exact same width and height regardless of the actual size of
> the frame. Here is a simple example:
>
> #! /usr/local/bin/python
>
> from Tkinter import *
>
> root = Tk()
>
> def callback(event):
> print "New width and height:", event.width, event.height
>
> frame = Frame(root, width=100, height=100)
> frame.bind("<Configure>", callback)
> frame.pack()
>
> root.mainloop()
>
> Every time I resize the window, the result is the same:
>
> New width and height: 100 100
> New width and height: 100 100
> New width and height: 100 100
>
> etc, regardless of the actual size.
>
> Any help would be greatly appreciated. I'm using Python 2.0b2 and
> Tkinter 2.0 on a Redhat 6.1 Linux intel computer. I also tried it using
> Python 1.5.2 and got the same results.
>
> Regards,
>
> Rick
More information about the Python-list
mailing list