OSX 10.10.2 R 3.1.3 XQuartz installed. I am trying to run one of the tcltk demos This one works: tt <- tktoplevel() label.widget <- tklabel(tt, text = "Hello, World!") button.widget <- tkbutton(tt, text = "Push", command = function()cat("OW!\n")) tkpack(label.widget, button.widget) # geometry manager # see Tk-commands But the next one breaks:> if(as.character(tcl("info", "tclversion")) >= "8.5") {+ # make use of themed widgets + # list themes + as.character(tcl("ttk::style", "theme", "names")) + # select a theme -- here pre-XP windows + tcl("ttk::style", "theme use", "winnative") + } else { + # use Tk 8.0 widgets + } Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] bad command "theme use": must be configure, map, lookup, layout, theme, or element. What is going wrong here? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 670 bytes Desc: Message signed with OpenPGP using GPGMail URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150311/c0310ba3/attachment.bin>
Hi, Here same working example. http://mcu.edu.tw/~chenmh/teaching/project/r/reference/RTclTkExamples/ Best, Karim On Wed, Mar 11, 2015 at 10:41 PM, Erich Neuwirth < erich.neuwirth at univie.ac.at> wrote:> OSX 10.10.2 > R 3.1.3 > XQuartz installed. > > I am trying to run one of the tcltk demos > This one works: > > tt <- tktoplevel() > label.widget <- tklabel(tt, text = "Hello, World!") > button.widget <- tkbutton(tt, text = "Push", > command = function()cat("OW!\n")) > tkpack(label.widget, button.widget) # geometry manager > # see Tk-commands > > > But the next one breaks: > > if(as.character(tcl("info", "tclversion")) >= "8.5") { > + # make use of themed widgets > + # list themes > + as.character(tcl("ttk::style", "theme", "names")) > + # select a theme -- here pre-XP windows > + tcl("ttk::style", "theme use", "winnative") > + } else { > + # use Tk 8.0 widgets > + } > Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : > [tcl] bad command "theme use": must be configure, map, lookup, layout, > theme, or element. > > What is going wrong here? > > > ______________________________________________ > 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 11 Mar 2015, at 23:41 , Erich Neuwirth <erich.neuwirth at univie.ac.at> wrote: > > OSX 10.10.2 > R 3.1.3 > XQuartz installed. > > I am trying to run one of the tcltk demosWhich demos? Doesn't look like any the ones in the package. (Please at least be specific when you imply that someone is publishing bad code.)> This one works: > > tt <- tktoplevel() > label.widget <- tklabel(tt, text = "Hello, World!") > button.widget <- tkbutton(tt, text = "Push", > command = function()cat("OW!\n")) > tkpack(label.widget, button.widget) # geometry manager > # see Tk-commands > > > But the next one breaks: >> if(as.character(tcl("info", "tclversion")) >= "8.5") { > + # make use of themed widgets > + # list themes > + as.character(tcl("ttk::style", "theme", "names")) > + # select a theme -- here pre-XP windows > + tcl("ttk::style", "theme use", "winnative") > + } else { > + # use Tk 8.0 widgets > + } > Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : > [tcl] bad command "theme use": must be configure, map, lookup, layout, theme, or element. > > What is going wrong here?Presumably "theme use" wants to be "theme", "use". (Many moons ago, tcl() just pasted words together and executed the result as a Tcl command via .Tcl. Looks like the author expected .Tcl("ttk::style theme use winnative"), but nowadays it uses .Tcl.objv() which expects a vector of Tcl words so there is a difference between two words and one word with a space in the middle. The puzzling bit is that I'd have thunk Tcl 8.5 to be considerably later than the change to tcl()?) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Thesw are demos for tclscrollbar I copied them from the help file to the console manually as the help file suggested.> On 12 Mar 2015, at 09:04, peter dalgaard <pdalgd at gmail.com> wrote: > >> >> On 11 Mar 2015, at 23:41 , Erich Neuwirth <erich.neuwirth at univie.ac.at <mailto:erich.neuwirth at univie.ac.at>> wrote: >> >> OSX 10.10.2 >> R 3.1.3 >> XQuartz installed. >> >> I am trying to run one of the tcltk demos > > Which demos? Doesn't look like any the ones in the package. >-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 670 bytes Desc: Message signed with OpenPGP using GPGMail URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150312/043e81df/attachment.bin>
Sorry, I get at these demo when I do ?tkscrollbar Then the help file for many of the UI widgets appears, titled TkWidgets {tcltk} On the bottom of this file are the 2 examples I mentioned. Excuse the incomplete description in the first and the incorrect description in the second message.> On 12 Mar 2015, at 09:04, peter dalgaard <pdalgd at gmail.com> wrote: > >> >> On 11 Mar 2015, at 23:41 , Erich Neuwirth <erich.neuwirth at univie.ac.at <mailto:erich.neuwirth at univie.ac.at>> wrote: >> >> OSX 10.10.2 >> R 3.1.3 >> XQuartz installed. >> >> I am trying to run one of the tcltk demos > > Which demos? Doesn't look like any the ones in the package. > > (Please at least be specific when you imply that someone is publishing bad code.) > >> This one works: >> >> tt <- tktoplevel() >> label.widget <- tklabel(tt, text = "Hello, World!") >> button.widget <- tkbutton(tt, text = "Push", >> command = function()cat("OW!\n")) >> tkpack(label.widget, button.widget) # geometry manager >> # see Tk-commands >> >> >> But the next one breaks: >>> if(as.character(tcl("info", "tclversion")) >= "8.5") { >> + # make use of themed widgets >> + # list themes >> + as.character(tcl("ttk::style", "theme", "names")) >> + # select a theme -- here pre-XP windows >> + tcl("ttk::style", "theme use", "winnative") >> + } else { >> + # use Tk 8.0 widgets >> + } >> Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : >> [tcl] bad command "theme use": must be configure, map, lookup, layout, theme, or element. >> >> What is going wrong here? > > Presumably "theme use" wants to be "theme", "use". > > (Many moons ago, tcl() just pasted words together and executed the result as a Tcl command via .Tcl. Looks like the author expected .Tcl("ttk::style theme use winnative"), but nowadays it uses .Tcl.objv() which expects a vector of Tcl words so there is a difference between two words and one word with a space in the middle. The puzzling bit is that I'd have thunk Tcl 8.5 to be considerably later than the change to tcl()?) > > > -- > Peter Dalgaard, Professor, > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Email: pd.mes at cbs.dk <mailto:pd.mes at cbs.dk> Priv: PDalgd at gmail.com <mailto:PDalgd at gmail.com>-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 670 bytes Desc: Message signed with OpenPGP using GPGMail URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150312/444522b0/attachment.bin>