Version 5 of World-wide whiteboard

Updated 2002-08-29 15:25:11

http://mini.net/files/chatcanvas.jpg "cool" and "handwriting" by dkf, "very" by RS, "Bye" by stevel, all in a few minutes...


n the Tcl chatroom we wanted to exchange drawings too, so here's an ultra quick shot we came up with:

 proc transmit {w id} {
     set ::entry "\$white_board create line [string map {.0 {}} [$w coords $id]]"
    .e selection range 0 end
 }
 entry .e -textvar entry -bg white
 bind .e <Return> {eval $entry}
 set white_board [canvas .c -bg white]
 bind .c <1> {set entry ""; set id [%W create line %x %y %x %y]}
 bind .c <B1-Motion> {%W coords $id [concat [%W coords $id] %x %y]}
 bind .c <ButtonRelease-1> {transmit %W $id}
 pack .e .c -fill both -expand 1

Test data:

 $white_board create line 190.0 142.0 190.0 142.0 189.0 142.0 187.0 143.0 186.0 143.0  184.0 144.0 180.0 145.0 177.0 146.0 175.0 148.0 173.0 150.0 171.0 152.0 171.0 154.0 171.0 156.0 171.0 157.0 171.0 158.0 171.0 160.0 172.0 161.0 173.0 162.0 174.0 163.0 175.0 163.0 176.0 164.0 178.0 164.0 179.0 164.0 181.0 164.0 183.0 163.0 184.0 162.0 186.0 162.0 188.0 161.0 189.0 161.0 190.0 160.0 191.0 159.0 192.0 158.0 193.0 158.0 194.0 157.0 194.0 156.0 194.0 154.0 195.0 153.0 196.0 152.0 197.0 151.0 198.0 150.0 200.0 150.0 202.0 149.0 203.0 149.0 204.0 148.0 205.0 148.0 206.0 148.0 204.0 148.0 202.0 148.0 199.0 148.0 196.0 148.0 195.0 149.0 193.0 150.0 191.0 150.0 191.0 152.0 191.0 153.0 191.0 154.0 191.0 156.0 192.0 157.0 193.0 158.0 194.0 160.0 195.0 161.0 196.0 162.0 198.0 162.0 199.0 163.0 200.0 163.0 202.0 163.0 204.0 162.0 206.0 162.0 207.0 160.0 208.0 159.0 208.0 157.0 208.0 156.0 208.0 155.0 208.0 154.0 207.0 153.0 206.0 152.0 205.0 151.0 204.0 150.0 203.0 150.0 203.0 149.0 204.0 149.0 205.0 149.0 206.0 149.0 207.0 149.0 209.0 149.0 211.0 150.0 214.0 150.0 217.0 150.0 219.0 150.0 220.0 150.0 221.0 149.0 223.0 149.0 224.0 149.0 223.0 150.0 222.0 150.0 221.0 151.0 219.0 152.0 218.0 153.0 217.0 154.0 217.0 155.0 217.0 156.0 217.0 157.0 218.0 158.0 218.0 159.0 219.0 159.0 219.0 160.0 219.0 161.0 220.0 161.0 221.0 161.0 222.0 161.0 223.0 161.0 224.0 160.0 225.0 159.0 226.0 158.0 227.0 157.0 227.0 156.0 227.0 155.0 226.0 154.0 226.0 153.0 225.0 152.0 223.0 151.0 222.0 150.0 221.0 150.0 220.0 150.0 221.0 150.0 222.0 150.0 223.0 150.0 224.0 150.0 225.0 150.0 226.0 150.0 227.0 150.0 228.0 150.0 229.0 150.0 230.0 150.0 231.0 150.0 233.0 149.0 233.0 148.0 235.0 147.0 235.0 146.0 235.0 145.0 236.0 144.0 237.0 141.0 238.0 139.0 239.0 137.0 240.0 135.0 240.0 134.0 240.0 132.0 239.0 130.0 238.0 128.0 238.0 127.0 238.0 125.0 237.0 124.0 236.0 126.0 235.0 129.0 235.0 132.0 235.0 135.0 235.0 138.0 235.0 140.0 236.0 142.0 236.0 144.0 236.0 147.0 237.0 149.0 237.0 151.0 238.0 153.0 238.0 155.0 239.0 157.0 239.0 158.0 240.0 159.0 241.0 160.0 242.0 161.0 242.0 160.0 242.0 159.0