Posted to tcl by emiliano at Thu Feb 05 21:06:35 GMT 2009view pretty

package require Tk 8.5
package require Tcl 8.5

canvas .c -xscrollcommand {.sx set} -yscrollcommand {.sy set}\
    -bg white -borderwidth 0 -highlightthickness 0
ttk::scrollbar .sx -command {.c xview} -orient horizontal
ttk::scrollbar .sy -command {.c yview} -orient vertical
grid .c .sy -sticky news
grid .sx -sticky news
grid columnconfigure . 0 -weight 1
grid rowconfigure . 0 -weight 1

set w [expr {int([winfo screenwidth  .]*0.85)}]
set h [expr {int([winfo screenheight .]*0.85)}]

set img [image create photo -width $w -height $h]
$img put black -to 0 0 $w $h
.c create image {0 0} -image $img -anchor nw

.c configure -scrollregion [.c bbox all]

#(8<)============================================================(8<)

This code shows the same behaviour as the previous post and is smaller

Comments

Posted by emiliano at Thu Feb 05 21:13:34 GMT 2009 [text] [code]

forgot to add: resize the window so that it occupies the full width of the screen and scroll the canvas vertically