Tcl/tk command - checkbutton problem
1
0
Entering edit mode
s_r ▴ 30
@s_r-1236
Last seen 9.7 years ago
Hi. I need help with tk/tcl command - with checkbutton... How can I get status of the checkbutton. I need to know if the checkbutton is selected or not. And I need to have this information in a new variable. Please for examples if sombody know how to do it Thanks! Sebastian ---------------------------------------------------------------------- Daj sie skusic... >>> http://link.interia.pl/f18bc
• 1.6k views
ADD COMMENT
0
Entering edit mode
@keith-satterley-1452
Last seen 9.5 years ago
Australia
Sebastian, Try James Wettenhall's R TclTk Examples at http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ In particular, radio buttons are described here and check boxes are also there. Radio buttons in R TclTk at http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/radiobuttons.html The following example illustrates the use of radio buttons in a tk toplevel window. The choice of radiobutton is mapped to a Tcl variable called rbValue, which is initialized to "oranges", which is the value of the second radio button (i.e. initially, the second radio button will be selected). The OnOK function triggered by the OK button captures the value of the Tcl variable mapped to the radiobuttons (rbValue) before destroying the window. Then it displays an appropriate message box depending on the choice of radiobutton. require(tcltk) tt <- tktoplevel() rb1 <- tkradiobutton(tt) rb2 <- tkradiobutton(tt) rbValue <- tclVar("oranges") tkconfigure(rb1,variable=rbValue,value="apples") tkconfigure(rb2,variable=rbValue,value="oranges") tkgrid(tklabel(tt,text="Which do you prefer?")) tkgrid(tklabel(tt,text="Apples "),rb1) tkgrid(tklabel(tt,text="Oranges "),rb2) OnOK <- function() { rbVal <- as.character(tclvalue(rbValue)) tkdestroy(tt) if (rbVal=="apples") tkmessageBox(message="Good choice! An apple a day keeps the doctor away!") if (rbVal=="oranges") tkmessageBox(message="Good choice! Oranges are full of Vitamin C!") } OK.but <- tkbutton(tt,text="OK",command=OnOK) tkgrid(OK.but) tkfocus(tt) There are lots of other examples as well, cheers, Keith Satterley, Bioinformatics and Genetics, The Walter and Eliza Hall Institute of Medical Research, Melbourne, Victoria, Australia. Sebastian R??ewicz wrote: >Hi. > >I need help with tk/tcl command - with checkbutton... How can I get >status of the checkbutton. I need to know if the checkbutton is selected >or not. And I need to have this information in a new variable. >Please for examples if sombody know how to do it > >Thanks! >Sebastian > >--------------------------------------------------------------------- - >Daj sie skusic... >>> http://link.interia.pl/f18bc > >_______________________________________________ >Bioconductor mailing list >Bioconductor at stat.math.ethz.ch >https://stat.ethz.ch/mailman/listinfo/bioconductor > >
ADD COMMENT

Login before adding your answer.

Traffic: 476 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6