This is a modified repost of a post I did in r.general (think this is a better place)
Dear list, 1) Does someone know why, in my below code, tkpack can hang (consuming 100% cpu)? It also hangs without the fill="both",expand=T. Then, if I replace it by tkgrid, it works! 2) After replacing by tkgrid, I tried to add sticky="news", but that does not help at all, notebook is not resized when the window is. (and it did not help to add fill/expand to packing of tbw.algemeen/tab.algemeen etc.) 3) If I do not raise all of the tabs in the notebook, they are all displayed on the first tab initially (also if I raise only once). As you can see below, I found an ugly hack, but I would like to know why this goes wrong and how to solve it. Thanks very much, JeeBee. require(tcltk) || stop("Package tcltk is not available.") # Add path to BWidgets addTclPath(".") 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") 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)) gui.maak.tab(tab.algemeen) gui.maak.tab(tab.relaties) gui.maak.tab(tab.posten) gui.maak.tab(tab.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-SIG-GUI mailing list R-SIG-GUI@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-gui