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

peter dalgaard pdalgd at gmail.com
Sun Oct 9 13:14:10 CEST 2016


According to the gospel of St.Google, our good friends Lawrence & Verzani have in their book "Programming Graphical User Interfaces in R" 

https://books.google.dk/books?id=J-3RBQAAQBAJ&lpg=PA404&ots=MPoWYqHK-h&dq=ttk%20spinbox%20windows&pg=PA404#v=onepage&q=ttk%20spinbox%20windows&f=false

(In case the link breaks, the gist is that the themed spinbox was introduced in Tk 8.5.9, but at the time of writing Windows R shipped with Tk 8.5.8)

Thumbing back through R-core internal discussions reveals that the reason for the current state of things lies in some complicated Windows C toolkit issues, so we're stuck with 8.5.8 for the 3.3.x series, but R-devel builds will have 8.6.4 or .5.

-pd 

> On 08 Oct 2016, at 23:51 , Fox, John <jfox at mcmaster.ca> wrote:
> 
> 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.
> ______________________________________________
> 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



More information about the R-help mailing list