stk/Contrib/STk-wtour/lessons/text5.stk

20 lines
598 B
Plaintext
Raw Normal View History

1996-09-27 06:29:02 -04:00
;;; A basic text widget, with tag bindings
(text '.text :yscrollcommand (lambda l (apply .scroll 'set l)) :wrap "word")
(scrollbar '.scroll :relief "flat" :command (lambda l (apply l .text 'yview l)))
(pack .scroll :side "right" :fill "y")
(pack .text :expand #t :fill "both")
(.text 'insert 'current
"This is a text widget, with some tagged text:\n\n\n\n
Press me!!!")
(.text 'tag 'configure 'footag :relief "raised" :borderwidth 3 :background "bisque")
(.text 'tag 'add 'footag "end-1l linestart" "end-1c")
(.text 'tag 'bind 'footag "<ButtonPress-1>" (lambda () (display "Gotcha!\n")))