Hi List,

Can anyone tell me how could i put the "BACK" button in the following code, 
just under the "AAA" menu? I want this button to go back to the previous page, 
and since it has nothing to do with the "1" and "2" buttons, i want it somehow 
separated from these two buttons, but i don't know how.  I searched the web for 
some examples but my results were unsatisfactory.   

Thank you and have a great day ahead.

#my code
library(tcltk) 
 rm(list=ls())
 top <- tktoplevel(padx=70, pady=70)  
 frameOverall <- tkframe(top)
 frameUpper <- tkframe(frameOverall,relief="groove",borderwidth=2)
 back_but <- tkbutton (frameUpper, text = "BACK", width=20, height=1, 
default="active", overrelief="flat",anchor="w", borderwidth=4 )
 tkgrid(frameUpper)
 tkgrid(frameOverall)
 tkpack (frameUpper, back_but, side='left', anchor='n')
 tkgrid(tklabel(top,text="    ")) 
 fontHeading <- tkfont.create(family="arial",size=14,weight="bold")

 other_window <- function () 
 {
         tkdestroy(top)
         tt <- tktoplevel(padx=100, pady=100)
         b1 <- tkbutton (tt, text = "3.", width=20, font=fontHeading, 
command=function () tkdestroy (tt) )
         tkgrid(b1)
         tkgrid(tklabel(tt,text="    ")) 
         b2 <- tkbutton (tt, text = "4.", width=20, font=fontHeading, 
command=function () tkdestroy (tt) )
         tkgrid(b2)
         tkgrid(tklabel(tt,text="    ")) 
 }
 
 ok.but1 <- tkbutton (top, text = "1.", width=20, 
font=fontHeading,default="active", overrelief="flat", 
anchor="w",command=other_window );tkgrid(ok.but1)
 tkgrid(tklabel(top,text="    ")) 
 ok.but2 <- tkbutton(top, text = "2. ", width=20, font=fontHeading, 
default="active", overrelief="flat", anchor="w"); tkgrid(ok.but2 )
 tkgrid(tklabel(top,text="    ")) 
 
 
 topMenu <- tkmenu(top)
 tkconfigure(top, menu = topMenu)
 fileMenu <- tkmenu(topMenu, tearoff = FALSE)
 openRecentMenu <- tkmenu(topMenu, tearoff = FALSE)  
 tkadd(openRecentMenu, "command", label = "5 ",
     command = function() tkmessageBox(
         message = "xxxxx", icon = "error"))
 tkadd(openRecentMenu, "command", label = "6",
 command = function() tkmessageBox(
         message = "yyyyy", icon = "error"))

 tkadd(fileMenu, "cascade", label = "BBB", menu = openRecentMenu)
 tkadd(fileMenu, "command", label = "EXIT", command = function() tkdestroy(tt))
 tkadd(topMenu, "cascade", label = "AAA", menu = fileMenu)
 # end code

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to