Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94028
| From | Russell Owen <rowen@uw.edu> |
|---|---|
| Subject | Re: tkinter resize question |
| Date | 2015-07-17 12:52 -0700 |
| References | <21c1f9fb-1af0-4c57-aeba-2c7d78b1e707@googlegroups.com> <dfdf0485-860f-4cfd-ad88-7476554f0291@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.657.1437162765.3674.python-list@python.org> (permalink) |
On 7/17/15 12:17 PM, nickgeovanis@gmail.com wrote:
> On Friday, July 17, 2015 at 1:53:19 PM UTC-5, nickge...@gmail.com wrote:
>> Resizing a tkinter window which contains a frame which contains a button widget, will not change the current size of the window, frame or button as recorded in their height and width attributes (at least not if they are resizable). What is the correct way to detect their current size?
>
> Ok, partially answering my own question:
> The geometry of the window will change (win.geometry()), but the changes do not appear to "propagate" to the retrieved width/height of the child widgets, frames, etc. Or am I incorrect with this?
I'm not seeing it. If I try the following script I see that resizing the
widget does update frame.winfo_width() and winfo_height. (I also see
that the requested width and height are ignored; you can omit those).
-- Russell
#!/usr/bin/env python
import Tkinter
root = Tkinter.Tk()
frame = Tkinter.Frame(root, width=100, height=50)
frame.pack(expand=True, fill="both")
def doReport(*args):
print "frame actual width=%s, height=%s" % (frame.winfo_width(),
frame.winfo_height())
print "frame requested width=%s, height=%s" %
(frame.winfo_reqwidth(), frame.winfo_reqheight())
button = Tkinter.Button(frame, text="Report", command=doReport)
button.pack()
root.mainloop()
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
tkinter resize question nickgeovanis@gmail.com - 2015-07-17 11:53 -0700
Re: tkinter resize question nickgeovanis@gmail.com - 2015-07-17 12:17 -0700
Re: tkinter resize question Russell Owen <rowen@uw.edu> - 2015-07-17 12:52 -0700
Re: tkinter resize question Rick Johnson <rantingrickjohnson@gmail.com> - 2015-07-17 13:06 -0700
Re: tkinter resize question nickgeovanis@gmail.com - 2015-07-17 15:42 -0700
Re: tkinter resize question Terry Reedy <tjreedy@udel.edu> - 2015-07-17 21:20 -0400
Re: tkinter resize question Terry Reedy <tjreedy@udel.edu> - 2015-07-17 18:49 -0400
Re: tkinter resize question nickgeovanis@gmail.com - 2015-07-17 18:31 -0700
Re: tkinter resize question Terry Reedy <tjreedy@udel.edu> - 2015-07-18 01:49 -0400
csiph-web