Displaying 20 results from an estimated 57 matches for "tkdestroy".
Did you mean:
kdestroy
2008 Aug 11
3
tkentry that exits after RETURN?
...t;- tktoplevel()
pass=tclVar("")
label.widget <- tklabel(tt, text="Enter Password")
password.widget <- tkentry(tt,show="*",textvariable=pass)
ok <- tkbutton(tt,text="OK",default="active",
command=function()tkdestroy(tt))
tkpack(label.widget, password.widget,ok)
tkwait.window(tt)
return(tclvalue(pass))
}
thanks
Ben Bolker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital...
2009 Oct 19
1
Problem with geometry manager in TclTK
...value="2")
tkgrid(tklabel(Choose.frame, text="Format 1 "),file.format1)
tkgrid(tklabel(Choose.frame, text="Format 2 "),file.format2)
tkgrid(Choose.frame)
onOK <- function() {
ReturnFormat <<- tclvalue(file.format)
tkgrab.release(ask.form)
tkdestroy(ask.form)
}
onCancel <- function() {
tkgrab.release(ask.form)
tkdestroy(ask.form)
}
Buttons.frame <- tkframe(ask.form, relief="groove")
OK.but <- tkbutton(Buttons.frame, text = " OK ", command = onOK)
cancel.but <- tkbutton(Buttons.frame, text =...
2006 Aug 02
2
tcl/tk bind destroy event
...ot;question", type="yesnocancel", default="yes")
returnVal <- as.character(returnVal)
if( returnVal == "yes" )
{
# save file
value <- saveFile()
# destroy window when save was successfull
if( value == 1 )
tkdestroy(mw)
}
if( returnVal == "no" )
{
tkdestroy(mw)
}
if( returnVal == "cancel" )
{
# do nothing
cat("Cancel was pressed.\n")
}
}
# bind the destroy event in order to show a message box
tkbind(mw,"<Des...
2009 Apr 14
0
disappearing dialog boxes when using tcltk
...yVarTcl)
tkgrid(tklabel(dlg,text=" "))
tkgrid(tklabel(dlg,text=question),textEntryWidget)
tkgrid(tklabel(dlg,text=" "))
ReturnVal <- returnValOnCancel
onOK <- function()
{
ReturnVal <<- tclvalue(textEntryVarTcl)
tkgrab.release(dlg)
tkdestroy(dlg)
# tkfocus(dlg)
tkfocus(ttMain)
}
OK.but <-tkbutton(dlg,text=" OK
",command=onOK)
tkgrid(OK.but)
tkgrid(tklabel(dlg,text=" "))
tkfocus(dlg)
tkbind(dlg, "<Destroy>", function()
{tkgrab.release(dlg);tkfocus(ttMain)})
tkbind(...
2001 Feb 03
1
callback environment for Tk buttons
...tt <- tktoplevel()
for (i in c("hello", "HALLO"))
tkpack (tkbutton (tt, text=i,
command=function()cat(i,"world\n")), fill="x")
tkpack (tkbutton (tt, text="dismiss",
command=function()tkdestroy(tt)), fill="x")
which is dumb, because the value of i is now always "HALLO" and either
button will cause R to 'cat' HALLO world.
The second try works better:
tt <- tktoplevel()
for (i in c("hello", "HALLO")) {
cb <- eval(substi...
2000 Sep 28
0
No subject
...+ pptlabs <- function() {
+ plot(xd$iv802, xd$PPT)
+ abline(0,1)
+ tt2 <- tktoplevel()
+ tktitle(tt2) <- "Identify Outliers"
+ lab.wid2 <- tklabel(tt2, text="Identify Outliers")
+ but.wid2 <- tkbutton(tt2, text="OK", command=function() tkdestroy(tt2))
+ tkpack(lab.wid2, but.wid2)
+ labp <- identify(xd$iv802, xd$PPT, label=xd$FIPS)
+ dev.print(png, "pptlabs.png", width=600,height=600)
+ }
+
+ templabs <- function() {
+ plot(xd$iv802, xd$AVGT)
+ abline(0,1)
+ tt2 <- tktoplevel()
+ tktitle(tt2) <-...
2008 Dec 22
1
newbie question on tcltk
...rwidth=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, comma...
2000 Sep 29
1
Two tcltk questions and Re: tcltk package functionality
...t, text="x2", value="1", variable="choice")
but.done <- tkbutton(tt, text="FINISHED", command=function(){
tclvar$done <- "T"
tkdestroy(tt)
} )
tkpack(label.widget, rbut.wid1, rbut.wid2, but.done)
# wait until FINISHED is pressed
tclvar$choice <- "0"
tkwait.variable("done")
# plot x1 or x2
if(tclvar$choice == "0") x <- x1
if(tclvar$choic...
2013 Aug 03
1
tk + browser() can leave R unresponsive
...K body (e.g. in Vim run
<<:g/onOK/put ='browser()'>>). That is, transform
onOK <- function() {
res <- 1L + as.integer(tkcurselection(box))
cat("res is: ", res)
ans.select_list <<- choices[res]
tkgrab.release(dlg)
tkdestroy(dlg)
}
to:
onOK <- function() {
browser()
res <- 1L + as.integer(tkcurselection(box))
cat("res is: ", res)
ans.select_list <<- choices[res]
tkgrab.release(dlg)
tkdestroy(dlg)
}
4. Run 'install.packages()'...
2008 Mar 19
1
Radio Buttons or similars
...ble=rbValue,value="oranges")
tkgrid(tklabel(tt,text="Which do you prefer?"))
tkgrid(tklabel(tt,text="Apples "),rb1)
tkgrid(tklabel(tt,text="Oranges "),rb2)
value<-0;
aux_function<- 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!")
print(rbVal);
return(rbVal);
}
OK...
2005 Jun 04
2
locator() via tcltk
...nction(...) {
locator(5)
}
x <- 1:1000
y <- rnorm(1000)
plot(x, y)
base <- tktoplevel()
loc.pts <- tkbutton(base, text = "Get coordinates", command = getcoords)
quit.but <- tkbutton(base, text = "Quit",
command = function() tkdestroy(base))
tkpack(loc.pts, quit.but)
}
I'd like testplot to return the value from getcoords. The "Get
coordinates" button seems to be correctly calling getcoords, and locator
is doing its job, but I don't know how to store its value. Any help is
very much appreciated.
Regards,
Seb...
2007 May 13
1
Dropdown boxes in tcltk and R
...lt;- tktoplevel()
tkgrid(tklabel(tt,text="What's your favorite fruit?"))
fruits <- c("Apple","Orange","Banana","Pear")
comboBox <- tkwidget(tt,"ComboBox",editable=FALSE,values=fruits)
tkgrid(comboBox)
OnOK <- function()
{
tkdestroy(tt)
msg <- paste("Good choice! ",fruitChoice,"s are delicious!",sep="")
tkmessageBox(title="Fruit Choice",message=msg)
}
OK.but <-tkbutton(tt,text=" OK ",command=OnOK)
tkgrid(OK.but)
tkfocus(tt)
tkwait.window(tt)
fruitChoice <...
2007 Sep 19
1
Running tcltk From a batch file
Hi,
I am trying to run some simple tktcl code....
## in a file called test.R
require(tcltk)
tt <- tktoplevel()
OK.but <- tkbutton(tt,text="OK",command=function()tkdestroy(tt))
tkgrid(OK.but)
tkfocus(tt)
Using a batch file with the command
Rterm < test.R > testOutput.Rout --slave
The GUI pops up but then disappears. The results in the test.Output.Routfile are
> # Load the tcltk package
> require(tcltk)
Loading required package: tcltk
[1] TRUE
>
>...
2008 Jul 22
1
tklistbox and extracting selection to R
...t;white")
tkgrid(tklabel(tt,text="Select the legend of" ))
tkgrid(tl)
treatments<<-levels.tx
for(i in (1:ntx))
{
tkinsert(tl,"end",treatments[i])
}
OnOK<-function()
{
tx.choice1<<-treatments[as.integer(tkcurselection(tl))+1]
tkdestroy(tt)
}
OK.but<-tkbutton(tt,text=" OK ", command=OnOK)
tkgrid(OK.but)
tx.choice1
the console can't find tx.choice1, but if I type tx.choice1 directly into the console, it returns the value I selected from the list.
I am running R 2.7.1, OS: linnux, I...
2004 Jun 09
1
Using macros
...ncel=onCancel,
helpButton=helpButton, onHelp=onHelp, helpSubject,
expr={
OKbutton <- tkbutton(window, text="OK", fg="darkgreen",
width="12", command=onOK, default="active")
onCancel <- function() {
tkdestroy(top)
}
cancelButton <- tkbutton(window, text="Cancel", fg="red",
width="12", command=onCancel)
onHelp <- function() {
help(helpSubject)
}
helpButton <- tkbutton(window, text...
2002 Sep 26
3
tcltk - command=function()
...t;- tktoplevel()
label.widget <- tklabel(tt,text="Decision Tree GUI")
button.widget <- tkbutton(tt,text="Select SPSSFile",
command=function() read.spss("C:/Cummulative/data/wekaSpecial.sav",
use.value.label=T,to.data.frame=T))
tkpack(label.widget,button.widget)
tkdestroy(tt))
....how i have to use command=function() that this works like
cat command ( i get no error message but nothing happen),or better
how can i replace it with tkgetOpenFile and do than an assignment
to a read.table,read.delim or read.spss command ?
i experiment with deparse and substitute,...
2000 Sep 28
1
tcltk package functionality
...oose!")
pptlabs <- function() {
plot(xd$iv802, xd$PPT)
abline(0,1)
tt2 <- tktoplevel()
tktitle(tt2) <- "Identify Outliers"
lab.wid2 <- tklabel(tt2, text="Identify Outliers")
but.wid2 <- tkbutton(tt2, text="OK", command=function() tkdestroy(tt2))
tkpack(lab.wid2, but.wid2)
labp <- identify(xd$iv802, xd$PPT, label=xd$FIPS)
dev.print(png, "pptlabs.png", width=600,height=600)
}
templabs <- function() {
plot(xd$iv802, xd$AVGT)
abline(0,1)
tt2 <- tktoplevel()
tktitle(tt2) <- "Identify Outl...
2005 Sep 05
1
tcltk, X11 protocol error: Bug?
...lt;- 0
for(i in 1:n.col){
##item <-
tkitemconfigure(canvas.r,barlst[[i]],fill=rmpcol[i],outline=rmpcol[i])
#xl <- xl+inc
}
}
save.ramp <- function(){
cr<<-colorRampPalette(c(b.color,e.color),space="Lab",interpolate="spline")
tkdestroy(tt)
##invisible(cr)
}
tt <- tktoplevel()
tkwm.title(tt,"Color Ramp Tool")
frame <- tkframe(tt)
bframe <- tkframe(frame,relief="groove",borderwidth=1)
if(is.null(b.color)) b.color <- "blue"
if(is.null(e.color)) e.color <- "yellow&...
2003 Jun 06
4
stuck tcltk scrollbars under Windows XP
...ted is to grab the focus -- e.g., by
tkfocus(top)
tkgrab(top)
(Here, top is a top-level window -- say, containing one or more
scrollbars.) When the window is closed, I release the focus, destroy the
window, and return the focus to another window -- e.g.,
tkgrab.release(top)
tkdestroy(top)
. . .
tkfocus(.commander)
(Here .commander is a top-level window residing in the global environment.)
This procedure works fine under Windows 2000 -- where I've done most of the
testing of the Rcmdr package under Windows -- but I received a report of a
problem from a Windows...
2008 Jul 18
0
Retrieving data from a tcl /tk function
..., text = " "))
tkgrid(tklabel(dlg, text = question), textEntryWidget)
tkgrid(tklabel(dlg, text = " "))
ReturnVal <- returnValOnCancel
onOK <- function() {
ReturnVal <<- tclvalue(textEntryVarTcl)
tkgrab.release(dlg)
tkdestroy(dlg)
tkfocus(ttMain)
}
onCancel <- function() {
ReturnVal <<- returnValOnCancel
tkgrab.release(dlg)
tkdestroy(dlg)
tkfocus(ttMain)
}
OK.but <- tkbutton(dlg, text = " OK ", command = onOK)
Cancel.but <- tkbutton...