Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Avoid strange women and temporary variables.


devel / comp.lang.tcl / Re: winfo gives me wrong geometry

SubjectAuthor
* winfo gives me wrong geometryLuc
+* Re: winfo gives me wrong geometryRich
|`* Re: winfo gives me wrong geometryLuc
| +- Re: winfo gives me wrong geometryRobert Heller
| `* Re: winfo gives me wrong geometryRich
|  `- Re: winfo gives me wrong geometryRalf Fassel
`* Re: winfo gives me wrong geometryHarald Oehlmann
 `- Re: winfo gives me wrong geometryLuc

1
winfo gives me wrong geometry

<20230515001156.4bdd1688@lud1.home>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: winfo gives me wrong geometry
Date: Mon, 15 May 2023 00:11:56 -0300
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <20230515001156.4bdd1688@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="401c6b4514d994302f78181a3b8bcdb8";
logging-data="3069048"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MYV8iiJhhkMD+AK46XK2lFiS6dGtzH5M="
Cancel-Lock: sha1:BYB2HfDrH7qwfLzrz6D722ILYYY=
 by: Luc - Mon, 15 May 2023 03:11 UTC

wm attributes $::w -zoomed 1
update idletasks
regsub {([0-9]+)x.+} [winfo geometry $::w] {\1} ::WholeAppWidth

The whole app width I'm getting is 600 - out of 600x381+817+515.

But 600 is incorrect. I am making sure the application always runs
maximized, and my screen is 1920px wide.

The height can't be 381px either.

The x/y coordinates are also wrong. If the application is maximized,
they should be 0+0 (or maybe 1+1).

What am I doing wrong this time?

--
Luc
>>

Re: winfo gives me wrong geometry

<u3sajk$2ttv4$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: winfo gives me wrong geometry
Date: Mon, 15 May 2023 03:57:40 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <u3sajk$2ttv4$1@dont-email.me>
References: <20230515001156.4bdd1688@lud1.home>
Injection-Date: Mon, 15 May 2023 03:57:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6679b060e5c87fb2c63346ad81a12758";
logging-data="3078116"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18iwQ1AKHDQa2i3S/jaTTrk"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:XuDEvlBMd1XBuYWOXKFZMDqZcxo=
 by: Rich - Mon, 15 May 2023 03:57 UTC

Luc <luc@sep.invalid> wrote:
> wm attributes $::w -zoomed 1
> update idletasks
> regsub {([0-9]+)x.+} [winfo geometry $::w] {\1} ::WholeAppWidth
>
> The whole app width I'm getting is 600 - out of 600x381+817+515.
>
> But 600 is incorrect. I am making sure the application always runs
> maximized, and my screen is 1920px wide.
>
> The height can't be 381px either.
>
> The x/y coordinates are also wrong. If the application is maximized,
> they should be 0+0 (or maybe 1+1).
>
> What am I doing wrong this time?

Does the window become maximized on your system (on mine, it grows to
full height, but the width does not change from it's default.

Three things to try:

1) try an update instead of an update idletasks

2) because window resizing on Linux is the responsibility of the window
manager, you may need to put in a bit of a delay to let the window
manager complete the resize before you ask for the size. I.e., your
code above might be obtaining the size before the wm has actuall
resized anything.

So try adding something like:

after 500 [list set ::forever 1]
vwait ::forever

3) bind to the <Configure> event on $::w and don't ask for its size
until after you get the configure event firing (this should be the most
reliable as it avoids needing to "wait" for a fixed time, and it avoids
doing a full update (or update idletasks). But it does require you
restructure your code to work with the event.

Re: winfo gives me wrong geometry

<u3si5c$2v18p$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wortkarg3@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: winfo gives me wrong geometry
Date: Mon, 15 May 2023 08:06:40 +0200
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <u3si5c$2v18p$1@dont-email.me>
References: <20230515001156.4bdd1688@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 15 May 2023 06:06:36 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a4740da8305e8f1783f1bf2448d09125";
logging-data="3114265"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rAIdsfGtNtsWfw1LG9dpt"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:CJCRVi6k/ND3nOacP3yFrDYM1hU=
In-Reply-To: <20230515001156.4bdd1688@lud1.home>
Content-Language: en-GB
 by: Harald Oehlmann - Mon, 15 May 2023 06:06 UTC

Am 15.05.2023 um 05:11 schrieb Luc:
> wm attributes $::w -zoomed 1
> update idletasks
> regsub {([0-9]+)x.+} [winfo geometry $::w] {\1} ::WholeAppWidth
>
> The whole app width I'm getting is 600 - out of 600x381+817+515.
>
> But 600 is incorrect. I am making sure the application always runs
> maximized, and my screen is 1920px wide.
>
> The height can't be 381px either.
>
> The x/y coordinates are also wrong. If the application is maximized,
> they should be 0+0 (or maybe 1+1).
>
> What am I doing wrong this time?
>
>

If the state is zoomed, the last state normal geometry is returned.
I would check the winfo height/width of "." to get current zoomed size.

Harald

Re: winfo gives me wrong geometry

<20230515140649.7caa65d8@lud1.home>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: winfo gives me wrong geometry
Date: Mon, 15 May 2023 14:06:49 -0300
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <20230515140649.7caa65d8@lud1.home>
References: <20230515001156.4bdd1688@lud1.home>
<u3sajk$2ttv4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="401c6b4514d994302f78181a3b8bcdb8";
logging-data="3265522"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190gP5F7U6cRzQx+h4SDOm7+iYSIhIPaOA="
Cancel-Lock: sha1:CWFggjIy1VYVwsDBrorEx1QTuTk=
 by: Luc - Mon, 15 May 2023 17:06 UTC

On Mon, 15 May 2023 03:57:40 -0000 (UTC), Rich wrote:

> 1) try an update instead of an update idletasks

That works, but I will have to look into the <Configure> option too
because the window may be resized by the user and the application will
have to self adjust accordingly.

> and it avoids
> doing a full update (or update idletasks).

You say that like it's a bad thing. Is it? What is the problem with
"a full update"?

--
Luc
>>

Re: winfo gives me wrong geometry

<20230515140849.121ba6fb@lud1.home>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: winfo gives me wrong geometry
Date: Mon, 15 May 2023 14:08:49 -0300
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <20230515140849.121ba6fb@lud1.home>
References: <20230515001156.4bdd1688@lud1.home>
<u3si5c$2v18p$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="401c6b4514d994302f78181a3b8bcdb8";
logging-data="3265522"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wZ33QmeUgiuuDP5WkO15sP6cBGLqvbFk="
Cancel-Lock: sha1:4N9JLt9DedYBm9jV54+7I8PyHxI=
 by: Luc - Mon, 15 May 2023 17:08 UTC

On Mon, 15 May 2023 08:06:40 +0200, Harald Oehlmann wrote:

> If the state is zoomed, the last state normal geometry is returned.
> I would check the winfo height/width of "." to get current zoomed size.
>
> Harald

That is worse. "." gives me 1x1+0+0.

--
Luc
>>

Re: winfo gives me wrong geometry

<j-GcnUuO0cVi8P_5nZ2dnZfqn_udnZ2d@giganews.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 15 May 2023 17:38:07 +0000
MIME-Version: 1.0
From: heller@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: winfo gives me wrong geometry
In-Reply-To: <20230515140649.7caa65d8@lud1.home>
References: <20230515001156.4bdd1688@lud1.home>??<u3sajk$2ttv4$1@dont-email.me>
<20230515140649.7caa65d8@lud1.home>
Newsgroups: comp.lang.tcl
Content-Type: text/plain;
charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <j-GcnUuO0cVi8P_5nZ2dnZfqn_udnZ2d@giganews.com>
Date: Mon, 15 May 2023 17:38:07 +0000
Lines: 37
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-AV73lbDQux0jkY2N7JKkGtvGxx+Bc75xnttTKTZ4BwNCf0xkN4Kn733t3oqKPJUMEwMEpZR+LjzQowF!Klz7CqzZVBnUcs+DN5TQF29SrxJFUdb0KDIb2yDrqBsxE6ENlVNraODzZYw/Q07C5biVCq3e9I96!cMs=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Robert Heller - Mon, 15 May 2023 17:38 UTC

At Mon, 15 May 2023 14:06:49 -0300 Luc <luc@sep.invalid> wrote:

>
> On Mon, 15 May 2023 03:57:40 -0000 (UTC), Rich wrote:
>
> > 1) try an update instead of an update idletasks
>
> That works, but I will have to look into the <Configure> option too
> because the window may be resized by the user and the application will
> have to self adjust accordingly.
>
>
> > and it avoids
> > doing a full update (or update idletasks).
>
> You say that like it's a bad thing. Is it? What is the problem with
> "a full update"?

In *some* cases "a full update" could result in a race condition. Doing a a
full update while in the process of doing a full update can be problematical.
Eg if some event script does a "update", and this causes another event script
to run which also calls "update"... (Yes this is a bit contrived, but you
should get the point.)

*Generally* you should only need to "update idletasks" -- this catches any
lazy eval / defered updates and gets everything essential up-to-date, but
*rarely* you may have to do a full update.

>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: winfo gives me wrong geometry

<u3tu7a$34ha6$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: winfo gives me wrong geometry
Date: Mon, 15 May 2023 18:38:34 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <u3tu7a$34ha6$2@dont-email.me>
References: <20230515001156.4bdd1688@lud1.home> <u3sajk$2ttv4$1@dont-email.me> <20230515140649.7caa65d8@lud1.home>
Injection-Date: Mon, 15 May 2023 18:38:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6679b060e5c87fb2c63346ad81a12758";
logging-data="3294534"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+81YDdujjE07AzuJhuI3KZ"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:gnfTOAlx/S5vtDpTGIzVDyV1ACY=
 by: Rich - Mon, 15 May 2023 18:38 UTC

Luc <luc@sep.invalid> wrote:
> On Mon, 15 May 2023 03:57:40 -0000 (UTC), Rich wrote:
>
>> 1) try an update instead of an update idletasks
>
> That works, but I will have to look into the <Configure> option too
> because the window may be resized by the user and the application will
> have to self adjust accordingly.

In this case, you *will* want to bind to the <Configure> event, because
if you have need to know what size the user resized things to, binding
to <Configure> is the only reliable way to do so.

>> and it avoids doing a full update (or update idletasks).
>
> You say that like it's a bad thing. Is it? What is the problem with
> "a full update"?

It can interact badly with other modules that themselves use vwait for
pauses, and/or interact badly with event driven code (either yours or
other modules doing event driven work).

Update idletasks is somewhat safer, but it can also cause some
irritating interactions with vwait/event driven code (just less than a
full update).

Now, for 'startup' where you are not yet running and are still
initializing, you can get away with either without too much worry.

For more indepth details read:

Update considered harmful
https://wiki.tcl-lang.org/page/Update+considered+harmful

Re: winfo gives me wrong geometry

<ygabkik1t56.fsf@akutech.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: winfo gives me wrong geometry
Date: Tue, 16 May 2023 12:13:09 +0200
Lines: 30
Message-ID: <ygabkik1t56.fsf@akutech.de>
References: <20230515001156.4bdd1688@lud1.home> <u3sajk$2ttv4$1@dont-email.me>
<20230515140649.7caa65d8@lud1.home> <u3tu7a$34ha6$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net KLPcvO/RZFGKfRSa6gAxvAIyGJ+aONsoeAjMXzBLyqOGcBw84=
Cancel-Lock: sha1:d5B4eT+i5/n3XbwwoQAfd3Y3ItM= sha1:Z8pw8mJ+8UaO6tsxBolqxaIJFno=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Tue, 16 May 2023 10:13 UTC

* Rich <rich@example.invalid>
| Luc <luc@sep.invalid> wrote:
| > On Mon, 15 May 2023 03:57:40 -0000 (UTC), Rich wrote:
| >
| >> 1) try an update instead of an update idletasks
| >
| > That works, but I will have to look into the <Configure> option too
| > because the window may be resized by the user and the application will
| > have to self adjust accordingly.
>
| In this case, you *will* want to bind to the <Configure> event, because
| if you have need to know what size the user resized things to, binding
| to <Configure> is the only reliable way to do so.

Note that the <Configure> event will also trigger the first time the
window appears on the screen and is mapped to it's first 'real' size:

% cat t.tcl
proc showgeom {msg} {
puts "$msg: geom [winfo geometry .] w [winfo width .] h [winfo height .]"
}
showgeom "at start"
bind . <Configure> [list showgeom "via Configure"]
% wish t.tcl
at start: geom 1x1+0+0 w 1 h 1
via Configure: geom 200x200+0+0 w 200 h 200
via Configure: geom 200x200+148+372 w 200 h 200
via Configure: geom 200x200+148+372 w 200 h 200

R'


devel / comp.lang.tcl / Re: winfo gives me wrong geometry

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor