Displaying 20 results from an estimated 40 matches for "tkbind".
2025 Jan 21
1
[tcltk] binding two functions to one event
...u already realized...
I'm not even sure whether the "+" in bind .... +script is syntactically an operator or part of the command.
However, it is usually not right to define named functions on the Tcl side and mix them with the ones R/Tcl interface generate.
So I am thinking that if tkbind('all','<<EVENT>>',evresp1) works, then to add evresp2, you just need to get a "+" into whatever the evresp2 gets converted to.
And...
> tkbind('all','<<EVENT>>',evresp1)
<Tcl>
> tkbind('all','<<EVENT...
2005 Dec 09
1
tkbind key pressed
Hi,
I see in Wettenhall RTclTk Examples that tkbind(xxx, <Key>,...) can pass the key pressed. How can I get the key pressed?
Thanks,
Manel
2025 Jan 20
1
[tcltk] binding two functions to one event
...led in response to the event and both
got the data.
Then paste the following into an R session
### begin R code
library(tcltk)
catn = function(...) { cat(...,'\n') }
wtop = tktoplevel()
evresp1 = function(d) { catn('evresp1',d) }
evresp2 = function(d) { catn('evresp2',d) }
tkbind('all','<<EVENT>>',evresp1)
.Tcl(paste('proc evresp2 { d } { ', .Tcl.callback(evresp2),'}'))
.Tcl('bind all <<EVENT>> "+evresp2 %d"')
### end R code
The .Tcl() calls are necessary (as far as I can tell) to get the
effect of &...
2009 Oct 19
1
Problem with geometry manager in TclTK
...<- tkbutton(Buttons.frame, text = " OK ", command = onOK)
cancel.but <- tkbutton(Buttons.frame, text = "Cancel", command = onCancel)
tkgrid(cancel.but, OK.but, ipadx=20)
tkgrid(Buttons.frame)
print(as.integer(tclvalue(tkwinfo("height", ask.form))))
tkbind(ask.form, "<Destroy>", function() onCancel)
tkbind(ask.form, "<KeyPress-Return>", onOK)
tkbind(ask.form, "<KeyPress-Escape>", onCancel)
tkwait.window(ask.form)
return(ReturnFormat)
}
inputDialog <- function() {
input <- tktoplevel...
2008 Aug 11
3
tkentry that exits after RETURN?
I can set up an entry widget (thanks to an old
post by Barry Rowlingson) that gets a password and
exits when the user clicks on the "OK" button.
Anyone have any clever ideas for returning/
destroying the window when the user types a carriage
return/ENTER in the text window? I've messed around
a little with validate, validatecommand, but don't
see any obvious way to do it ...
2001 Feb 22
2
Problem with tcltk listbox
...t[i,1],resultset[i,2],sep="."))
i<- i+1
}
tkconfigure(prot.listbox,yscrollcommand=paste(.Tk.ID(prot.yscroll),"set"))
tkconfigure(prot.yscroll,command=paste(.Tk.ID(prot.listbox),"yview"))
tkpack(prot.yscroll,prot.listbox,side="left",fill="y")
tkbind(prot.listbox,"<Button-1>",function()
{
protas.listbox<-tklistbox(anzeigeframe,exportselection="0")
protas.yscroll<-tkscrollbar(anzeigeframe)
tkconfigure(protas.listbox,yscrollcommand=paste(.Tk.ID(protas.yscroll),"set"))
tkconfigure(protas.yscroll,co...
2003 Jan 20
0
Tcl/Tk and mouse
...<-tktoplevel()
show <-tklabel (top,textvariable=number)
up <-tkbutton(top,text="up")
down <-tkbutton(top,text="down")
exit <-tkbutton(top,text="exit",command=function()
tclvalue(state)<-"exit" )
tkpack(show,up,down,exit)
tkbind(up, "<Enter>",function() tclvalue(state)<-"up" )
tkbind(up, "<Leave>",function() tclvalue(state)<-"relax" )
tkbind(down,"<Enter>",function() tclvalue(state)<-"down" )
tkbind(down,"<Leave>"...
2003 Nov 30
1
tcltk problem with <Button-2>
...changes to B when pressed
pressed <- function() tkconfigure( tt.but, text="B" )
tt.but <- tkbutton( tt, text="A", command=pressed )
tkpack(tt.but)
# if Control-Button-1 pressed change button label to C
e <- expression( tkconfigure( tt.but, text="C" ), break )
tkbind(tt.but, "<Control-Button-1>", e )
But if I simply replace Control-Button-1 with Button-2 in the tkbind
command, i.e. the last line, then nothing happens when I press
Button-2 (which I assume is the right mouse button).
I also tried removing the break and using a function instead...
2016 Apr 29
2
tcltk: click and return table cell index
I'm struggling mightily with what should be a simple task...when a user
clicks on a cell in a tcltk table widget, I need to know which cell was
clicked.
One idea that gives a cryptic error:
tkbind(table1, "<Button-1>", function(x, y){
tcl(table1, "index", x, y)
}
# x, y give pixel coordinates; "index" should give cell coordinates, but
format must be correct
I get an error message:
wrong # args: should be ".25.1 index <index> ?row|col?"...
2009 Apr 28
1
[macosx] improving quartz & Aqua Tk behaviour outside of RGui
Hello,
On Mac OS X, certain Aqua/Quartz UI functionality requires an
application to be launched from within an app bundle, or
(alternatively) requires a Carbon application with a resource fork.
Playing with the wxWidgets distribution, I discovered that it is quite
easy and transparent to make such a Carbon app from (I guess) any
command line application. When applied to the R executable called
2009 Apr 28
1
[macosx] improving quartz & Aqua Tk behaviour outside of RGui
Hello,
On Mac OS X, certain Aqua/Quartz UI functionality requires an
application to be launched from within an app bundle, or
(alternatively) requires a Carbon application with a resource fork.
Playing with the wxWidgets distribution, I discovered that it is quite
easy and transparent to make such a Carbon app from (I guess) any
command line application. When applied to the R executable called
2006 Aug 02
2
tcl/tk bind destroy event
...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,"<Destroy>",exitProg)
# menu item which works fine
tkadd(fileMenu, "command", label="Quit", command=exitProg)
Thank you.
Franco Mendolia
2012 May 24
3
set tkscale by tkentry
Hi, I am working under Windows and I am using R2.11
I want to use tkscale in my GUI. As the interval is quite big, I can't set
the scale to a certain specific value. Therefore I want to add tkentry to
allow the user to set tkscale to a certain value.
Here is the code
library(tcltk)
tt<-tktoplevel()
tkpack(m1<-tkscale(tt,from=306870.00, to=3026741, label="alpha",
2003 Jun 06
4
stuck tcltk scrollbars under Windows XP
...OK", width="12", command=onOK,
default="active")
tkgrid(xBox, xScroll, sticky="nw")
tkgrid.configure(xScroll, sticky="ns")
tkgrid(xFrame, sticky="w")
tkgrid(OKbutton, sticky="w")
tkselection.set(xBox, 0)
tkbind(window2, "<Return>", onOK)
tkfocus(window2)
tkgrab(window2)
I find that I can make the scrollbar stick under Windows XP by repeatedly
and rapidly pressing the scroll-down button. As mentioned, removing the
calls to tkgrab() and tkgrab.release() seems to eliminate the pr...
2005 Jan 08
1
coordinates of mouse position
...the script in Tcl is:
set w .probe
catch {destroy $w}
toplevel $w
proc Captura_Datos { ancho alto } {
puts "El ancho es $ancho"
puts "El alto es $alto"
} bind $w <Configure> "Captura_Datos %X %Y"
In R
w<-tktoplevel()
f<-function(a,b)^`
print(a)
print(b)
tkbind(w,"<Configure>",f(%X,%Y))
Not works. How to do this? thanks Ruben
2005 Oct 27
1
tree widget question
I'm trying to create an app using TclTk and R
Can someone please explain how I bind a click event to the tree widget
(http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/TreeWidget.html)
Ideally I'd like to bind to particular elements in the tree but tkbind
doesnt seem to work.
thanks
tom
2008 Jul 18
0
Retrieving data from a tcl /tk function
...y(dlg)
tkfocus(ttMain)
}
OK.but <- tkbutton(dlg, text = " OK ", command = onOK)
Cancel.but <- tkbutton(dlg, text = " Cancel ", command = onCancel)
tkgrid(OK.but, Cancel.but)
tkgrid(tklabel(dlg, text = " "))
tkfocus(dlg)
tkbind(dlg, "<Destroy>", function() {tkgrab.release(dlg); tkfocus(ttMain)})
tkbind(textEntryWidget, "<Return>", onOK)
tkwait.window(dlg)
return(ReturnVal)
}
# Create a "main" window with a button which activates our dialog
require(tcltk)
ttMain <-...
2009 Apr 14
0
disappearing dialog boxes when using tcltk
...nction()
{
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(textEntryWidget, "<Return>", onOK)
tkwait.window(dlg)
return(ReturnVal)
}
##===============================================
## main function
##======================================...
2005 Apr 01
0
Selections from tcltk list boxes
...rint(tclvalue(value))
return()
}
onSelect <- function(){
selection <- letters[1:10][as.numeric(tkcurselection(listbox)) + 1]
tclvalue(value) <- selection
}
OK <- tkbutton(top, text="OK", command=onOK)
tkgrid(listbox, entry, sticky="nw")
tkgrid(OK)
tkbind(listbox, "<ButtonPress-1>", onSelect)
As I understand it, single-clicking on an entry in the list box should
execute onSelect(), placing the selection in the entry box. What happens
instead is that one has to click twice on the entry, once (apparently) to
move the highlight to it a...
2008 Aug 14
1
Double-clicking in tk list dialogs
...ror in the dialog for choosing a CRAN mirror? Yes, double-clicking
works in Windows, but not in the Tk-based dialog on Linux. I'm going
to wear out my mouse button.
Adding the following line to the tk_select.list function in the tcltk
package adds double-click functionality to list dialogs:
tkbind(box, "<Double-ButtonPress-1>",onOK)
(put it in the right place though, after 'box' has been created).
Not sure if this would be a default behaviour, or if its's worth
having a 'doubleClick=FALSE' argument that switches it on if TRUE.
Anyway, it was a little n...