tknotebook: Tk notebook routines

Description Usage Arguments Details Value Author(s) Examples

Description

These functions provide/control a simulated notebook widget.

Usage

1
2
3
notebook_create(parent)
notebook_display(notebook, pagename)
notebook_page(notebook, pagename)

Arguments

parent

object of the class tkwin representing the parent widget

notebook

object of the class tkwin representing the notebook widget

pagename

character string specifying name of notebook page

Details

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.

Value

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.

Author(s)

P. Roebuck proebuck@mdanderson.org

Examples

 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)

tclish documentation built on May 2, 2019, 4:53 p.m.