Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

With all the fancy scientists in the world, why can't they just once build a nuclear balm?


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.20.1708938241.3452.python-list@python.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=25376&group=comp.lang.python#25376

  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: Mon, 26 Feb 2024 09:03:57 +0000
Lines: 52
Message-ID: <mailman.20.1708938241.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>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de QDJrHscs1KJh8fhV6TYE7AtWO7VCqu/xyRNwZPxfoLwg==
Cancel-Lock: sha1:ZGF2poi7L9BiQKiTKFeBKAOQOVw= sha256:750qbmJLncWMi+O6nmjKlZGqR76TT9kjPtloFaf8VS4=
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=P/W9VkDP;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.015
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'def': 0.04; 'tkinter':
0.07; 'other.': 0.09; 'import': 0.15; 'flickr': 0.16;
'from:name:alan gauld': 0.16; 'message-id:@yahoo.co.uk': 0.16;
'photo-blog': 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; 'value?': 0.16; 'wrote:': 0.16;
'url:amazon': 0.19; 'to:addr:python-list': 0.20; 'code': 0.23;
'idea': 0.24; 'to:name:python-list@python.org': 0.24; 'cannot':
0.25; 'function': 0.27; 'example,': 0.28; 'header:User-Agent:1':
0.30; 'program': 0.31; 'python-list': 0.32; 'received:192.168.1':
0.32; 'but': 0.32; 'there': 0.33; 'able': 0.34; 'header:In-Reply-
To:1': 0.34; 'received:google.com': 0.34; 'close': 0.35;
'from:addr:gmail.com': 0.35; 'author': 0.37; 'others': 0.37;
'received:192.168': 0.37; 'added': 0.39; 'steve': 0.39; 'still':
0.40; 'alan': 0.40; 'learn': 0.40; 'event': 0.40; 'follow': 0.62;
'skip:o 20': 0.63; 'pass': 0.64; 'skip:r 20': 0.64; 'back': 0.67;
'outside': 0.67; 'discovery': 0.69; 'url:author': 0.69; 'site':
0.70; 'global': 0.73; 'demand.': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1708938239; x=1709543039; 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=86IO4y01UNlUpLZJ19CiOFZq3x1niUcx8fxo7gdThr8=;
b=P/W9VkDPwnbSnpr0y9tA+4Ahogl9CC2+mR6ul6SRunYKHG/zfS8sBtTf3uHvGXVjFv
AtpwddxSOuFRPa7neAF1JCYAGYCu2vHSwyLsSoJHRQ0q/YijilJJ3lly5FJf9Bxylmq6
4Bq/GMwAv/u06O52FxDHawDXPN1nablE4YgZGWion7WM0VKVVa9Oov3pGGdGxIrEasjo
ehlxOtfCO9lje8ZTEWQjFW7XEIHmb8dYFaulqBdjuyWtKZ4Y/WSNp88hqTsYVfW8b2Yl
ztwpLcxfUIeV1dLm2EK4eJHI3sfeFZxSMaLYdqSaQhfbL7UP78ROl4zB70PF1O5L92ac
9SrQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1708938239; x=1709543039;
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=86IO4y01UNlUpLZJ19CiOFZq3x1niUcx8fxo7gdThr8=;
b=lcaIin4prIDRWIwszNeUsqKB5Y062b3qSkfj8sRwfNT9FcB+dagmvnpwMDPDawDCbv
84hexjCzLgk9GJMwPDJY4D38OHMj6ayuga1/+M8/dgVsz9eHi+LONu3l2zEAQxVpnrN6
ufmRiGEQoQ7dfiC3GcC/hgUGEiH+ubaHsZDO4X/dfwNQwGS0RMl12wuwoJjDOcgwhTGB
FFw2LStIUHdg5dVIWurNistHMmVydFC4T3mQHneQh2juYqzSOOFO3JfRTFp4ltyLzI3x
Q8S1HXAXfucoB4Ayb6CJmKm91ZSXWuncEKbdm5tHY/YQ+2ebx2XDluID1RUVFNNOUFKG
FreQ==
X-Forwarded-Encrypted: i=1;
AJvYcCVUfDAwh7jBCVaa2SEXWv5sStM3AdNDW+4IHg2xSZ54xd4FJa1zZzSISi1x3prJM4w6gbeEIh2hnpLVyOW3ImbDWSa853rR
X-Gm-Message-State: AOJu0YxNFLt6fj6ZVsiEaPYp32iRYhx6j4SQv+HQzHxKGc80j/Kj1Tbx
Wyl0ZyHyUovtCYrvck6MycT4emrpHw5opqc2YztyniXOyJXQiv1oT8+K0CC429M=
X-Google-Smtp-Source: AGHT+IGg84/K4pIeH2814o2M7jT9Fkr26OdBcOR8dzgHaBCXZlRz4AsUT37sWhaDXY0BqzpUZwlKLQ==
X-Received: by 2002:a05:600c:3548:b0:412:a338:f55a with SMTP id
i8-20020a05600c354800b00412a338f55amr2247546wmq.21.1708938238883;
Mon, 26 Feb 2024 01:03:58 -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: <087801da6889$52395bf0$f6ac13d0$@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: <1b58d259-699f-dd89-581b-3eecbc4c3e07@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>
 by: Alan Gauld - Mon, 26 Feb 2024 09:03 UTC

On 26/02/2024 07:56, Steve GS via Python-list wrote:

> Then there is that discovery
> element: Why is my original
> idea not working? I still
> cannot pass the value back
> from the function. What is
> different about this function
> that others would have given
> me the value?

There is nothing different, see the code below.
print() is a function like any other.
In this case it is called after you close the
window, ie after mainloop() exits.
But any other function called inside
mainloop - eg any other event handler can
also access it.

For example, if you added a button:

def printW(): print("Button Ww = ", Ww)

bw = tk.Button(root, text="Print Width", command=printW)
bw.pack()

You would be able to print the value on demand.

>> import tkinter as tk
>>
>> Ww = None
>>
>> def on_configure(*args):
>> global Ww
>> Ww = root.winfo_width()
>> print("Ww Inside =<"+str(Ww)+">")
>>
>> root = tk.Tk()
>> root.bind('<Configure>',on_configure)
>> root.mainloop()
>>
>> print("Ww Outside = <"+str(Ww)+">")

--
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