0

I am working on a program that utilizes Tcl TK GUI interface in R. I would like to call some commands when the user presses the big red exit button in the GUI interface. Is the exit button hard coded by the programmer or is it innately a feature of the Tcl TK package? I.e., would I be able to add exit commands when this button is pushed? How would I go about doing that? I perused through the code I was tasked to understand, and I could not seem to find this feature. If it is not hard coded, are there any other avenues I could explore to execute commands upon closure of the GUI application?

hkj447
  • 677
  • 7
  • 21
  • @MrFlick This isn't an error I am experiencing, rather I want to understand more about how TclTK gui applications work, specifically in the closure of the program. – hkj447 Feb 10 '20 at 16:06
  • Unfortunately, the problem is that I do not know what that code would be. I am just curious specifically about the closure of a R TclTK GUI, of any shape or size, as a quick google search yielded no responses in respect to the "big red exit button". – hkj447 Feb 10 '20 at 16:13
  • 2
    `tkbutton` has a `command=` argument. Give it tghe name of a function which has no arguments that contains the code you want to run when the button is pushed. If `tt <- toplevel()` then `tkdestroy(tt)` can be used to shut down the GUI. – G. Grothendieck Feb 10 '20 at 17:15

0 Answers0