I searched the web and the list archives for a solution to this, but didn't see anything, so here goes. I'm new to tcltk. I'm trying to change the contents of a tkentry widget when a button is pressed. Once I get that working, the widget will be read only to the user. Here is some toy code:

###############
require(tcltk)
thisEnv=environment()
tt<-tktoplevel()
Name <- tclVar("Anonymous")
entry.Name <-tkentry(tt,width="20",textvariable=Name)
tkgrid(entry.Name)
OnChange <- function()
{
   assign("Name",tclVar("changed name"),thisEnv)
}
Change.but <-tkbutton(tt,text="   Change   ",command=OnChange)
tkgrid(Change.but)
tkfocus(tt)
##################
(much of this is taken from http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/editboxes.html)

Now, I thought the whole point of the textvariable argument was to change the content of the tkentry widget. But, as you can see by running this code, changing the Name variable using assign does not change the content of the widget.

Is there a function to update the content? tkinsert didn't seem to work when I tried it.

Thanks,
Richard Morey

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to