|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# This file:
# http://anggtwu.net/TCL/scrollingcanvas.tcl.html
# http://anggtwu.net/TCL/scrollingcanvas.tcl
# (find-angg "TCL/scrollingcanvas.tcl")
# Author: Eduardo Ochs <eduardoochs@gmail.com>
#
# (defun e () (interactive) (find-angg "TCL/scrollingcanvas.tcl"))
# https://wiki.tcl-lang.org/page/Minimal+scrolling+canvas
set height 400
set width 600
set borderwidth 2
set hscroll .hscroll
set vscroll .vscroll
set canvas .c
scrollbar $hscroll -orient horiz -command "$canvas xview"
scrollbar $vscroll -command "$canvas yview"
canvas $canvas -relief sunken -borderwidth $borderwidth \
-width $width -height $height \
-xscrollcommand "$hscroll set" \
-yscrollcommand "$vscroll set"
# Ensure that window resizings retain scroll bars.
pack $hscroll -side bottom -fill x
pack $vscroll -side right -fill y
pack $canvas -side right -fill both -expand 1
# Somebody want to express the above in "grid"?
# That'd be good practice.
# Put something visible on the canvas
# so we have a sense of what we're seeing.
$canvas create line 0 0 $width $height
$canvas create line 0 $height $width 0
$canvas configure -scrollregion [$canvas bbox all]
lindex {{} {This is a test block:
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
wish scrollingcanvas.tcl
* (eepitch-tclsh)
* (eepitch-kill)
* (eepitch-tclsh)
source scrollingcanvas.tcl
}} 0 ;# End of the test block
# Local Variables:
# coding: utf-8-unix
# End: