[R] how to work ttkspinbox ? win BUG ??

Fox, John jfox at mcmaster.ca
Sat Oct 8 23:51:20 CEST 2016


Dear Cleber,

I can verify this problem on Windows; my session info:

---------- snip --------

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.3.1

---------- snip --------

I suspect that ttk::spinbox is missing from the supplied Tcl/Tk (though other ttk widgets are present).

You can use spinbox from Tk by defining your own tkspinbox() function (there isn't one in the tcltk package):

	tkspinbox <- function(parent, ...) tkwidget(parent, "spinbox", ...)

Then, e.g., 

	t <- tktoplevel()
	s <- tkspinbox(t, from = 1.0, to = 100.0, textvariable='spinval')
	tkpack(s)

works for me.

Best,
 John

-----------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
Web: socserv.mcmaster.ca/jfox




> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Cleber
> N.Borges via R-help
> Sent: October 8, 2016 5:08 PM
> To: r-help at r-project.org
> Subject: Re: [R] how to work ttkspinbox ? win BUG ??
> 
> thanks David for your help
> 
> thanks for your help, David
> I suspect that there are a bug in windows version...
> 
> :-(
> 
> cleber
> 
> 
> #######################################################
>  > library( tcltk )
>  > t <- tktoplevel()
>  > s = ttkspinbox(t, from = 1.0, to = 100.0, textvariable='spinval') Error in
> structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
>    [tcl] invalid command name "ttk::spinbox".
>  > tkpack(s)
> Error in .Tcl.args.objv(...) : object 's' not found  >  >  > sessionInfo() R version
> 3.3.1 (2016-06-21)
> Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64
> (build 7600)
> 
> locale:
> [1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
> [3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C [5]
> LC_TIME=Portuguese_Brazil.1252
> 
> attached base packages:
> [1] tcltk     stats     graphics  grDevices utils     datasets methods
> base
>  >
> 
> 
> Em 08/10/2016 17:51, David Winsemius escreveu:
> >> On Oct 7, 2016, at 7:15 PM, Cleber N.Borges via R-help <r-help at r-
> project.org> wrote:
> >>
> >> hello all,
> >>
> >> somebody have a example of use of  ttkspinbox ?
> >> I tried to use like others widgets but I get error.
> >>
> >> Thanks in advanced for any help
> >>
> >> cleber
> >>
> >> ###################
> >>> library( tcltk )
> >>>
> >>> t <- tktoplevel()
> >>>
> >>> spin <- ttkspinbox( t )
> >> Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
> >>   [tcl] invalid command name "ttk::spinbox".
> >>> combo <- ttkcombobox( t )
> >>> tkpack( combo )
> >> <Tcl>
> >>
> > This displays a spinbox in an X-window:
> >
> > t <- tktoplevel()
> > s = ttkspinbox(t, from = 1.0, to = 100.0, textvariable='spinval')
> > tkpack(s)
> >
> > David Winsemius
> > Alameda, CA, USA
> >
> >
> 
> 
> ---
> Este email foi escaneado pelo Avast antivírus.
> https://www.avast.com/antivirus
> 
> ______________________________________________
> 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.


More information about the R-help mailing list