[R] One application of Tcltk2

phgrosjean at sciviews.org phgrosjean at sciviews.org
Fri May 28 11:56:06 CEST 2010


Hello,

tk2notebook() is a ttk/tile styled widget. Its appearance is governed by
styles. Before you change style, you should first look if there is one
predefined theme that better suits you:

> tk2theme.list() # List all available themes
[1] "clam"    "alt"     "default" "classic"
> tk2theme("clam") # Change is dynamic!
[1] "clam"
> tk2theme("alt") # Change is dynamic!
[1] "alt"
...

Look how your dialog box(es) look like when you switch the theme.

Then, starting from your preferred theme, you can change the appearance of
specific theme styles. Here is how you change the color of notebook tabs,
for instance:

tcl("ttk::style", "configure", "TNotebook", background="skyplue")
# Make non selected tabs a little darker
tcl("ttk::style", "configure", "TNotebook.Tab", background="skyblue3")
tcl("ttk::style", "map", "TNotebook.Tab", background=c("active", "skyblue"))
tcl("ttk::style", "map", "TNotebook.Tab", background=c("active", "skyblue"))
tcl("ttk::style", "map", "TNotebook.Tab", background=c("selected",
"skyblue"))

See the Tile documentation at http://tktable.sourceforge.net/tile/doc, and
also this document: http://tktable.sourceforge.net/tile/tile-tcl2004.pdf.

Best,

Philippe Grosjean

..............................................<°}))><........
 ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons University, Belgium
( ( ( ( (
..............................................................

On 27/05/10 19:14, Abelian wrote:
> Dear All
> I utilize the Tcltk2 to develop a Gui for application.
> In order to make my function more clearly, i use a
> function ,tk2notebook, to build several notes for different
> application. I have studied the example of this function. In the R-
> help, it provided a example below.
>
> tt2<- tktoplevel()
> nb<- tk2notebook(tt2, tabs = c("Test", "Button"))
> tkpack(nb, fill = "both", expand = 1)
> tb1<- tk2notetab(nb, "Test")
> lab<- tk2label(tb1, text = "Nothing here.")
> tkpack(lab)
> tb2<- tk2notetab(nb, "Button")
> but<- tk2button(tb2, text = "Click me", command = function()
> tkdestroy(tt2))
> tkgrid(but)
> tk2notetab.select(nb, "Button")
> tk2notetab.text(nb) # Text of the currently selected tab
>
> However, i want to modify the font and cex.size of tabs.
> Because the original setting is too small.
> By the way, how can i change the color of frames in this function?
> The defult is gray, but i want to be skyblue.
> I hope someone can give me suggestion or give me some direction to
> solve this problem.
> Sincerely
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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