Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Try to get all of your posthumous medals in advance.


comp / comp.lang.tcl / packed panedwindow doesn't fill as expected

SubjectAuthor
* packed panedwindow doesn't fill as expectedLuc
`- Re: packed panedwindow doesn't fill as expectednemethi

1
Subject: packed panedwindow doesn't fill as expected
From: Luc
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 4 Oct 2024 15:45 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: packed panedwindow doesn't fill as expected
Date: Fri, 4 Oct 2024 12:45:45 -0300
Organization: A noiseless patient Spider
Lines: 77
Message-ID: <20241004124545.18ce0e7f@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 04 Oct 2024 17:45:46 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="15f649942e682c8a504c1d56922877be";
logging-data="295321"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/9QSieM8Hr8DXZZh5MYkYikmpuXGh50po="
Cancel-Lock: sha1:WOpGb9EINO4rMIdZhODsvTRXKsE=
View all headers

Of course, my expectations are often wrong.

This code works perfectly as expected:

-------------------------
package require Tk
package require tile
wm withdraw .
set ::w [toplevel .topw]
wm resizable .topw 1 1
wm attributes .topw -zoomed 1
wm geometry .topw 600x100+0+0
bind $::w <Escape> {exit 0}
wm protocol $::w WM_DELETE_WINDOW {exit 0}

set ::outerframe [frame $w.outerframe -background "red" ]
pack $::outerframe -fill both -expand 1
set ::tabframe [frame $::outerframe.tabframe -background "blue"]
pack $::tabframe -fill both -expand 0 -ipadx 100 -ipady 0
set tabbutton [button $tabframe.tabbutton -text "Tab" -font "Freesans 12"]
pack $tabbutton -fill x -expand 0 -side left

set ::pathlineframe [frame $::outerframe.pathlineframe -background "black" -cursor "arrow" -bd 6]
pack $::pathlineframe -fill x -expand 1 -side top -anchor n
set ::pathline [entry $::pathlineframe.pathline -background "yellow" -font "Freesans 14" -bd 2]
pack $::pathline -fill x -expand 1 -side left -ipadx 100
set menubutton [button $::pathlineframe.menubutton -text "Menu" -font "Freesans 12"]
pack $menubutton
-------------------------

Now I want to fill up the entire red area (which is the super big master
"outer" frame which contains everything) with a panedwindow.

The panedwindow has pink background. Let's try:

-------------------------
package require Tk
package require tile
wm withdraw .
set ::w [toplevel .topw]
wm resizable .topw 1 1
wm attributes .topw -zoomed 1
wm geometry .topw 600x100+0+0
bind $::w <Escape> {exit 0}
wm protocol $::w WM_DELETE_WINDOW {exit 0}

set ::outerframe [frame $w.outerframe -background "red" ]
pack $::outerframe -fill both -expand 1
set ::tabframe [frame $::outerframe.tabframe -background "blue"]
pack $::tabframe -fill both -expand 0 -ipadx 100 -ipady 0
set tabbutton [button $tabframe.tabbutton -text "Tab" -font "Freesans 12"]
pack $tabbutton -fill x -expand 0 -side left

set ::pathlineframe [frame $::outerframe.pathlineframe -background "black" -cursor "arrow" -bd 6]
pack $::pathlineframe -fill x -expand 1 -side top -anchor n
set ::pathline [entry $::pathlineframe.pathline -background "yellow" -font "Freesans 14" -bd 2]
pack $::pathline -fill x -expand 1 -side left -ipadx 100
set menubutton [button $::pathlineframe.menubutton -text "Menu" -font "Freesans 12"]
pack $menubutton

set unipane [panedwindow $::outerframe.unipane]
pack $unipane -fill both -expand 1
$unipane configure -background "pink"
-------------------------

So the panedwindow is in right place, but how come it is not filling up
the entire available space? Isn't that what -fill both is supposed to do?

Sometimes it's really hard to understand pack. Then again, I don't
think grid is that easy either.

--
Luc
>>

Subject: Re: packed panedwindow doesn't fill as expected
From: nemethi
Newsgroups: comp.lang.tcl
Date: Fri, 4 Oct 2024 17:25 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.tota-refugium.de!.POSTED!not-for-mail
From: csaba.nemethi@t-online.de (nemethi)
Newsgroups: comp.lang.tcl
Subject: Re: packed panedwindow doesn't fill as expected
Date: Fri, 4 Oct 2024 19:25:56 +0200
Message-ID: <vdp8f4$1v4kg$1@tota-refugium.de>
References: <20241004124545.18ce0e7f@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 4 Oct 2024 17:25:56 -0000 (UTC)
Injection-Info: tota-refugium.de;
logging-data="2069136"; mail-complaints-to="abuse@news.tota-refugium.de"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:MsMwjXnZ1Q4OauVqOKTQaeFthZQ=
X-User-ID: eJwFwQERADEIAzBLZQ/lkLMB9S/hk/ho7HQGPRRqYIZTtE4sLfzZHpyWVz+EUgdc3cFVUT8d7RGG
In-Reply-To: <20241004124545.18ce0e7f@lud1.home>
Content-Language: en-US
View all headers

Am 04.10.24 um 17:45 schrieb Luc:
> Of course, my expectations are often wrong.
>
> This code works perfectly as expected:
>
> -------------------------
> package require Tk
> package require tile
> wm withdraw .
> set ::w [toplevel .topw]
> wm resizable .topw 1 1
> wm attributes .topw -zoomed 1
> wm geometry .topw 600x100+0+0
> bind $::w <Escape> {exit 0}
> wm protocol $::w WM_DELETE_WINDOW {exit 0}
>
> set ::outerframe [frame $w.outerframe -background "red" ]
> pack $::outerframe -fill both -expand 1
> set ::tabframe [frame $::outerframe.tabframe -background "blue"]
> pack $::tabframe -fill both -expand 0 -ipadx 100 -ipady 0
> set tabbutton [button $tabframe.tabbutton -text "Tab" -font "Freesans 12"]
> pack $tabbutton -fill x -expand 0 -side left
>
> set ::pathlineframe [frame $::outerframe.pathlineframe -background "black" -cursor "arrow" -bd 6]
> pack $::pathlineframe -fill x -expand 1 -side top -anchor n
> set ::pathline [entry $::pathlineframe.pathline -background "yellow" -font "Freesans 14" -bd 2]
> pack $::pathline -fill x -expand 1 -side left -ipadx 100
> set menubutton [button $::pathlineframe.menubutton -text "Menu" -font "Freesans 12"]
> pack $menubutton
> -------------------------
>
>
> Now I want to fill up the entire red area (which is the super big master
> "outer" frame which contains everything) with a panedwindow.
>
> The panedwindow has pink background. Let's try:
>
>
> -------------------------
> package require Tk
> package require tile
> wm withdraw .
> set ::w [toplevel .topw]
> wm resizable .topw 1 1
> wm attributes .topw -zoomed 1
> wm geometry .topw 600x100+0+0
> bind $::w <Escape> {exit 0}
> wm protocol $::w WM_DELETE_WINDOW {exit 0}
>
> set ::outerframe [frame $w.outerframe -background "red" ]
> pack $::outerframe -fill both -expand 1
> set ::tabframe [frame $::outerframe.tabframe -background "blue"]
> pack $::tabframe -fill both -expand 0 -ipadx 100 -ipady 0
> set tabbutton [button $tabframe.tabbutton -text "Tab" -font "Freesans 12"]
> pack $tabbutton -fill x -expand 0 -side left
>
> set ::pathlineframe [frame $::outerframe.pathlineframe -background "black" -cursor "arrow" -bd 6]
> pack $::pathlineframe -fill x -expand 1 -side top -anchor n
> set ::pathline [entry $::pathlineframe.pathline -background "yellow" -font "Freesans 14" -bd 2]
> pack $::pathline -fill x -expand 1 -side left -ipadx 100
> set menubutton [button $::pathlineframe.menubutton -text "Menu" -font "Freesans 12"]
> pack $menubutton
>
> set unipane [panedwindow $::outerframe.unipane]
> pack $unipane -fill both -expand 1
> $unipane configure -background "pink"
> -------------------------
>
> So the panedwindow is in right place, but how come it is not filling up
> the entire available space? Isn't that what -fill both is supposed to do?
>
> Sometimes it's really hard to understand pack. Then again, I don't
> think grid is that easy either.
>

Both $::pathlineframe and $unipane are packed with "-expand 1". For
this reason, the parcels of both widgets will be expanded to consume
extra space in $::outerframe. Since the pack invocation for
$::pathlineframe has "-fill x" rather than "-fill both", actually it
doesn't need "-expand 1". By changing it to "-expand 0" (or simply
removing it), $unipane will become the only expanding child of
$::outerframe, hence it will fill the entire available space.

--
Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de

1

rocksolid light 0.9.8
clearnet tor