[R] Question about unicode characters in tcltk

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Tue Aug 14 16:40:25 CEST 2007


R Help wrote:
> hello list,
>
> Can someone help me figure out why the following code doesn't work?
> I'm trying to but both Greek letters and subscripts into a tcltk menu.
>  The code creates all the mu's, and the 1 and 2 subscripts, but it
> won't create the 0.  Is there a certain set of characters that R won't
> recognize the unicode for?  Or am I input the \u2080 incorrectly?
>
> library(tcltk)
> m <-tktoplevel()
> frame1 <- tkframe(m)
> frame2 <- tkframe(m)
> frame3 <- tkframe(m)
> entry1 <- tkentry(frame1,width=5,bg='white')
> entry2 <- tkentry(frame2,width=5,bg='white')
> entry3 <- tkentry(frame3,width=5,bg='white')
>
> tkpack(tklabel(frame1,text='\u03bc\u2080'),side='left')
> tkpack(tklabel(frame2,text='\u03bc\u2081'),side='left')
> tkpack(tklabel(frame3,text='\u03bc\u2082'),side='left')
>
> tkpack(frame1,entry1,side='top')
> tkpack(frame2,entry2,side='top')
> tkpack(frame3,entry3,side='top')
>
>   
Odd, but I think not an R issue. I get weirdness in wish too. Try this

% toplevel .a
.a
% label .a.b -text \u03bc\u2080 -font {Roman -10}
.a.b
% pack .a.b
% .a.b configure
{-activebackground
[....]
{-text text Text {} μ₀} {-textvariable textVariable Variable {} {}}
{-underline underline Underline -1 -1} {-width width Width 0 0}
{-wraplength wrapLength WrapLength 0 0}
% .a.b configure -font {Helvetica -12 bold} # the default, now shows \u2080
% .a.b configure -font {Roman -10} # back to Roman, *still* shows \u2080

???!!!

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list