iostrym
iostrym

Reputation: 125

TCL can't modify size of windows

I don't succeed to modify the size of the main windows of my TCL TK GUI :

But if I type :

package require BWidget

MainFrame .main \
            -textvariable status \
            -progressvar  prgindic \
            -progressfg SteelBlue4 \
            -progressmax 100 \
            -progresstype infinite \
            -width 5000 \
            -height 5000

pack .main  -fill both -expand 1

then I have a big windows that is created and this is correct.

But if I add after that all element of my GUI in this windows, then parameters -width and -height of MainFrame procedure seem to be no more used. the windows created is then a medium size. I can still manually resize the gui when it is created but I don't succeed to create a main windows that has directly the needed size.

If a try to resume what is added in this main windows, there are :

and also a lot of stuff inside the notebook are added (frame, etc)

please note that I also added -width and -height parameter in this last procedure (NoteBook) but without success, these parameters are not used.

do you know what could "erase" the size of my GUI ? is there a option in TK that could make my gui to be iself dimensionned and to ignore the -width and -height parameters ?

here a simplified version of my real gui, real gui contains more stuff inside it but the main structure is like this (same options). the problem is that with the simplified version the resizing is working :

package require BWidget

#package require tkcon
#tkcon show

console show

MainFrame .main \
            -textvariable status \
            -progressvar  prgindic \
            -progressfg SteelBlue4 \
            -progressmax 100 \
            -progresstype infinite \
            -width 300 \
            -height 300

set frame [.main getframe]
puts "frame = $frame"

set notebook    [NoteBook $frame.note -width 300 -height 300 -homogeneous 0 -tabbevelsize 4 -arcradius 3 ]
puts "notebook = $notebook"
pack .main.frame
pack $notebook -fill both -expand 1 -side top
        
pack .main  -fill both -expand 1

# sheet creation :
set top [$notebook insert 0 test1 -text "ONGLET1"]
puts "top=$top"
# =  .main.frame.note.ftest1

# here I can resize using  :
#.main.frame.note configure -width 3000

# create panedwindows in the sheet :
set pw [PanedWindow $top.pw -side left -pad 4 -weights available -width 3]
puts "pw=$pw"

set houtil [$pw add -weight 3]
puts "houtil=$houtil"
# -width 3 = taille du petit cube qui permet de décaller les barres de séparation horizontales
set pwhoutil [PanedWindow $houtil.pwhoutil -side top -pad 4 -weights available -width 8]
puts "pwhoutil=$pwhoutil"

pack $pwhoutil -fill both -expand 1
pack $pw -fill both -expand 1

# at this point I can still resize :
#.main.frame.note configure -width 1000

set modules [$pwhoutil add -weight 2]
set frame_def_ptr  [TitleFrame $modules.frame_etape -text "Etapes de bf actif" ]
pack $frame_def_ptr -side top -fill both -expand 1

# at this point I can still resize :
#.main.frame.note configure -width 1000

set text        [$pw add -weight 3]
set notebook_log    [NoteBook $text.log -width 900 -height 500 -homogeneous 1 -tabbevelsize 4 -arcradius 0 ]
puts "notebook_log = $notebook_log"
pack $notebook_log -fill both -expand 1 -side top

# at this point I can still resize :
#.main.frame.note configure -width 1000

# without effect :
.main configure -width 2000
.main.frame.note.ftest1.pw.f1.frame.log configure -width 2500

[EDIT] I tried a massive modification of width through all widget hierarchy using : [catch { $ww configure -width 1000} err] and it brokes the gui because of the width modification but the global size of the windows don't move !!! I don't understand at all

Upvotes: 0

Views: 69

Answers (2)

iostrym
iostrym

Reputation: 125

I have a partial answer but I would like to have more detail about it.

I discover that I can use :

wm geometry . "2000x2000" to resize my GUI easily without having to play with "configure" (that I still don't succeed to use).

I discover also that inside my tcl source code there was a

wm geometry . "1070x748+110+110"

that was "hidden". does it explain why the configuraion has no effect my main windows size ?

Upvotes: 0

Donal Fellows
Donal Fellows

Reputation: 137587

You could try disabling geometry propagation on .main (with grid propagate .main 0 or pack propagate .main 0, depending on which you use) so that it doesn't shrink to fit around the window contents. The main downside is that it also won't automatically expand around the contents either; getting the overall sizes right in the face of text or font changes is one of the main reasons for leaving things in automatic.

Upvotes: 0

Related Questions