Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

6 May, 2024: The networking issue during the past two days has been identified and appears to be fixed. Will keep monitoring.


devel / comp.lang.python / Re: Python3.6 tkinter bug?

SubjectAuthor
o Re: Python3.6 tkinter bug?Peter Smith

1
Re: Python3.6 tkinter bug?

<db3ef6e1-e87a-45e3-afea-c3e2c874bf49n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:ad4:5dc8:0:b0:4ac:7fff:4360 with SMTP id m8-20020ad45dc8000000b004ac7fff4360mr3082239qvh.69.1663862778847;
Thu, 22 Sep 2022 09:06:18 -0700 (PDT)
X-Received: by 2002:a05:6870:c59d:b0:12c:25bc:f205 with SMTP id
ba29-20020a056870c59d00b0012c25bcf205mr2490947oab.177.1663862778561; Thu, 22
Sep 2022 09:06:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Thu, 22 Sep 2022 09:06:18 -0700 (PDT)
In-Reply-To: <mailman.225.1485950123.2473.python-list@python.org>
Injection-Info: google-groups.googlegroups.com; posting-host=92.2.216.98; posting-account=BHTQAQoAAACjfX20gBP6Fd6x83_as5Ca
NNTP-Posting-Host: 92.2.216.98
References: <CABie7_pjhkKRUmKWhpr-LTwSXqzGjZ8-YbbghYLRXmJ2YKTTmA@mail.gmail.com>
<mailman.208.1485890342.2473.python-list@python.org> <o6r3a7$ei1$1@dont-email.me>
<f332c3ae-958f-0c9c-8e25-b7d6486d605c@mrabarnett.plus.com>
<mailman.218.1485903766.2473.python-list@python.org> <0780ab80-b8de-90cb-4f78-7e1ee5611af7@udel.edu>
<o6rvj7$jm8$1@dont-email.me> <mailman.225.1485950123.2473.python-list@python.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <db3ef6e1-e87a-45e3-afea-c3e2c874bf49n@googlegroups.com>
Subject: Re: Python3.6 tkinter bug?
From: home....@gmail.com (Peter Smith)
Injection-Date: Thu, 22 Sep 2022 16:06:18 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4845
 by: Peter Smith - Thu, 22 Sep 2022 16:06 UTC

On Wednesday, February 1, 2017 at 11:55:35 AM UTC, Terry Reedy wrote:
> On 2/1/2017 1:37 AM, Christian Gollwitzer wrote:
> > Am 01.02.17 um 00:02 schrieb MRAB:
> >> On 2017-01-31 22:34, Christian Gollwitzer wrote:
> >>>> .!frame.!checkbutton
> >>>> .!frame.!checkbutton2
> >>>> .!frame2.!checkbutton
> >>>> .!frame2.!checkbutton2
> >>>
> >>>
> >> Perhaps someone who knows Tcl and tk can tell me, but I notice that in
> >> the first example, the second part of the widget names are unique,
> >> whereas in the second example, the second part of the widget names are
> >> the reused (both "!checkbutton" and "!checkbutton2" occur twice).
> >
> > It is indeed the reason, but it has some strange legacy cause: the
> > default name for the checkbutton-linked variable is the name of the
> > button inside the parent. Therefore creating a checkbutton has the side
> > effect of creating a variable with the button's name.
> >
> > In this case, the first buttons in the frames are linked to a variable
> > called "!checkbutton" and the other two are linked to "!checkbutton2".
> > (a variable name in Tcl can be anything apart from the empty string).
> > This can also be demonstrated by this Tcl script:
> >
> > package require Tk
> >
> > pack [frame .f1]
> > pack [frame .f2]
> >
> > pack [checkbutton .f1.c1 -text "A" ]
> > pack [checkbutton .f1.c2 -text "B" ]
> >
> > pack [checkbutton .f2.c1 -text "C" ]
> > pack [checkbutton .f2.c2 -text "D" ]
> >
> > which is equivalent to the Python code above.
> >
> > Note that this surprising behaviour was corrected for the (modern) ttk
> > widgets, so if "checkbutton" is replaced by "ttk::checkbutton", they are
> > not any longer linked. In Python, that would be
> >
> > from tkinter import ttk
> > ...
> > w = ttk.Checkbutton()
> >
> > (Personally, I'm not using the legacy widgets any longer)
> Christian, could you repeat any relevant parts of your comments on the
> tracker, especially any ideas on how we might fix tkinter?
> https://bugs.python.org/issue29402
> >> Do the names need to be:
> >>
> >> .!frame.!checkbutton
> >> .!frame.!checkbutton2
> >> .!frame2.!checkbutton3
> >> .!frame2.!checkbutton4
> Serhiy considered that but, not knowing that this would cause a
> regression, we both liked numbering within parent better.
>
> There is a similar issue with radiobuttons on ttk.OptionMenus that
> existed *before* the 3.6 name changes.
> https://bugs.python.org/issue25684
> So there seems to be a systematic issue with tk or how we are (mis)using it.
> > Good question. Maybe there should be unique variable names? I.e., if the
> > script is changed into package require Tk
> >
> > pack [frame .f1]
> > pack [frame .f2]
> >
> > pack [checkbutton .f1.c1 -text "A" -variable v1]
> > pack [checkbutton .f1.c2 -text "B" -variable v2]
> >
> > pack [checkbutton .f2.c1 -text "C" -variable v3]
> > pack [checkbutton .f2.c2 -text "D" -variable v4]
> >
> > then they are also not linked.
> --
> Terry Jan Reedy

It looks as if the issue is indeed that the expression to the right of CheckButton(... variable= must be an expression.

This works for me
global checkbix, checkbuttons
checkbix += 1
b = tk.Checkbutton(frame, text=text, variable=checkbuttons[checkbix], ...)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor