Description Usage Arguments Details Value Author(s) Examples
These functions provide/control a simulated notebook widget.
1 2 3 | notebook_create(parent)
notebook_display(notebook, pagename)
notebook_page(notebook, pagename)
|
parent |
object of the class |
notebook |
object of the class |
pagename |
character string specifying name of notebook page |
Notebook widgets are created with notebook_create
.
The function notebook_page
creates a notebook page, a container
in which to embed other widgets to display.
The function notebook_display
displays the requested page.
The notebook_create
method returns a tkwin
object
representing the notebook.
The notebook_page
method returns a tkwin
object
representing a page in the notebook.
Other methods are invoked for their side-effect.
P. Roebuck proebuck@mdanderson.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ## Not run:
toplevel <- tktoplevel()
## Create notebook
notebook <- notebook_create(toplevel)
tkpack(notebook, side="bottom", expand=TRUE, fill="both", padx=4, pady=4)
npages <- 0
## Create notebook page and contents
pg1 <- notebook_page(notebook, "Page 1")
label <- tklabel(pg1, bitmap="info")
tkpack(label, side="left", padx=8, pady=8)
label <- tklabel(pg1, text="Something\non\nPage 1")
tkpack(label, side="left", expand=TRUE, pady=8)
npages <- npages + 1
## Create another notebook page and contents
pg2 <- notebook_page(notebook, "Page 2")
label <- tklabel(pg2, text="Something else on Page 2")
tkpack(label, side="left", expand=TRUE, padx=8, pady=8)
npages <- npages + 1
## Create page controls
choice.var <- tclVar("1")
controls <- tkframe(toplevel, class="Radiobox")
border <- tkframe(controls, borderwidth=2, relief="groove")
tkpack(border, expand=TRUE, fill="both")
tkpack(controls, side="top", fill="x", padx=4, pady=4)
for (i in seq_len(npages)) {
pg <- sprintf("Page
rb <- tkradiobutton(controls,
text=paste("Show", pg),
variable=choice.var,
value=as.integer(i))
cmd <- substitute(function() notebook_display(notebook, pgname),
list(pgname=pg))
tkconfigure(rb, command=eval(cmd))
tkpack(rb, side="top", anchor="w")
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.