Hey there, I’m quite lost in the R tcltk package and would love to get some help. My problem is this: Total_substes = 5 # example subcounter=1 # while the maximum number of subsets is not reached put buttons onto the tt widget while (subcounter <= total_subsets) { subname = paste("subset ", 1:total_subsets, sep = "") subnameasstring2 <- subname[subcounter] toString(subnameasstring2) subname.button = paste("subnameasstring2",".button", sep = "") subname.button <- tkbutton(tt,text=subnameasstring2, command=function() iconfigure(vhight, vwidth, vanzheight, vanzwidth, total_number_iplots_onscreen, subcounter)) tkgrid(subname.button)
subcounter = subcounter +1 } I create dynamic buttons but when I press them the value of i.e. subcounter is overritten by the last value assignment Button subset_1.button gives me in this case when I press it 6 and that’s obviously wrong because it should be 1. Has anybody an idea how I can solve that? Btw: The goal is to spread isets onto the screen (but a lot of them) ______________________________________________ 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.