File: example.R

package info (click to toggle)
r-cran-tcltk2 1.2-10-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,356 kB
  • ctags: 1,386
  • sloc: tcl: 37,888; ansic: 792; python: 324; sh: 68; sed: 16; makefile: 1
file content (43 lines) | stat: -rw-r--r-- 1,310 bytes parent folder | download | duplicates (4)
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
38
39
40
41
42
43
# Test of widget 3.0

# The calendar widget (impossible to load)
tclRequire("widget::calendar")
tt <- tktoplevel()
db <- tkwidget(tt, "widget::calendar")
tkpack(db, fill = "both", expand = 1)


# The menuentry widget (OK)
tclRequire("widget::menuentry")
tt <- tktoplevel()
me <- tkwidget(tt, "widget::menuentry")
mnu <- tkmenu(me, tearoff = 0)
foo <- tclVar()
tkadd(mnu, "radiobutton", label = "Name", variable = foo, value = "name")
tkadd(mnu, "radiobutton", label = "Abstract", variable = foo, value = "abstract")
tkadd(mnu, "separator")
tkadd(mnu, "radiobutton", label = "Name and Abstract", variable = foo, value = "name abstract")
tkconfigure(me, menu = mnu)
tkpack(me, fill = "x", expand = 1, padx = 4, pady = 4)
# Change the selection in the menu, and then:
tclvalue(foo)


# The panelframe (does not work!?)
tclRequire("widget::panelframe")
tt <- tktoplevel()
pf <- tkwidget(tt, "widget::panelframe", text = "My Panel")
sf <- tkframe(pf, padx = 4, pady = 4)
txt <- tktext(sf)
tkpack(txt, fill = "both", expand = 1)
tcl(pf, "setwidget", sf)
tkpack(sf, fill = "both", expand =  1, padx = 4, pady = 4)

# The superframe (what is this?)
tclRequire("widget::superframe")
tt <- tktoplevel()
sf <- tkwidget(tt, "widget::superframe", text = "Superframe:")
tkpack(sf)
tkpack(tk2button(sf, text = "A button"))