
/* tk_test.q: simple Tk demo program */

/* The `myapp' function takes a string TEXT as argument and creates a button
   labelled TEXT which prints TEXT when pushed. Closing the main window
   terminates `myapp'. */

import tk;

myapp TEXT	= tk (sprintf
		      "button .b -text %s -command {puts %s}; pack .b"
		      (str TEXT,str TEXT)) ||
		  main_loop;

main_loop	= tk_read || main_loop if tk_ready;
		= () otherwise;
