The following R code maps the
OK button of a Tk toplevel window to a R function which displays a message box. We give a minimum size of six characters for the button (by using a negative value for its
The toplevel window is shown below. We have not given it a title (using
tkwm.title()), so the title bar displays the Tcl ID for this window, which is
1 in this case.
The result of pressing OK is shown below:
To close the tk window from within R, use: