Luc
2024-10-04 15:45:45 UTC
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.
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
Luc