Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Resizable windows get false autosize

94 views
Skip to first unread message

Juge

unread,
Sep 14, 2015, 6:52:58 AM9/14/15
to
I have a problem with my toplevel windows. I want to get resizable windows, which I do get, only with one Tcl or another the window starts with too small size.
I tried including geometry option and it causes the window to start at current size but it immediately shrinks again after the program is really running.

If I use resizable 0 0 option the initial window size is ok am I missing something?

Rich

unread,
Sep 14, 2015, 7:21:45 AM9/14/15
to
Tk windows normally 'resize' to just fit their contents if you do
nothing at all to them beyond packing/griding them.

But, lacking a very short code example that demonstrates the problem,
how do you expect us here to remotely read your mind, see your issue,
and provide advice?

Juge

unread,
Sep 14, 2015, 7:48:12 AM9/14/15
to
On Monday, September 14, 2015 at 1:21:45 PM UTC+2, Rich wrote:
>
> Tk windows normally 'resize' to just fit their contents if you do
> nothing at all to them beyond packing/griding them.
>
> But, lacking a very short code example that demonstrates the problem,
> how do you expect us here to remotely read your mind, see your issue,
> and provide advice?

Well, yes, I can see that. However, like I said - depending on brand of Tcl the problem may or may not occur - therefore if I tried to post an example you might or might not be able to reproduce it. What I was hoping for, I guess, was that someone has seen that kind of behavior previously and would know why and how this happens.

All I can say is that my GUI is already quite a long one and I would need to strip it down to something usable and small. I'll try to see about that.

Gerald W. Lester

unread,
Sep 14, 2015, 9:56:05 AM9/14/15
to
Take a look at: wm minsize

--
+------------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+------------------------------------------------------------------------+

Alexandru

unread,
Sep 15, 2015, 3:55:51 AM9/15/15
to
I'm not sure if this is what Juge means, but my problem is at least similar (wm minsize is not the solution).

My application starts maximized (Windows). When I click on the main windows Restore button (next to the close button), the main window gets very very small, so I have to drag the corner to make it bigger.

I know wm minsize, but that is not what I want. I just want the the Restore button leads to a window that is bigger than the default, while I can still make the window smaller if I want.

Harald Oehlmann

unread,
Sep 15, 2015, 5:41:31 AM9/15/15
to
The best way is to bind to the Configure event of the window and modify the size manually.

A restore may also position it out of the screen which might be checked...

-Harald

Alexandru

unread,
Sep 15, 2015, 11:18:17 AM9/15/15
to
Hi Harald,

is it possible to retrieve the type of action (e.g. Restore) that triggered the Configure event?

Mike Griffiths

unread,
Sep 15, 2015, 6:05:59 PM9/15/15
to
When you say it "starts maximized", what do you mean exactly? I'm guessing that you're doing
wm state . zoomed
very early on (possibly before packing anything)? Maybe that's why the required size isn't being set right for the unmaximized window?

Try moving the 'wm state . zoomed' lower in your script until your widgets are all packed? If necessary, start with 'wm state . withdrawn' and throw in an update prior to the maximizing, so the windows are all properly packed and the necessary geometry calculated and stored before you maximize.

Alexandru

unread,
Sep 15, 2015, 6:38:31 PM9/15/15
to
Yes, I'm using "wm state . zoomed" before packing the widgets.
I moved the command to the end of the script, use the withdrawn property, update before zooming the window, but the restore size remains the same.

Juge

unread,
Sep 22, 2015, 7:55:20 AM9/22/15
to
On Monday, September 14, 2015 at 3:56:05 PM UTC+2, Gerald W. Lester wrote:
> On 9/14/15 5:52 AM, Juge wrote:
> > I have a problem with my toplevel windows. I want to get resizable windows, which I do get, only with one Tcl or another the window starts with too small size.
> > I tried including geometry option and it causes the window to start at current size but it immediately shrinks again after the program is really running.
> >
> > If I use resizable 0 0 option the initial window size is ok am I missing something?
>
> Take a look at: wm minsize
>
> --


Hi, that was kind of close, but I now get a huge window as if the whole thing gor interpreted as rows or something instead of pixels. I am trying to work out a condensed example.

Donald Arseneau

unread,
Dec 21, 2015, 11:24:37 PM12/21/15
to
Alexandru <alexandr...@meshparts.de> writes:

> Am Montag, 14. September 2015 15:56:05 UTC+2 schrieb Gerald W. Lester:
> > On 9/14/15 5:52 AM, Juge wrote:
> > > I have a problem with my toplevel windows. I want to get resizable windows, which I do get, only with one Tcl or another the window starts with too small size.
> > > I tried including geometry option and it causes the window to start at current size but it immediately shrinks again after the program is really running.
> > >
> > > If I use resizable 0 0 option the initial window size is ok am I missing something?
> >
> > Take a look at: wm minsize
> >
> I'm not sure if this is what Juge means, but my problem is at least similar (wm minsize is not the solution).
>
> My application starts maximized (Windows). When I click on the main windows Restore button (next to the close button), the main window gets very very small, so I have to drag the corner to make it bigger.
>
> I know wm minsize, but that is not what I want. I just want the the Restore button leads to a window that is bigger than the default, while I can still make the window smaller if I want.


That sounds like the initial default 100x100 windowe size is retained because
the initial resizing done by Tk never has to change the size of a full-screen
window. I'll have to try it myself.


--
Donald Arseneau as...@triumf.ca

tombert

unread,
Dec 22, 2015, 2:54:12 AM12/22/15
to
Can you try the following, after you application has started and is idle:

binary scan [binary format I -1] H* autoSize
set autoSize [expr 0x$autoSize]
wm geometry <your window> $autoSizex$autoSize


0 new messages