BWidget::PanedWindow

Manual page:

From Tk 8.4 on, Tk has its own panedwindow.

Examples on use of BWidget::PanedWindow:

 package require BWidget 

 # Create PanedWindow with 3 horizontal panes
 set pwh [PanedWindow .pwh -side top]
 pack $pwh -fill both -expand true

 set fh1 [$pwh add]
 set fh2 [$pwh add]
 set fh3 [$pwh add]

 # In second pane, add 2 horizontal panes
 set pwv [PanedWindow $fh2.pwv -side left]
 pack $pwv -fill both -expand true

 set fv1 [$pwv add]
 set fv2 [$pwv add]

 # Make large enough to be able to resize the panes
 wm geometry . 500x500

Jos Decoster The following examples show the difference between extra and available values for the -weights option. You can compare this option with the -stretch option of the Tk 8.5 panedwindow widget.

 package require BWidget 

 wm geometry . 500x500+200+200

 set f1 [frame .f1]
 set f2 [frame .f2]
 pack .f1 .f2 -fill both -expand true 

 # Create 3 panes where only extra space is divided among the different panes
 # relative to their weight.
 set pwh1 [PanedWindow $f1.pwh -side top -weights extra]
 pack $pwh1 -fill both -expand true
 set fh1_1 [$pwh1 add -weight 2]
 pack [text $fh1_1.txt] -fill both -expand true
 set fh1_2 [$pwh1 add -weight 2]
 pack [text $fh1_2.txt] -fill both -expand true
 set fh1_3 [$pwh1 add -weight 1]
 pack [text $fh1_3.txt] -fill both -expand true

 # Create 3 panes where all space is divided among the different panes
 # relative to their weight.
 set pwh2 [PanedWindow $f2.pwh -side top -weights available]
 pack $pwh2 -fill both -expand true
 set fh2_1 [$pwh2 add -weight 2]
 pack [text $fh2_1.txt] -fill both -expand true
 set fh2_2 [$pwh2 add -weight 2]
 pack [text $fh2_2.txt] -fill both -expand true
 set fh2_3 [$pwh2 add -weight 1]
 pack [text $fh2_3.txt] -fill both -expand true

Category Widget of the BWidget extension


tarzan - 2017-05-17 16:30:04

Markdown HTML On Pane

package require BWidget
package require Tkhtml
package require Markdown

set pw [PanedWindow .pw -side top]
pack $pw -fill both -expand true

set f1 [$pw add]
set f2 [$pw add]

pack [set t [text ${f1}.t]] -side left -fill both -expand 1
pack [set h [html ${f2}.h]] -side left -fill both -expand 1

bind $t <KeyRelease> "render $t $h"
proc render {t h} {
        $h reset
        $h style "*{font-family: Consolas;}"
        $h parse -final [Markdown::convert [$t get 1.0 end]]
}

what about scrollbars?