Re: [tcltk-perl] Package Img
Brought to you by:
hobbs
From: Jeff H. <je...@Ac...> - 2004-09-02 15:15:44
|
Paul Falbe wrote: > Would you happen to have a example of a scribble program using perl Tcl/TK? Not in Perl Tcl::Tk, but this is so simple the translation should be easy: From http://wiki.tcl.tk/9625 proc doodle {w {color black}} { bind $w <1> [list doodle'start %W %x %y $color] bind $w <B1-Motion> {doodle'move %W %x %y} } proc doodle'start {w x y color} { set ::_id [$w create line $x $y $x $y -fill $color] } proc doodle'move {w x y} { $w coords $::_id [concat [$w coords $::_id] $x $y] } pack [canvas .c -bg white] -fill both -expand 1 doodle .c bind .c <Double-3> {%W delete all} Anyone undertaking the exercise should post it back here for others to see the translation. -- Jeff Hobbs, The Tcl Guy http://www.ActiveState.com/, a division of Sophos |