Source You can view the source of this tclet by selecting "View/Source" in your browser menu because this tclet is inline, but for you convenience it is also here: button .b -text "Click Me!" -command changeBg place .b -relx .5 -rely .5 -anchor c proc changeBg {} {. configure -bg [format #%03x [expr int(rand()*(1<<12))]]} (Reminder: To see those demos you need Tcl/Tk Plugin Version 2.0.3 or later and Netscape Navigator/Communicator or Internet Explorer).
button .b -text "Click Me!" -command changeBg place .b -relx .5 -rely .5 -anchor c proc changeBg {} {. configure -bg [format #%03x [expr int(rand()*(1<<12))]]}