Keith Satterley wrote: > > You might find James Wettenhall's TclTk Examples useful. They are at: > > http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ > I already did; but there's a problem - see the code below. There's no way I can place the "Help" menu in the right of the screen, which I can do using tkmenubutton (but then I can't add commands).
Alberto Monteiro # # Translation of menu example from... # http://gd.tuwien.ac.at/languages/perl/Hajji-Perlkurs/part4/tkperl.html # ... but using the techniques from... # http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/menus.html # library(tcltk) # create a main window mw <- tktoplevel() # a menu consists of a horizontal menubar, # with associated submenus ##### first create the horizontal menubar mb <- tkmenu(mw) tkconfigure(mw, menu = mb) # now put in the menubar some menubuttons # (this works in Perl/Tk but not in R - using tkmenu) m_file <- tkmenu(mb) m_edit <- tkmenu(mb) m_opts <- tkmenu(mb) m_help <- tkmenu(mb) # pack everything from the menubar # (in Perl/Tk but not in R) #### now create the submenus # the file menus tkadd(m_file, "command", label = "New", command = function() { file("new") }) tkadd(m_file, "command", label = "Open", command = function() { file("open") }) #### continue the creation of the horizontal menubar tkadd(mb, "cascade", label = "File", menu = m_file) tkadd(mb, "cascade", label = "Edit", menu = m_edit) tkadd(mb, "cascade", label = "Options", menu = m_opts) tkadd(mb, "cascade", label = "Help", menu = m_help) # there's no way to place in the right side ##### finally, call the main event collecting loop # MainLoop; tkfocus(mw) #### the callbacks file <- function(arg) { cat("file: ", arg, "\n", sep="") } _______________________________________________ R-SIG-GUI mailing list R-SIG-GUI@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-gui