Consider:
require(gWidgets2)
w <- gwindow("notebook example", visible=T)
nb <- gnotebook(container=w)
gbutton("Page one", label="tab 1", container=nb) ## note label argument
gbutton("Page two", label="tab 2", container=nb)
How can I bind a given key (say, ESC
) to close the gwindow()
in gWidgets, that is to execute dispose(w)
? In other words, how do you assign keybindings in gWidgets?
As per the accepted answer, I had to:
Then bring up the
w
window and hitESC
, then in thebrowser()
terminal:And notice that:
Then the following handler does what I want:
As per how to program window to close with escape key and How to define ESC char in git?, it seems that
ESC
is often captured as\033
.With RGtk2 (and possibly others) the
addHandlerKeystroke
method can be used to catch keystrokes. You have to dig into theh
object to capture theESC
key. There isn't any portable code for that, but the Gtk docs should be able to help.