Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'root': 0.04; 'retrieved': 0.05; 'attributes': 0.07; 'friday,': 0.07; 'omit': 0.07; 'width': 0.07; 'subject:question': 0.08; 'answering': 0.09; 'incorrect': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; '(at': 0.13; 'def': 0.13; '"propagate"': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'resizing': 0.16; 'wrote:': 0.16; 'detect': 0.18; 'widget': 0.18; 'changes': 0.20; '2015': 0.20; 'tkinter': 0.22; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'header:User- Agent:1': 0.26; 'appear': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:# 10': 0.27; 'least': 0.27; 'correct': 0.28; 'skip:( 20': 0.28; 'actual': 0.28; 'question:': 0.29; 'recorded': 0.29; "i'm": 0.30; 'print': 0.30; 'window': 0.30; 'this?': 0.34; 'but': 0.36; 'child': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'button': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'email addr:gmail.com': 0.62; 'charset:windows-1252': 0.62; 'partially': 0.84; 'russell': 0.84; 'size?': 0.84; 'window,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Russell Owen Subject: Re: tkinter resize question Date: Fri, 17 Jul 2015 12:52:33 -0700 References: <21c1f9fb-1af0-4c57-aeba-2c7d78b1e707@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: d-128-208-13-156.dhcp4.washington.edu User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437162765 news.xs4all.nl 2882 [2001:888:2000:d::a6]:57446 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94028 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()