Tcl/Tk Hello world in a line

Creating classic hello world program using GUI in Tcl/Tk can be done in few lines or may be only a line !

Oneliner can do below.

pack [button .b1 -text “Hello World” -command exit -width 50]

This line can be read : pack a button named .b1 with hello world text and exit command when clicked.

Save it to hello_oneline.tcl then run on command prompt : wish hello_oneline.tcl.

Voila!

Click the button and the window will close.

Bye ..

Leave a Reply

Your email address will not be published. Required fields are marked *