Graphical message boxes with R package tcltk

February 29, 2012

(This article was first published on W. Andrew Barr's Paleoecology Blog, and kindly contributed to R-bloggers)

Sometimes you just need a graphical messagebox....know what I mean? If only because it pops up in front of all the other open windows and alerts you to the fact that your R script is waiting for you to do something, or is finished doing something else.

The R package "tcltk" is the easiest way I have found to do this.  On Mac OSX you need to first install the Universal Tcl/Tk for X11(available here).  I haven't tried it on Windows, but I don't think this extra step is necessary.  Now just install the R package "tcltk" in the normal way, for example


Now you should have access to functions like this.....
tk_messageBox(type="ok",message="I am a tkMessageBox!")

There are different types of messagebox (yesno, okcancel, etc). See ?tk_messageBox.

To leave a comment for the author, please follow the link and comment on his blog: W. Andrew Barr's Paleoecology Blog. offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.