[R] super and subscript in tcltk

R Help rhelp.stats at gmail.com
Wed Sep 12 15:54:16 CEST 2007


dear list,

I'm trying to set subscripts in a tcltk menu, but I can't get it to
work.  The basic idea is produced by the following code

#######
library(tcltk)
m <- tktoplevel()
norm <- tkfont.create(family="times",size=20,weight="bold")
f1 <- tkfont.create(family="symbol",size=10)
f2 <- tkfont.create(family="symbol",size=5)
frame <- tkframe(m)

entry1 <- tkentry(frame,width=5,bg='white')
entry2 <- tkentry(frame,width=5,bg='white')

tkpack(tklabel(frame,text="m",font=f1),side='left')
tkpack(tklabel(frame,text="1",font=f2),side='left')
tkpack(frame,entry1,side="left")
tkpack(tklabel(frame,text="m",font=f1),side='left')
tkpack(tklabel(frame,text="2",font=f2),side='left')
tkpack(frame,entry2,side="top")
########

But the problem is that the 1 and 2 are not added as subscripts.  I
think I can do it using a text-object and the offset tag, but I cannot
figure out how to do it.  Does anybody know how to use the
tktag.configure(...) function to set the offset tag so that the text
will appear below the baseline?  It should work like this

#######
t <- tktext(frame,font=f1)
tktag.configure(t,"offset=-50")
tkinsert(t,"end","m")
tkinsert(t,"end","1")
#######

Any help would be very much appreciated.

Thanks
Sam



More information about the R-help mailing list