Posted to tcl by h1rag4mi at Wed Oct 30 09:40:15 GMT 2019view pretty
toplevel .t canvas .t.can set point_size 10 set zoom_out_factor 4 set square_size [expr {256 / $zoom_out_factor}] set entry_width 80 set entry_height 20 for {set y 0} {$y < $square_size} {incr y} { for {set x 0} {$x < $square_size} {incr x} { .t.can create rect [expr {$x * $point_size}] [expr {$y * $point_size}] [expr {($x + 1) * $point_size}] [expr {($y + 1) * $point_size}] -outline black -fill white } } place .t.can -x 0 -y 0 -width [expr {$square_size * $point_size}] -height [expr {$square_size * $point_size}] entry .t.l place .t.l -width $entry_width -x [expr {($square_size * $point_size - $entry_width) / 2}] -height $entry_height -y [expr {($square_size * $point_size - $entry_height) / 2}] wm geometry .t "[expr {$square_size * $point_size}]x[expr {$square_size * $point_size}]"