#! /usr/bin/wish proc cancella g {$g delete all} proc cerchio g {$g create oval 60 60 160 160 -fill red} proc poligono g {$g create poly 40 40 120 120 200 40 280 80 \ 200 120 200 160 40 200 80 120 -fill magenta -outline black} proc rettangoli g {$g create rectangle 180 60 240 240 -fill green $g create rectangle 160 100 270 170 -fill blue} wm geometry . 600x300+200+100 bind . exit frame .sopra -bg orange -width 250 pack .sopra -fill x label .sopra.programma -text {Un programma in Tcl/Tk} -bg orange pack .sopra.programma -side left -fill y button .sopra.cerchio -text Cerchio -relief flat -bg coral\ -command {cerchio .sotto.grafica} pack .sopra.cerchio -side left -fill y button .sopra.rettangoli -text Rettangoli -relief flat -bg coral\ -command {rettangoli .sotto.grafica} pack .sopra.rettangoli -side left -fill y button .sopra.poligono -text Poligono -bg coral -command {poligono .sotto.grafica} pack .sopra.poligono -side left -fill y button .sopra.fine -text Fine -command exit -bg peru pack .sopra.fine -side right -fill y button .sopra.cancella -text Cancella -bg coral -command {cancella .sotto.grafica} pack .sopra.cancella -side right -fill y frame .sotto pack .sotto text .sotto.testo -bg #ccff99 -width 40 -borderwidth 5 canvas .sotto.grafica -bg yellow -width 300 -relief sunken -borderwidth 5 pack .sotto.testo -side left pack .sotto.grafica -side right -fill both .sotto.testo insert end "Qui si puo' scrivere: "