Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"The chain which can be yanked is not the eternal chain." -- G. Fitch


devel / comp.lang.python / Re: RE: Problem resizing a window and button placement

SubjectAuthor
o Re: RE: Problem resizing a window and button placementAlan Gauld

1
Re: RE: Problem resizing a window and button placement

<mailman.25.1709036118.3452.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29565&group=comp.lang.python#29565

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: learn2program@gmail.com (Alan Gauld)
Newsgroups: comp.lang.python
Subject: Re: RE: Problem resizing a window and button placement
Date: Tue, 27 Feb 2024 12:15:14 +0000
Lines: 60
Message-ID: <mailman.25.1709036118.3452.python-list@python.org>
References: <06f101da66da$902357f0$b06a07d0$@SGA.Ninja>
<C72A9439-2300-4DCD-8A56-7C3AAE718EF4@barrys-emacs.org>
<070d01da66fa$5faea870$1f0bf950$@SGA.Ninja>
<31caf694-99fd-41ca-a98c-cb0d5d4a758e@tompassin.net>
<077801da6782$4f6046d0$ee20d470$@SGA.Ninja>
<13edcbad-1914-424c-97aa-3679eaf77fd8@mrabarnett.plus.com>
<07b101da6795$97d57df0$c78079d0$@SGA.Ninja>
<5d93173f-b172-408a-a052-c670214581b2@mrabarnett.plus.com>
<07c701da679e$d3a8a6f0$7af9f4d0$@SGA.Ninja>
<dd484037-16c8-b707-89f6-99f327207913@yahoo.co.uk>
<083301da6830$63224480$2966cd80$@SGA.Ninja>
<cd441398-c4d4-4d33-9df7-43163b1d856d@tompassin.net>
<087801da6889$52395bf0$f6ac13d0$@SGA.Ninja>
<1b58d259-699f-dd89-581b-3eecbc4c3e07@yahoo.co.uk>
<000001da68a3$5cf1a830$16d4f890$@SGA.Ninja>
<97753bba-606f-4cac-a48f-64da2db80e65@tompassin.net>
<00c101da694c$71914df0$54b3e9d0$@SGA.Ninja>
<69c809f5-e30c-10f5-5fa1-a623f9647ec5@yahoo.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de b1CQyAWnrvww3WOIVcMqWQ7WUP0EK5iOEU9bmbQUYMcQ==
Cancel-Lock: sha1:D7d36WViLdsNECnAV0iDfs0V3TI= sha256:v8T44s970/h70/Zkybu5lWj3RgUNBtXH5Dvlvvu3DgI=
Return-Path: <learn2program@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=A5JQ8Rde;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.013
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '(which': 0.04;
'(assuming': 0.09; 'moved': 0.09; 'widgets': 0.09; 'window.':
0.09; 'aside': 0.16; 'demonstrated': 0.16; 'flickr': 0.16;
'from:name:alan gauld': 0.16; 'handler.': 0.16; 'message-
id:@yahoo.co.uk': 0.16; 'photo-blog': 0.16; 'program?': 0.16;
'received:mail-wr1-x42c.google.com': 0.16; 'url-
ip:79.170.44.132/32': 0.16; 'url-ip:79.170.44/24': 0.16; 'url-
ip:79.170/16': 0.16; 'url-ip:79/8': 0.16; 'url:alan-g': 0.16;
'url:alan_gauld': 0.16; 'url:alangauldphotos': 0.16; 'wrote:':
0.16; 'values': 0.17; "aren't": 0.19; 'url:amazon': 0.19; 'to:addr
:python-list': 0.20; 'issue': 0.21; 'academic': 0.22; 'code':
0.23; 'to:name:python-list@python.org': 0.24; '(and': 0.25;
'configure': 0.26; '>>>': 0.28; 'suggest': 0.28; 'this?': 0.29;
'header:User-Agent:1': 0.30; 'program': 0.31; 'python-list': 0.32;
'window': 0.32; 'received:192.168.1': 0.32; 'but': 0.32; 'there':
0.33; 'particular': 0.33; 'able': 0.34; 'header:In-Reply-To:1':
0.34; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'possibly': 0.36; 'change': 0.36; 'main': 0.37; 'using': 0.37;
"it's": 0.37; 'author': 0.37; 'received:192.168': 0.37; 'way':
0.38; 'could': 0.38; 'read': 0.38; "we've": 0.39; 'use': 0.39;
'(with': 0.39; 'steve': 0.39; 'still': 0.40; 'alan': 0.40;
'whenever': 0.40; 'learn': 0.40; 'event': 0.40; 'best': 0.61;
'follow': 0.62; 'skip:m 20': 0.63; 'between': 0.63; 'skip:b 10':
0.63; 'our': 0.64; 'accessing': 0.64; 'your': 0.64; 'back': 0.67;
'url-ip:3/8': 0.67; 'url:author': 0.69; 'interest': 0.70; 'site':
0.70; 'them,': 0.70; 'global': 0.73; 'established': 0.80; 'width':
0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1709036116; x=1709640916; darn=python.org;
h=content-transfer-encoding:in-reply-to:references:to
:content-language:subject:user-agent:mime-version:date:message-id
:from:from:to:cc:subject:date:message-id:reply-to;
bh=SmFHWTPQtxVo4YAC3ZtgVlPwJ3amyDJSZTWEAHJizEc=;
b=A5JQ8Rdeg9iC8vXtO0hUWQVex9P+0zgyCmiTGmyIXJ4jv/f+ZZYm8djFyATrheGhIb
w/EgPjcrb4MO5JObb4JDWMf5P9a3Ca/YzPJk1HeKgzEevFC24OSpGOSORoAr8czo4HEr
AETg8ueHcyVpY5WsKSfKMcOQEItoL7iS+Rlfsa7uVEFyUdZuYIvQGH9DLKNmEqqEKfLw
5Qd7wGuSHa913zVJlm1xiffVZDMWcz2KCO+5Js/WsEsTv5/gCRpYsZu0qSkHu3/CrZ83
MS68VVJdPUfzHw5HiXmNIB1SI8GYJSYsNyb9uvsKQ2y2wxL0N+qnRwHz4D64K5wqnK+Z
mMPw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1709036116; x=1709640916;
h=content-transfer-encoding:in-reply-to:references:to
:content-language:subject:user-agent:mime-version:date:message-id
:from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=SmFHWTPQtxVo4YAC3ZtgVlPwJ3amyDJSZTWEAHJizEc=;
b=O/Y84SSKEMsKRbvGtYk91AznGmbqsk+cW4TjVR14OXonpx8cKzK3l2qY5Fb8WoSCCS
kwOfgY/9TucmlHynh8E8JnM/cZ5p45GYgoDBE3gx6iw/v0vRbkeexpvR+gbTE6RmGwZ1
YPPmNXwCRE63bFdtVaMJdDoSfshMhrB+rPRq5F5bs68Ex2JCHagKABBZ6u/IgBQGX6cz
U3jbiBYpdefprkt+kXlp2r7/lAI90GGFpW/8ix2fzK6xSYQs502gMrJbW7P623U2ZVhj
jt50vMLwkH0g+R0qUoDfpkHzhT3tSrsPauyaTIAuxTbn2eniO1NQuupqjBiG3S0Q/G7T
sE3A==
X-Forwarded-Encrypted: i=1;
AJvYcCXbqNCnlfU2N+9blYHJQZKdU4HtmE1WYVjqeaaXZA4VMPf8ZAGX6wptK3oWzBKElZ7gH79K19XtYttGt7PK52qnSoUx2zPh
X-Gm-Message-State: AOJu0YzZrYRvexvkzSvcH9IQfE7wSpQVUVAWcftHDA1VcH8VF6hJ+xqR
wKu0Zn0Aty376ypXtyEcwbbr0hnxDfat9XyVU4fC7TVuPmH+4j6q+W4C7vvlw1E=
X-Google-Smtp-Source: AGHT+IHDQDt6Sa0oR3KNijX1nsmQWHsrRsZri/b6dJn3abjJYnwetXIgKb75hYW8AZgKQfuiKb6WsA==
X-Received: by 2002:a05:6000:1364:b0:33d:27d1:59a1 with SMTP id
q4-20020a056000136400b0033d27d159a1mr6221244wrz.27.1709036116262;
Tue, 27 Feb 2024 04:15:16 -0800 (PST)
X-Google-Original-From: Alan Gauld <alan.gauld@yahoo.co.uk>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.15.1
Content-Language: en-GB
In-Reply-To: <00c101da694c$71914df0$54b3e9d0$@SGA.Ninja>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <69c809f5-e30c-10f5-5fa1-a623f9647ec5@yahoo.co.uk>
X-Mailman-Original-References: <06f101da66da$902357f0$b06a07d0$@SGA.Ninja>
<C72A9439-2300-4DCD-8A56-7C3AAE718EF4@barrys-emacs.org>
<070d01da66fa$5faea870$1f0bf950$@SGA.Ninja>
<31caf694-99fd-41ca-a98c-cb0d5d4a758e@tompassin.net>
<077801da6782$4f6046d0$ee20d470$@SGA.Ninja>
<13edcbad-1914-424c-97aa-3679eaf77fd8@mrabarnett.plus.com>
<07b101da6795$97d57df0$c78079d0$@SGA.Ninja>
<5d93173f-b172-408a-a052-c670214581b2@mrabarnett.plus.com>
<07c701da679e$d3a8a6f0$7af9f4d0$@SGA.Ninja>
<dd484037-16c8-b707-89f6-99f327207913@yahoo.co.uk>
<083301da6830$63224480$2966cd80$@SGA.Ninja>
<cd441398-c4d4-4d33-9df7-43163b1d856d@tompassin.net>
<087801da6889$52395bf0$f6ac13d0$@SGA.Ninja>
<1b58d259-699f-dd89-581b-3eecbc4c3e07@yahoo.co.uk>
<000001da68a3$5cf1a830$16d4f890$@SGA.Ninja>
<97753bba-606f-4cac-a48f-64da2db80e65@tompassin.net>
<00c101da694c$71914df0$54b3e9d0$@SGA.Ninja>
 by: Alan Gauld - Tue, 27 Feb 2024 12:15 UTC

On 27/02/2024 07:13, Steve GS via Python-list wrote:

> Aside from using it to resized
> the window, is there no way to
> know the last value of the
> change for use in the program?

The last value would be the current width.
And you know how to get that as shown in
your configure function:

Ww = root.winfo_width()

> I could write the value to a
> label and read it back later

That's no different to writing it to
global Ww and accessing that as demonstrated
in my last code post (with button).

>>> It's better just to ask tk
> for the values whenever you
> need them, as you do inside
> your handler.
>
> How would that be done?

Ww = root.winfo_width()

Provided you can access the root widget
(which is (nearly?) always true) you
can get the width of the main window.

But can I ask if you have a particular use-case
in mind for this? We started out talking about
relocating some widgets when the window was
resized. We established that the best place
to do that was inside the configure event
handler, with no need to store the width.
(assuming you aren't using a dynamic layout
manager(grid/pack/form) which would be better
still!)

We've now moved on to the more general issue
of communicating values between event handlers
(although still using the width as our exemplar).
Is this just academic interest or do you have
a specific need for this? If we know the need
we might be able to suggest a specific (and
possibly better?)solution.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor