[R] Some R-Tcl/Tk-BWidget newbie questions.

From: JeeBee <JeeBee_at_troefpunt.nl>
Date: Thu 22 Jun 2006 - 07:52:52 EST

Dear list,

Could somebody who is more experienced with the Tcl/Tk interface from R please help me clarify the issues I've put below with ### --> tags?

Several things go wrong, and it's probably because of messy code, but I have a difficult time finding out what is the cause.

Thanks very much,

require(tcltk) || stop("Package tcltk is not available.") # Add path to BWidgets
version.BWidget <<- tclvalue(tclRequire("BWidget"))

start.gui <- function() {
  # Toplevel
  tt <- tktoplevel()
  tkwm.title(tt, "MyTitle")

  # Notebook

### --> The following line makes R hang with 100% cpu forever
  #tkpack(tn <- tkwidget(tt, "NoteBook"), fill="both", expand=TRUE)

### --> This works, but not sticky="news",
### --> the notebook does not resize together with the window
  tn <- tkwidget(tt, "NoteBook")
  tkgrid(tn, sticky="news")

### --> I guess there is a simpler way to do this ...
  tbn <- tclvalue(tkinsert(tn, "end", "Algemeen", "-text", "Algemeen"))   tkpack(tbw.algemeen <- .Tk.newwin(tbn))   tkpack(tab.algemeen <- tkframe(tbw.algemeen))   tbn <- tclvalue(tkinsert(tn, "end", "Relaties", "-text", "Relaties"))   tkpack(tbw.relaties <- .Tk.newwin(tbn))   tkpack(tab.relaties <- tkframe(tbw.relaties))   tbn <- tclvalue(tkinsert(tn, "end", "Posten", "-text", "Posten"))   tkpack(tbw.posten <- .Tk.newwin(tbn))
  tkpack(tab.posten <- tkframe(tbw.posten))   tbn <- tclvalue(tkinsert(tn, "end", "Instellingen", "-text", "Instellingen"))   tkpack(tbw.instellingen <- .Tk.newwin(tbn))   tkpack(tab.instellingen <- tkframe(tbw.instellingen))


  tkgrid(tkbutton(tt, text="GUI bijwerken",     command=function() verwerk.button("GUIBijwerken", tt)))

  # FIXME: add cleanup handler?
  #tkbind(tt, "<Destroy>", function() tkdestroy(tn))

### --> Don't understand this ... if I do the last "raise" only,
### --> then I see all tabs in the first tab, until I go to another
### --> tab and back. With all these "raises", it works

  tcl(tn, "raise", "Instellingen")
  tcl(tn, "raise", "Posten")
  tcl(tn, "raise", "Relaties")
  tcl(tn, "raise", "Algemeen")


gui.maak.tab <- function(tt) {
  tkgrid(tklabel(tt, text="Instellingen"), sticky="news")   test.button <- tclVar("one two")
  tkgrid(tkcheckbutton(tt,variable=test.button)) }

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jun 22 08:14:55 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 22 Jun 2006 - 10:12:00 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.