Hi, I want to create my own RGUI, so I?m using tcltk for that. In a very simple example, I want to get the response of a function into a tktext, so I have done this: data<-c(2,3,5,2) tt<-tktoplevel text<-tktext(tt) tkpack(text) sum(data) How can I get the output of sum(data) in my tktext?? Thanks! Jes?s [[alternative HTML version deleted]]
Jesús Para Fernández
2015-Oct-22 08:52 UTC
[R] Announcement - The Use Of Nabble For Posting To R-Help Will
Nice [[alternative HTML version deleted]]
Hi, require(tcltk) data<-c(2,3,5,2) PressedOK <- function() { tkmessageBox(message=sum(data)) } tt <- tktoplevel() OK.but <- tkbutton(tt,text="OK",command=PressedOK) tkgrid(OK.but) tkfocus(tt) Please take a look in examples: http://mcu.edu.tw/~chenmh/teaching/project/r/reference/RTclTkExamples/ Karim On Thu, Oct 22, 2015 at 9:49 AM, Jes?s Para Fern?ndez < j.para.fernandez at hotmail.com> wrote:> Hi, > > I want to create my own RGUI, so I?m using tcltk for that. > > In a very simple example, I want to get the response of a function into a > tktext, so I have done this: > data<-c(2,3,5,2) > tt<-tktoplevel > text<-tktext(tt) > tkpack(text) > sum(data) > > How can I get the output of sum(data) in my tktext?? > > Thanks! > Jes?s > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]
Thanks, but it does?nt do what I want. What I wnat is to insert it into a tktext. Jes?s Date: Thu, 22 Oct 2015 10:06:20 +0100 Subject: Re: [R] Get the output of a function in R GUI From: kmezhoud at gmail.com To: j.para.fernandez at hotmail.com CC: r-help at r-project.org Hi, require(tcltk) data<-c(2,3,5,2) PressedOK <- function() { tkmessageBox(message=sum(data)) } tt <- tktoplevel() OK.but <- tkbutton(tt,text="OK",command=PressedOK) tkgrid(OK.but) tkfocus(tt) Please take a look in examples: http://mcu.edu.tw/~chenmh/teaching/project/r/reference/RTclTkExamples/ Karim On Thu, Oct 22, 2015 at 9:49 AM, Jes?s Para Fern?ndez <j.para.fernandez at hotmail.com> wrote: Hi, I want to create my own RGUI, so I?m using tcltk for that. In a very simple example, I want to get the response of a function into a tktext, so I have done this: data<-c(2,3,5,2) tt<-tktoplevel text<-tktext(tt) tkpack(text) sum(data) How can I get the output of sum(data) in my tktext?? Thanks! Jes?s [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. [[alternative HTML version deleted]]
On 22 Oct 2015, at 10:49 , Jes?s Para Fern?ndez <j.para.fernandez at hotmail.com> wrote:> Hi, > > I want to create my own RGUI, so I?m using tcltk for that. > > In a very simple example, I want to get the response of a function into a tktext, so I have done this: > data<-c(2,3,5,2) > tt<-tktoplevel > text<-tktext(tt) > tkpack(text) > sum(data) > > How can I get the output of sum(data) in my tktext??For instance with tkinsert(text, "end", sum(data)) However, you need to reach out for a Tcl/Tk reference manual to sort out the mysteries of the index argument and of the widget subcommands in general. -pd> > Thanks! > Jes?s > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Thanks, but just one more question How can I catch the response and put it on a tktext? Imagien there is a function that the response is an error, how can i catch this error and manage it? Thanks!> From: pdalgd at gmail.com > Subject: Re: [R] Get the output of a function in R GUI > Date: Thu, 22 Oct 2015 11:17:34 +0200 > CC: r-help at r-project.org > To: j.para.fernandez at hotmail.com > > > On 22 Oct 2015, at 10:49 , Jes?s Para Fern?ndez <j.para.fernandez at hotmail.com> wrote: > > > Hi, > > > > I want to create my own RGUI, so I?m using tcltk for that. > > > > In a very simple example, I want to get the response of a function into a tktext, so I have done this: > > data<-c(2,3,5,2) > > tt<-tktoplevel > > text<-tktext(tt) > > tkpack(text) > > sum(data) > > > > How can I get the output of sum(data) in my tktext?? > > > For instance with > > tkinsert(text, "end", sum(data)) > > However, you need to reach out for a Tcl/Tk reference manual to sort out the mysteries of the index argument and of the widget subcommands in general. > > -pd > > > > > Thanks! > > Jes?s > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > -- > Peter Dalgaard, Professor, > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Office: A 4.23 > Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com > > > > > > > > >[[alternative HTML version deleted]]