tk9_0

package module
v0.62.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2025 License: BSD-3-Clause Imports: 37 Imported by: 3

README

tk9.0: The CGo-free, cross platform GUI toolkit for Go

photo

Using Go embedded images (_examples/photo.go).

 1	package main
 2	
 3	import _ "embed"
 4	import . "modernc.org/tk9.0"
 5	import _ "modernc.org/tk9.0/themes/azure"
 6	
 7	//go:embed gopher.png
 8	var gopher []byte
 9	
10	func main() {
11		ActivateTheme("azure light")
12		Pack(Label(Image(NewPhoto(Data(gopher)))),
13			TExit(),
14			Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
15		App.Center().Wait()
16	}

menu

Cascading menus (_examples/menu.go)

 1	package main
 2	
 3	import (
 4		"fmt"
 5		. "modernc.org/tk9.0"
 6		_ "modernc.org/tk9.0/themes/azure"
 7		"runtime"
 8	)
 9	
10	func main() {
11		menubar := Menu()
12	
13		fileMenu := menubar.Menu()
14		fileMenu.AddCommand(Lbl("New"), Underline(0), Accelerator("Ctrl+N"))
15		fileMenu.AddCommand(Lbl("Open..."), Underline(0), Accelerator("Ctrl+O"), Command(func() { GetOpenFile() }))
16		Bind(App, "<Control-o>", Command(func() { fileMenu.Invoke(1) }))
17		fileMenu.AddCommand(Lbl("Save"), Underline(0), Accelerator("Ctrl+S"))
18		fileMenu.AddCommand(Lbl("Save As..."), Underline(5))
19		fileMenu.AddCommand(Lbl("Close"), Underline(0), Accelerator("Crtl+W"))
20		fileMenu.AddSeparator()
21		fileMenu.AddCommand(Lbl("Exit"), Underline(1), Accelerator("Ctrl+Q"), ExitHandler())
22		Bind(App, "<Control-q>", Command(func() { fileMenu.Invoke(6) }))
23		menubar.AddCascade(Lbl("File"), Underline(0), Mnu(fileMenu))
24	
25		editMenu := menubar.Menu()
26		editMenu.AddCommand(Lbl("Undo"))
27		editMenu.AddSeparator()
28		editMenu.AddCommand(Lbl("Cut"))
29		editMenu.AddCommand(Lbl("Copy"))
30		editMenu.AddCommand(Lbl("Paste"))
31		editMenu.AddCommand(Lbl("Delete"))
32		editMenu.AddCommand(Lbl("Select All"))
33		menubar.AddCascade(Lbl("Edit"), Underline(0), Mnu(editMenu))
34	
35		helpMenu := menubar.Menu()
36		helpMenu.AddCommand(Lbl("Help Index"))
37		helpMenu.AddCommand(Lbl("About..."))
38		menubar.AddCascade(Lbl("Help"), Underline(0), Mnu(helpMenu))
39	
40		App.WmTitle(fmt.Sprintf("%s on %s", App.WmTitle(""), runtime.GOOS))
41		ActivateTheme("azure light")
42		App.Configure(Mnu(menubar), Width("8c"), Height("6c")).Wait()
43	}

Menus on darwin are now using the system-managed menu bar.

text

Rich text using markup (_examples/text.go).

 1	package main
 2	
 3	import . "modernc.org/tk9.0"
 4	import _ "modernc.org/tk9.0/themes/azure"
 5	
 6	func main() {
 7		ActivateTheme("azure light")
 8		var scroll *TScrollbarWidget
 9		t := Text(Font("helvetica", 10), Yscrollcommand(func(e *Event) { e.ScrollSet(scroll) }), Setgrid(true), Wrap("word"), Padx("2m"), Pady("2m"))
10		scroll = TScrollbar(Command(func(e *Event) { e.Yview(t) }))
11		Grid(t, Sticky("news"), Pady("2m"))
12		Grid(scroll, Row(0), Column(1), Sticky("nes"), Pady("2m"))
13		GridRowConfigure(App, 0, Weight(1))
14		GridColumnConfigure(App, 0, Weight(1))
15		Grid(TExit(), Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
16		t.TagConfigure("bgstipple", Background(Black), Borderwidth(0), Bgstipple(Gray12))
17		t.TagConfigure("big", Font("helvetica", 12, "bold"))
18		t.TagConfigure("bold", Font("helvetica", 10, "bold", "italic"))
19		t.TagConfigure("center", Justify("center"))
20		t.TagConfigure("color1", Background("#a0b7ce"))
21		t.TagConfigure("color2", Foreground(Red))
22		t.TagConfigure("margins", Lmargin1("12m"), Lmargin2("6m"), Rmargin("10m"))
23		t.TagConfigure("overstrike", Overstrike(1))
24		t.TagConfigure("raised", Relief("raised"), Borderwidth(1))
25		t.TagConfigure("right", Justify("right"))
26		t.TagConfigure("spacing", Spacing1("10p"), Spacing2("2p"), Lmargin1("12m"), Lmargin2("6m"), Rmargin("10m"))
27		t.TagConfigure("sub", Offset("-2p"), Font("helvetica", 8))
28		t.TagConfigure("sunken", Relief("sunken"), Borderwidth(1))
29		t.TagConfigure("super", Offset("4p"), Font("helvetica", 8))
30		t.TagConfigure("tiny", Font("times", 8, "bold"))
31		t.TagConfigure("underline", Underline(1))
32		t.TagConfigure("verybig", Font(CourierFont(), 22, "bold"))
33		t.InsertML(`Text widgets like this one allow you to display information in a variety of styles. Display styles are controlled
34	using a mechanism called <bold>tags</bold>. Tags are just textual names that you can apply to one or more ranges of characters within a
35	text widget. You can configure tags with various display styles. If you do this, then the tagged characters will be displayed with the
36	styles you chose. The available display styles are:
37	<br><br><big>1. Font.</big> You can choose any system font, <verybig>large</verybig> or <tiny>small</tiny>.
38	<br><br><big>2. Color.</big> You can change either the <color1>background</color1> or <color2>foreground</color2> color, or
39	<color1><color2>both</color2></color1>.
40	<br><br><big>3. Stippling.</big> You can cause the <bgstipple>background</bgstipple> information to be drawn with a stipple fill instead
41	of a solid fill.
42	<br><br><big>4. Underlining.</big> You can <underline>underline</underline> ranges of text.
43	<br><br><big>5. Overstrikes.</big> You can <overstrike>draw lines through</overstrike> ranges of text.
44	<br><br><big>6. 3-D effects.</big> You can arrange for the background to be drawn with a border that makes characters appear either
45	<raised>raised</raised> or <sunken>sunken</sunken>.
46	<br><br><big>7. Justification.</big> You can arrange for lines to be displayed <br>left-justified <br><right>right-justified, or</right>
47	<br><center>centered.</center>
48	<br><br><big>8. Superscripts and subscripts.</big> You can control the vertical position of text to generate superscript effects like
49	10<super>n</super> or subscript effects like X<sub>i</sub>.
50	<br><br><big>9. Margins.</big> You can control the amount of extra space left on each side of the text
51	<br><br><margins>This paragraph is an example of the use of margins. It consists of a single line of text that wraps around on the
52	screen.  There are two separate left margin values, one for the first display line associated with the text line, and one for the
53	subsequent display lines, which occur because of wrapping. There is also a separate specification for the right margin, which is used to
54	choose wrap points for lines.</margins>
55	<br><br><big>10. Spacing.</big> You can control the spacing of lines with three separate parameters. "Spacing1" tells how much extra
56	space to leave above a line, "spacing3" tells how much space to leave below a line, and if a text line wraps, "spacing2" tells how much
57	space to leave between the display lines that make up the text line.
58	<br><spacing>These indented paragraphs illustrate how spacing can be used. Each paragraph is actually a single line in the text widget,
59	which is word-wrapped by the widget.</spacing>
60	<br><spacing>Spacing1 is set to 10 points for this text, which results in relatively large gaps between the paragraphs. Spacing2 is set
61	to 2 points, which results in just a bit of extra space within a pararaph. Spacing3 isn't used in this example.</spacing>
62	<br><spacing>To see where the space is, select ranges of text within these paragraphs. The selection highlight will cover the extra
63	space.</spacing>`)
64		App.Center().Wait()
65	}

svg

Using svg (_examples/svg.go).

 1	package main
 2	
 3	import . "modernc.org/tk9.0"
 4	import _ "modernc.org/tk9.0/themes/azure"
 5	
 6	// https://en.wikipedia.org/wiki/SVG
 7	const svg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 8	<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 9	<svg width="391" height="391" viewBox="-70.5 -70.5 391 391" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
10	<rect fill="#fff" stroke="#000" x="-70" y="-70" width="390" height="390"/>
11	<g opacity="0.8">
12		<rect x="25" y="25" width="200" height="200" fill="lime" stroke-width="4" stroke="pink" />
13		<circle cx="125" cy="125" r="75" fill="orange" />
14		<polyline points="50,150 50,200 200,200 200,100" stroke="red" stroke-width="4" fill="none" />
15		<line x1="50" y1="50" x2="200" y2="200" stroke="blue" stroke-width="4" />
16	</g>
17	</svg>`
18	
19	func main() {
20		ActivateTheme("azure light")
21		Pack(Label(Image(NewPhoto(Data(svg)))),
22			TExit(),
23			Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
24		App.Center().Wait()
25	}

calc

A simple calculator (_examples/calc.go).

 1	package main
 2	
 3	import "github.com/expr-lang/expr"
 4	import . "modernc.org/tk9.0"
 5	import _ "modernc.org/tk9.0/themes/azure"
 6	
 7	func main() {
 8		ActivateTheme("azure light")
 9		out := Label(Height(2), Anchor("e"), Txt("(123+232)/(123-10)"))
10		Grid(out, Columnspan(4), Sticky("e"))
11		var b *TButtonWidget
12		for i, c := range "C()/789*456-123+0.=" {
13			b = TButton(Txt(string(c)),
14				Command(
15					func() {
16						switch c {
17						case 'C':
18							out.Configure(Txt(""))
19						case '=':
20							x, err := expr.Eval(out.Txt(), nil)
21							if err != nil {
22								MessageBox(Icon("error"), Msg(err.Error()), Title("Error"))
23								x = ""
24							}
25							out.Configure(Txt(x))
26						default:
27							out.Configure(Txt(out.Txt() + string(c)))
28						}
29					},
30				),
31				Width(-4))
32			Grid(b, Row(i/4+1), Column(i%4), Sticky("news"), Ipady("2.6m"), Padx("0.5m"), Pady("0.5m"))
33		}
34		Grid(b, Columnspan(2))
35		b.Configure(Style("Accent.TButton"))
36		App.Configure(Padx(0), Pady(0)).Wait()
37	}

font

A font previewer (_examples/font.go).

 1	package main
 2	
 3	import "fmt"
 4	import "slices"
 5	import . "modernc.org/tk9.0"
 6	import _ "modernc.org/tk9.0/themes/azure"
 7	
 8	func main() {
 9		ActivateTheme("azure light")
10		var scroll *TScrollbarWidget
11		t := Text(Wrap("none"), Setgrid(true), Yscrollcommand(func(e *Event) { e.ScrollSet(scroll) }))
12		scroll = TScrollbar(Command(func(e *Event) { e.Yview(t) }))
13		fonts := FontFamilies()
14		slices.Sort(fonts)
15		Grid(t, Sticky("news"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
16		Grid(scroll, Row(0), Column(1), Sticky("nes"), Pady("2m"))
17		GridRowConfigure(App, 0, Weight(1))
18		GridColumnConfigure(App, 0, Weight(1))
19		Grid(TExit(), Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
20		m := map[string]bool{}
21		for i, font := range fonts {
22			if m[font] {
23				continue
24			}
25			m[font] = true
26			tag := fmt.Sprintf("t%v", i)
27			t.TagConfigure(tag, Font(NewFont(Family(font))))
28			t.Insert("end", font+": ", "", "Lorem ipsum dolor sit amet, consectetur adipiscing elit...\n", tag)
29		}
30		App.Center().Wait()
31	}

splot

Surface plot (_examples/splot.go). This example requires Gnuplot 5.4+ installation.

 1	package main
 2	
 3	import . "modernc.org/tk9.0"
 4	import _ "modernc.org/tk9.0/themes/azure"
 5	
 6	var cm = int(TkScaling()*72/2.54 + 0.5)
 7	
 8	func main() {
 9		ActivateTheme("azure light")
10		Pack(Label(Image(NewPhoto(Width(20*cm), Height(15*cm)).Graph("set grid; splot x**2+y**2, x**2-y**2"))),
11			TExit(),
12			Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
13		App.Center().Wait()
14	}

tori

Interlocked tori plot (_examples/tori.go). This example requires Gnuplot 5.4+ installation.

 1	package main
 2	
 3	import . "modernc.org/tk9.0"
 4	import _ "modernc.org/tk9.0/themes/azure"
 5	
 6	// https://gnuplot.sourceforge.net/demo_5.4/hidden2.html
 7	const script = `
 8	set multiplot title "Interlocking Tori"
 9	set title "PM3D surface\nno depth sorting"
10	set parametric
11	set urange [-pi:pi]
12	set vrange [-pi:pi]
13	set isosamples 50,20
14	set origin -0.02,0.0
15	set size 0.55, 0.9
16	unset key
17	unset xtics
18	unset ytics
19	unset ztics
20	set border 0
21	set view 60, 30, 1.5, 0.9
22	unset colorbox
23	set pm3d scansbackward
24	splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d,1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d
25	set title "PM3D surface\ndepth sorting"
26	set origin 0.40,0.0
27	set size 0.55, 0.9
28	set colorbox vertical user origin 0.9, 0.15 size 0.02, 0.50
29	set format cb "%.1f"
30	set pm3d depthorder
31	splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d,1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d
32	unset multiplot`
33	
34	var cm = int(TkScaling()*72/2.54 + 0.5)
35	
36	func main() {
37		ActivateTheme("azure light")
38		Pack(Label(Image(NewPhoto(Width(20*cm), Height(15*cm)).Graph(script))),
39			TExit(),
40			Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
41		App.Center().Wait()
42	}

tori-canvas

Interlocked tori plot on canvas (_examples/tori_canvas.go). This example requires Gnuplot 5.4+ installation.

 1	package main
 2	
 3	import . "modernc.org/tk9.0"
 4	import _ "modernc.org/tk9.0/themes/azure"
 5	
 6	// https://gnuplot.sourceforge.net/demo_5.4/surface2.9.gnu
 7	const script = `
 8	set dummy u, v
 9	set key bmargin center horizontal Right noreverse enhanced autotitle nobox
10	set parametric
11	set view 50, 30, 1, 1
12	set isosamples 50, 20
13	set hidden3d back offset 1 trianglepattern 3 undefined 1 altdiagonal bentover
14	set style data lines
15	set xyplane relative 0
16	set title "Interlocking Tori" 
17	set grid
18	set urange [ -3.14159 : 3.14159 ] noreverse nowriteback
19	set vrange [ -3.14159 : 3.14159 ] noreverse nowriteback
20	set xrange [ * : * ] noreverse writeback
21	set x2range [ * : * ] noreverse writeback
22	set yrange [ * : * ] noreverse writeback
23	set y2range [ * : * ] noreverse writeback
24	set zrange [ * : * ] noreverse writeback
25	set cbrange [ * : * ] noreverse writeback
26	set rrange [ * : * ] noreverse writeback
27	set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front  noinvert bdefault
28	NO_ANIMATION = 1
29	splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with lines,1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with lines`
30	
31	var cm = int(TkScaling()*72/2.54 + 0.5)
32	
33	func main() {
34		Pack(Canvas(Width(20*cm), Height(15*cm), Background(White)).Graph(script),
35			TExit(),
36			Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
37		ActivateTheme("azure light")
38		App.Center().Wait()
39	}

tex

Rendering plain TeX (_examples/tex.go). No runtime dependencies required.

 1	package main
 2	
 3	import . "modernc.org/tk9.0"
 4	import _ "modernc.org/tk9.0/themes/azure"
 5	
 6	func main() {
 7		tex := `$$\int _0 ^\infty {{\sin ax \sin bx}\over{x^2}}\,dx = {\pi a\over 2}$$`
 8		Pack(Label(Relief("sunken"), Image(NewPhoto(Data(TeX(tex, 2*TkScaling()*72/600))))),
 9			TExit(),
10			Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m"))
11		ActivateTheme("azure light")
12		App.Center().Wait()
13	}

embed

Embedding pictures, TeX and other widgets in Text (_examples/embed.go).

 1	package main
 2	
 3	import . "modernc.org/tk9.0"
 4	import _ "embed"
 5	import _ "modernc.org/tk9.0/themes/azure"
 6	
 7	//go:embed gotk.png
 8	var icon []byte
 9	
10	func main() {
11		fontSize := int(10*TkScaling()/NativeScaling + 0.5)
12		font := Font("helvetica", fontSize)
13		var scroll *TScrollbarWidget
14		t := Text(font, Height(22), Yscrollcommand(func(e *Event) { e.ScrollSet(scroll) }), Setgrid(true), Wrap("word"),
15			Padx("4p"), Pady("12p"))
16		scroll = TScrollbar(Command(func(e *Event) { e.Yview(t) }))
17		Grid(t, Sticky("news"), Pady("2m"))
18		Grid(scroll, Row(0), Column(1), Sticky("nes"), Pady("2m"))
19		GridRowConfigure(App, 0, Weight(1))
20		GridColumnConfigure(App, 0, Weight(1))
21		Grid(TExit())
22		t.TagConfigure("c", Justify("center"))
23		t.TagConfigure("e", Offset("-2p"))
24		t.TagConfigure("t", Font("times", fontSize))
25		sym := " <t>T<e>E</e>X</t> "
26		tex := `$Q(\xi) = \lambda_1 y_1^2 \sum_{i=2}^n \sum_{j=2}^n y_i b_{ij} y_j$`
27		t.InsertML(`<c>Hello Go + Tk`, NewPhoto(Data(icon)), Padx("4p"), `users!
28	<br><br>Hello Go + Tk +`, sym, tex, ` users! (\$inline math\$)
29	<br><br>Hello Go + Tk +`, sym, `$`+tex+`$`, ` users! (\$\$display math\$\$)</c>
30	<br><br>The above exemplifies embeding pictures and`, sym, `scripts. A text widget can also embed other widgets. For example,
31	when a`, TButton(Txt("<Tbutton>")), Padx("4p"), Pady("2p"), Align("center"), `and
32	a`, TEntry(Textvariable("<TEntry>"), Background(White), Width(8)), Padx("4p"), Pady("2p"), Align("center"), `are part of
33	the markup, they will reflow when their containing text widget is resized.`)
34		ActivateTheme("azure light")
35		App.Center().Wait()
36	}

The above screen shot is from '$ TK9_SCALE=1.2 go run _examples/embed.go'.

tbutton

Styling a button (_examples/tbutton.go). See the discussion at Tutorial: Modifying a ttk button's style

 1	package main
 2	
 3	import _ "embed"
 4	import . "modernc.org/tk9.0"
 5	
 6	//go:embed red_corner.png
 7	var red []byte
 8	
 9	//go:embed green_corner.png
10	var green []byte
11	
12	func main() {
13		StyleElementCreate("Red.Corner.TButton.indicator", "image", NewPhoto(Data(red)))
14		StyleElementCreate("Green.Corner.TButton.indicator", "image", NewPhoto(Data(green)))
15		StyleLayout("Red.Corner.TButton",
16			"Button.border", Sticky("nswe"), Border(1), Children(
17				"Button.focus", Sticky("nswe"), Children(
18					"Button.padding", Sticky("nswe"), Children(
19						"Button.label", Sticky("nswe"),
20						"Red.Corner.TButton.indicator", Side("right"), Sticky("ne")))))
21		StyleLayout("Green.Corner.TButton",
22			"Button.border", Sticky("nswe"), Border(1), Children(
23				"Button.focus", Sticky("nswe"), Children(
24					"Button.padding", Sticky("nswe"), Children(
25						"Button.label", Sticky("nswe"),
26						"Green.Corner.TButton.indicator", Side("right"), Sticky("ne")))))
27		opts := Opts{Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m")}
28		rb := TButton(Txt("Red"))
29		gb := TButton(Txt("Green"))
30		Grid(rb, gb, opts)
31		Grid(TButton(Txt("Use style"), Command(func() {
32			rb.Configure(Style("Red.Corner.TButton"))
33			gb.Configure(Style("Green.Corner.TButton"))
34		})), TExit(), opts)
35		App.Wait()
36	}

azure

Example usage of the theme register. (_examples/azure.go)

 1	package main
 2	
 3	import . "modernc.org/tk9.0"
 4	import _ "modernc.org/tk9.0/themes/azure"
 5	
 6	func main() {
 7		Pack(TButton(Txt("Light"), Command(func() { ActivateTheme("azure light") })),
 8			TButton(Txt("Dark"), Command(func() { ActivateTheme("azure dark") })),
 9			TExit(),
10			Pady("2m"), Ipady("1m"))
11		App.Wait()
12	}

b5

Technology preview of a Bootstrap 5-like theme buttons (_examples/b5.go). Only a partial prototype/problem study/work in progress at the moment. But it may get there, eventually. (_examples/b5.go)

 1	package main
 2	
 3	import (
 4		. "modernc.org/tk9.0"
 5		"modernc.org/tk9.0/b5"
 6	)
 7	
 8	func main() {
 9		background := White
10		primary := b5.Colors{b5.ButtonText: "#fff", b5.ButtonFace: "#0d6efd", b5.ButtonFocus: "#98c1fe"}
11		secondary := b5.Colors{b5.ButtonText: "#fff", b5.ButtonFace: "#6c757d", b5.ButtonFocus: "#c0c4c8"}
12		success := b5.Colors{b5.ButtonText: "#fff", b5.ButtonFace: "#198754", b5.ButtonFocus: "#9dccb6"}
13		danger := b5.Colors{b5.ButtonText: "#fff", b5.ButtonFace: "#dc3545", b5.ButtonFocus: "#f0a9b0"}
14		warning := b5.Colors{b5.ButtonText: "#000", b5.ButtonFace: "#ffc107", b5.ButtonFocus: "#ecd182"}
15		info := b5.Colors{b5.ButtonText: "#000", b5.ButtonFace: "#0dcaf0", b5.ButtonFocus: "#85d5e5"}
16		light := b5.Colors{b5.ButtonText: "#000", b5.ButtonFace: "#f8f9fa", b5.ButtonFocus: "#e9e9ea"}
17		dark := b5.Colors{b5.ButtonText: "#fff", b5.ButtonFace: "#212529", b5.ButtonFocus: "#a0a2a4"}
18		link := b5.Colors{b5.ButtonText: "#1774fd", b5.ButtonFace: "#fff", b5.ButtonFocus: "#c2dbfe"}
19		StyleThemeUse("default")
20		opts := Opts{Padx("1m"), Pady("2m"), Ipadx("1m"), Ipady("1m")}
21		Grid(TButton(Txt("Primary"), Style(b5.ButtonStyle("primary.TButton", primary, background, false))),
22			TButton(Txt("Secondary"), Style(b5.ButtonStyle("secondary.TButton", secondary, background, false))),
23			TButton(Txt("Success"), Style(b5.ButtonStyle("success.TButton", success, background, false))),
24			opts)
25		Grid(TButton(Txt("Danger"), Style(b5.ButtonStyle("danger.TButton", danger, background, false))),
26			TButton(Txt("Warning"), Style(b5.ButtonStyle("warning.TButton", warning, background, false))),
27			TButton(Txt("Info"), Style(b5.ButtonStyle("info.TButton", info, background, false))),
28			opts)
29		Grid(TButton(Txt("Light"), Style(b5.ButtonStyle("light.TButton", light, background, false))),
30			TButton(Txt("Dark"), Style(b5.ButtonStyle("dark.TButton", dark, background, false))),
31			TButton(Txt("Link"), Style(b5.ButtonStyle("link.TButton", link, background, false))),
32			opts)
33		Grid(TButton(Txt("Primary"), Style(b5.ButtonStyle("focused.primary.TButton", primary, background, true))),
34			TButton(Txt("Secondary"), Style(b5.ButtonStyle("focused.secondary.TButton", secondary, background, true))),
35			TButton(Txt("Success"), Style(b5.ButtonStyle("focused.success.TButton", success, background, true))),
36			opts)
37		Grid(TButton(Txt("Danger"), Style(b5.ButtonStyle("focused.danger.TButton", danger, background, true))),
38			TButton(Txt("Warning"), Style(b5.ButtonStyle("focused.warning.TButton", warning, background, true))),
39			TButton(Txt("Info"), Style(b5.ButtonStyle("focused.info.TButton", info, background, true))),
40			opts)
41		Grid(TButton(Txt("Light"), Style(b5.ButtonStyle("focused.light.TButton", light, background, true))),
42			TButton(Txt("Dark"), Style(b5.ButtonStyle("focused.dark.TButton", dark, background, true))),
43			TButton(Txt("Link"), Style(b5.ButtonStyle("focused.link.TButton", link, background, true))),
44			opts)
45		Grid(TExit(), Columnspan(3), opts)
46		App.Configure(Background(background)).Wait()
47	}

Gallery (_examples/demo.go)

Darwin(macOS) Sequoia 15.0

darwin

FreeBSD Xfce4

freebsd

Linux Mate 1.26.0

linux

Windows 11

windows11

Go Reference

LiberaPay receives patrons

Documentation

Overview

Package tk9.0 is a CGo-free, cross platform GUI toolkit for Go. It is similar to Tkinter for Python.

Hello world

Also available in _examples/hello.go

package main

import . "modernc.org/tk9.0"

func main() {
	Pack(Button(Txt("Hello"), Command(func() { Destroy(App) })))
	App.Wait()
}

To execute the above program on any supported target issue something like

$ CGO_ENABLED=0 go run hello.go

The CGO_ENABLED=0 is optional and here it only demonstrates the program can be built without CGo.

In action

  • equ A Plain TeX math editor.
  • visualmd A WYSIWYG markdown editor.

Frequently Asked Questions

  • Do I need to install the Tcl/Tk libraries on my system to use this package or programs that import it?

    No. You still have to have a desktop environment installed on systems where that is not necessarily the case by default. That means some of the unix-like systems. Usually installing any desktop environment, like Gnome, Xfce etc. provides all the required library (.so) files. The minimum is the X Window System and this package was tested to work there, although with all the limitations one can expect in this case.

  • Windows: How to build an executable that doesn't open a console window when run?

    From the documentation for cmd/link: On Windows, -H windowsgui writes a "GUI binary" instead of a "console binary.". To pass the flag to the Go build system use 'go build -ldflags -H=windowsgui somefile.go', for example.

  • What does CGo-free really mean?

    cgo is a tool used by the Go build system when Go code uses the pseudo-import "C". For technical details please see the link. For us it is important that using CGo ends up invoking a C compiler during building of a Go program/package. The C compiler is used to determine exact, possibly locally dependent, values of C preprocessor constants and other defines, as well as the exact layout of C structs. This enables the Go compiler to correctly handle things like, schematically `C.someStruct.someField` appearing in Go code.

    At runtime a Go program using CGo must switch stacks when calling into C. Additionally the runtime scheduler is made aware of such calls into C. The former is necessary, the later is not, but it is good to have as it improves performance and provides better resource management.

    There is an evironment variable defined, `CGO_ENABLED`. When the Go build system compiles Go code, it checks for the value of this env var. If it is not set or its value is "1", then CGo is enabled and used when 'import "C"' is encountered. If the env var contains "0", CGo is disabled and programs using 'import "C"' will not compile.

    After this longish intro we can finally get to the short answer: CGo-free means this package can be compiled with CGO_ENABLED=0. In other words, there's no 'import "C"' clause anywhere.

    The consequences of being CGo-free follows from the above. The Go build system does not need to invoke a C compiler when compiling this package. Hence users don't have to have a C compiler installed in their machines.

    There are advantages when a C compiler is not invoked during compilation/build of Go code. Programs can be installed on all targets supported by this package the easy way: '$ go install example.com/foo@latest' and programs for all supported targets can be cross-compiled on all Go-supported targets just by setting the respective env vars, like performing '$ GOOS=darwin GOARCH=arm64 go build' on a Windows/AMD64 machine, for example.

  • How does this package achieve being CGo-free?

    The answer depends on the particular target in question. Targets supported by purego call into the Tcl/Tk C libraries without using CGo. See the source code at the link for how it is done.

    On other targets CGo is avoided by transpiling all the C libraries and their transitive dependencies to Go.

    In both cases the advantages are the same: CGo-free programs are go-installable and CGo-free programs can be cross-compiled without having a C compiler or a cross-C compiler tool chain installed.

  • Does being CGo-free remove the overhead of crossing the Go-C boundary?

    For the purego targets, no. Only the C compiler is not involved anymore.

    For other supported targets the boundary for calling Tcl/Tk C API from Go is gone. No free lunches though, the transpilled code has to care about additional things the C code does not need to - with the respective performance penalties, now just in different places.

Widget catalogue

Debugging

Consider this program in _examples/debugging.go:

// Build this program using -tags=tk.dmesg
package main

import . "modernc.org/tk9.0"

func main() {
	Pack(
		TButton(Txt("Hello"), Command(func() { Destroy(App) })),
		Ipadx(10), Ipady(5), Padx(20), Pady(10),
	)
	App.Wait()
}

Execute the program using the tags as indicated, then close the window or click the Hello button. With the tk.dmesg tag the package initialization prints the debug messages path. So we can view it, for example, like this:

$ go run -tags=tk.dmesg _examples/debugging.go | tee log
...
/tmp/debugging-18876-20240928-163046
$ cat /tmp/debugging-18876-20240928-163046
[18876 debugging] enter [dmesgon.go:32:0 proc.go:7278:doInit1 proc.go:7245:doInit]
...
[18876 debugging] code=wm iconphoto . img2 -> r= err=<nil> [tk_purego.go:225:eval tk_purego.go:225:eval tk.go:354:evalErr]
[18876 debugging] code=wm title . debugging -> r= err=<nil> [tk_purego.go:225:eval tk_purego.go:225:eval tk.go:354:evalErr]
[18876 debugging] code=. configure -padx 4m -pady 3m -> r= err=<nil> [tk_purego.go:225:eval tk_purego.go:225:eval tk.go:354:evalErr]
[18876 debugging] code=tk::PlaceWindow . center -> r= err=<nil> [tk_purego.go:225:eval tk_purego.go:225:eval tk.go:354:evalErr]
[18876 debugging] code=ttk::button ..tbutton4 -text Hello -command {eventDispatcher 3} -> r=.tbutton4 err=<nil> [tk_purego.go:225:eval tk_purego.go:225:eval tk.go:342:newChild]
[18876 debugging] code=pack .tbutton4 -ipadx 10 -ipady 5 -padx 20 -pady 10 -> r= err=<nil> [tk_purego.go:225:eval tk_purego.go:225:eval tk.go:354:evalErr]
[18876 debugging] code=destroy . -> r= err=<nil> [tk_purego.go:225:eval tk_purego.go:225:eval tk.go:354:evalErr]
[18876 debugging] code=tkwait window . -> r= err=<nil> [tk_purego.go:225:eval tk_purego.go:225:eval tk.go:354:evalErr]
$

18876 was the process PID in this particular run. Using the tags allows to inspect the Tcl/Tk code executed during the lifetime of the process.

Supported targets

These combinations of GOOS and GOARCH are currently supported

OS      Arch
-------------
darwin  amd64
darwin  arm64
freebsd amd64
freebsd arm64
linux   386
linux   amd64
linux   arm
linux   arm64
linux   loong64
linux   ppc64le
linux   riscv64
linux   s390x
windows 386
windows amd64
windows arm64

Specific to FreeBSD:

When building with cross-compiling or CGO_ENABLED=0, add the following argument to `go` so that these symbols are defined by making fakecgo the Cgo.

-gcflags="github.com/ebitengine/purego/internal/fakecgo=-std"

Builders

Builder results available at modern-c.appspot.com.

Runtime dependencies

Completeness

At the moment the package is a MVP allowing to build at least some simple, yet useful programs. The full Tk API is not yet usable. Please report needed, but non-exposed Tk features at the issue tracker, thanks.

Providing feedback about the missing building blocks, bugs and your user experience is invaluable in helping this package to eventually reach version 1. See also RERO.

Error handling

The ErrorMode variable selects the behaviour on errors for certain functions that do not return error.

When ErrorMode is PanicOnError, the default, errors will panic, providing a stack trace.

When ErrorMode is CollectErrors, errors will be recorded using errors.Join in the Error variable. Even if a function does not return error, it is still possible to handle errors in the usual way when needed, except that Error is now a static variable. That's a problem in the general case, but less so in this package that must be used from a single goroutine only, as documented elsewhere.

// Explicit error handling.
ErrorMode = CollectErrors
if SomeFunnction(someArgument); Error != nil {
	... error handling goes here
}

This is obviously a compromise enabling to have a way to check for errors and, at the same time, the ability to write concise code like:

// Deferred error handling.
if b = Button(Txt("Foo"), Padx(5), Pady(10)); Error != nil {
	...
}

There are altogether four different places where the call to the Button function can produce errors as additionally to the call itself, every of its three arguments can independently fail as well. Checking each and one of them separately is not always necessary in GUI code. But the explicit option in the first example is still available when needed.

Themes

There is a centralized theme register in Themes. Theme providers can opt in to call RegisterTheme at package initialization to make themes discoverable at run-time. Clients can use ActivateTheme to apply a theme by name. Example in _examples/azure.go.

VNC server

There is a VNC over wbesockets functionality available for X11 backed hosts. See the tk9.0/vnc package for details.

Package initialization

Package initialization is done lazily. This saves noticeable additional startup time and avoids screen flicker in hybrid programs that use the GUI only on demand. (For a hybrid example see _examples/ring.go.)

Early package initialization can be enforced by Initialize.

Initialization will fail if a Unix process starts on a machine with no X server or the process is started in a way that it has no access to the X server. On the other hand, this package may work on Unix machines with no X server if the process is started remotely using '$ ssh -X foo@bar' and the X forwarding is enabled/supported.

Darwin port uses the macOS GUI API and does not use X11.

The options pattern

Zero or more options can be specified when creating a widget. For example

b := Button(Txt("Hello"), OverRelief("flat"))

or

lbl := myFrame.Label(State("disabled"), Width(200))

Widget path names, image and font names

Tcl/Tk uses widget pathnames, image and font names explicitly set by user code. This package generates those names automatically and they are not directly needed in code that uses this package.

Renamed options

There is, for a example, a Tcl/tk 'text' widget and a '-text' option. This package exports the widget as type 'TextWidget', its constructor as function 'Text' and the option as function 'Txt'. The complete list is:

OS thread

This package should be used from the same goroutine that initialized the package. Package initialization performs a runtime.LockOSThread, meaning func main() will start execuing locked on the same OS thread.

Event handlers

The Command() and similar options expect an argument that must be one of:

- An EventHandler or a function literal of the same signature.

- A func(). This can be used when the handler does not need the associated Event instance.

Specially handled types

When passing an argument of type time.Durarion to a function accepting 'any', the duration is converted to an integer number of milliseconds.

When passing an argument of type image.Image to a function accepting 'any', the image is converted to a encoding/base64 encoded string of the PNG representation of the image.

  • []byte

When passing an argument of type []byte to a function accepting 'any', the byte slice is converted to a encoding/base64 encoded string.

  • []FileType

When passing an argument of type []FileType to a function accepting 'any', the slice is converted to the representation the Tcl/Tk -filetypes option expects.

Tcl/Tk code

At least some minimal knowledge of reading Tcl/Tk code is probably required for using this package and/or using the related documentation. However you will not need to write any Tcl code and you do not need to care about the grammar of Tcl words/string literals and how it differs from Go.

There are several Tcl/Tk tutorials available, for example at tutorialspoint.

Hacking

Merge requests for known issues are always welcome.

Please send merge requests for new features/APIs after filling and discussing the additions/changes at the issue tracker first.

Notes

Most of the documentation is generated directly from the Tcl/Tk documentation and may not be entirely correct for the Go package. Those parts hopefully still serve as a quick/offline Tcl/Tk reference.

Additional copyrights

Parts of the documentation are copied and/or modified from the tcl.tk site, see the LICENSE-TCLTK file for details.

Parts of the documentation are copied and/or modified from the tkinter.ttk site which is

----------------------------------------------------------------------------
© Copyright 2001-2024, Python Software Foundation, licensed under the Python
Software Foundation License Version 2.
----------------------------------------------------------------------------

Sponsorship

You can support the maintenance and further development of this package at jnml's LiberaPay (using PayPal).

"alt" theme style guide

"Checkbutton.indicator" style element options:

"Combobox.downarrow" style element options:

"Menubutton.indicator" style element options:

"Radiobutton.indicator" style element options:

"Spinbox.downarrow" style element options:

"Spinbox.uparrow" style element options:

"Treeitem.indicator" style element options:

"arrow" style element options:

"border" style element options:

"downarrow" style element options:

"field" style element options:

"leftarrow" style element options:

"rightarrow" style element options:

"slider" style element options:

"thumb" style element options:

"uparrow" style element options:

"alt" theme style list

.

Style map: -foreground {disabled #a3a3a3} -background {disabled #d9d9d9 active #ececec} -embossed {disabled 1}

ComboboxPopdownFrame

Layout: ComboboxPopdownFrame.border -sticky nswe

Heading

Layout: Treeheading.cell -sticky nswe Treeheading.border -sticky nswe -children {Treeheading.padding -sticky nswe -children {Treeheading.image -side right -sticky {} Treeheading.text -sticky we}}

Item

Layout: Treeitem.padding -sticky nswe -children {Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} Treeitem.text -sticky nswe}

Separator

Layout: Treeitem.separator -sticky nswe

TButton

Layout: Button.border -sticky nswe -border 1 -children {Button.focus -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}}

Style map: -highlightcolor {alternate black} -relief { {pressed !disabled} sunken {active !disabled} raised }

TCheckbutton

Layout: Checkbutton.padding -sticky nswe -children {Checkbutton.indicator -side left -sticky {} Checkbutton.focus -side left -sticky w -children {Checkbutton.label -sticky nswe}}

Style map: -indicatorcolor {pressed #d9d9d9 alternate #aaaaaa disabled #d9d9d9}

TCombobox

Layout: Combobox.field -sticky nswe -children {Combobox.downarrow -side right -sticky ns Combobox.padding -sticky nswe -children {Combobox.textarea -sticky nswe}}

Style map: -fieldbackground {readonly #d9d9d9 disabled #d9d9d9} -arrowcolor {disabled #a3a3a3}

TEntry

Layout: Entry.field -sticky nswe -border 1 -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}

Style map: -fieldbackground {readonly #d9d9d9 disabled #d9d9d9}

TLabelframe

Layout: Labelframe.border -sticky nswe

TMenubutton

Layout: Menubutton.border -sticky nswe -children {Menubutton.focus -sticky nswe -children {Menubutton.indicator -side right -sticky {} Menubutton.padding -sticky we -children {Menubutton.label -side left -sticky {}}}}

TNotebook

Layout: Notebook.client -sticky nswe

TNotebook.Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Style map: -expand {selected {1.5p 1.5p 0.75p 0}} -background {selected #d9d9d9}

TProgressbar

-

TRadiobutton

Layout: Radiobutton.padding -sticky nswe -children {Radiobutton.indicator -side left -sticky {} Radiobutton.focus -side left -sticky {} -children {Radiobutton.label -sticky nswe}}

Style map: -indicatorcolor {pressed #d9d9d9 alternate #aaaaaa disabled #d9d9d9}

TScale

-

TScrollbar

-

TSpinbox

Layout: Spinbox.field -side top -sticky we -children {null -side right -sticky {} -children {Spinbox.uparrow -side top -sticky e Spinbox.downarrow -side bottom -sticky e} Spinbox.padding -sticky nswe -children {Spinbox.textarea -sticky nswe}}

Style map: -fieldbackground {readonly #d9d9d9 disabled #d9d9d9} -arrowcolor {disabled #a3a3a3}

Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Toolbutton

Layout: Toolbutton.border -sticky nswe -children {Toolbutton.focus -sticky nswe -children {Toolbutton.padding -sticky nswe -children {Toolbutton.label -sticky nswe}}}

Style map: -relief {disabled flat selected sunken pressed sunken active raised} -background {pressed #c3c3c3 active #ececec}

Treeview

Layout: Treeview.field -sticky nswe -border 1 -children {Treeview.padding -sticky nswe -children {Treeview.treearea -sticky nswe}}

Style map: -foreground {disabled #a3a3a3 selected #ffffff} -background {disabled #d9d9d9 selected #4a6984}

Treeview.Separator

Layout: Treeitem.separator -sticky nswe

"aqua" theme style guide

"Button.button" style element options:

"Checkbutton.button" style element options:

"Combobox.button" style element options:

"DisclosureButton.button" style element options:

"Entry.field" style element options:

"GradientButton.button" style element options:

"HelpButton.button" style element options:

"Horizontal.Scrollbar.leftarrow" style element options:

"Horizontal.Scrollbar.rightarrow" style element options:

"Horizontal.Scrollbar.thumb" style element options:

"Horizontal.Scrollbar.trough" style element options:

"InlineButton.button" style element options:

"Labelframe.border" style element options:

"Menubutton.button" style element options:

"Notebook.client" style element options:

"Notebook.tab" style element options:

"Progressbar.track" style element options:

"Radiobutton.button" style element options:

"RecessedButton.button" style element options:

"RoundedRectButton.button" style element options:

"Scale.slider" style element options:

"Scale.trough" style element options:

"Searchbox.field" style element options:

"SidebarButton.button" style element options:

"Spinbox.downarrow" style element options:

"Spinbox.field" style element options:

"Spinbox.uparrow" style element options:

"Toolbar.background" style element options:

"Toolbutton.border" style element options:

"Treeheading.cell" style element options:

"Treeitem.indicator" style element options:

"Treeview.treearea" style element options:

"Vertical.Scrollbar.downarrow" style element options:

"Vertical.Scrollbar.thumb" style element options:

"Vertical.Scrollbar.trough" style element options:

"Vertical.Scrollbar.uparrow" style element options:

"background" style element options:

"field" style element options:

"fill" style element options:

"hseparator" style element options:

"separator" style element options:

"sizegrip" style element options:

"vseparator" style element options:

"aqua" theme style list

.

Style map: -selectforeground { background systemSelectedTextColor !focus systemSelectedTextColor} -foreground { disabled systemDisabledControlTextColor background systemLabelColor} -selectbackground { background systemSelectedTextBackgroundColor !focus systemSelectedTextBackgroundColor}

DisclosureButton

Layout: DisclosureButton.button -sticky nswe

GradientButton

Layout: GradientButton.button -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}

Heading

Layout: Treeheading.cell -sticky nswe Treeheading.image -side right -sticky {} Treeheading.text -side top -sticky {}

HelpButton

Layout: HelpButton.button -sticky nswe

Horizontal.TScrollbar

Layout: Horizontal.Scrollbar.trough -sticky we -children {Horizontal.Scrollbar.thumb -sticky nswe Horizontal.Scrollbar.rightarrow -side right -sticky {} Horizontal.Scrollbar.leftarrow -side right -sticky {}}

ImageButton

Layout: Button.padding -sticky nswe -children {Button.label -sticky nswe}

Style map: -foreground { pressed systemLabelColor !pressed systemSecondaryLabelColor }

InlineButton

Layout: InlineButton.button -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}

Style map: -foreground { disabled systemWindowBackgroundColor }

Item

Layout: Treeitem.padding -sticky nswe -children {Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} Treeitem.text -side left -sticky {}}

Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

RecessedButton

Layout: RecessedButton.button -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}

Style map: -font { selected RecessedFont active RecessedFont pressed RecessedFont } -foreground { {disabled selected} systemWindowBackgroundColor3 {disabled !selected} systemDisabledControlTextColor selected systemTextBackgroundColor active white pressed white }

RoundedRectButton

Layout: RoundedRectButton.button -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}

Searchbox

Layout: Searchbox.field -sticky nswe -border 1 -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}

SidebarButton

Layout: SidebarButton.button -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}

Style map: -foreground { {disabled selected} systemWindowBackgroundColor3 {disabled !selected} systemDisabledControlTextColor selected systemTextColor active systemTextColor pressed systemTextColor }

TButton

Layout: Button.button -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}

Style map: -foreground { pressed white {alternate !pressed !background} white disabled systemDisabledControlTextColor}

TCheckbutton

Layout: Checkbutton.button -sticky nswe -children {Checkbutton.padding -sticky nswe -children {Checkbutton.label -side left -sticky {}}}

TCombobox

Layout: Combobox.button -sticky nswe -children {Combobox.padding -sticky nswe -children {Combobox.textarea -sticky nswe}}

Style map: -foreground { disabled systemDisabledControlTextColor } -selectbackground { !focus systemUnemphasizedSelectedTextBackgroundColor }

TEntry

Layout: Entry.field -sticky nswe -border 1 -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}

Style map: -foreground { disabled systemDisabledControlTextColor } -selectbackground { !focus systemUnemphasizedSelectedTextBackgroundColor }

TLabelframe

Layout: Labelframe.border -sticky nswe

TLabelframe.Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

TMenubutton

Layout: Menubutton.button -sticky nswe -children {Menubutton.padding -sticky nswe -children {Menubutton.label -side left -sticky {}}}

TNotebook

Layout: Notebook.client -sticky nswe

TNotebook.Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -sticky nswe -children {Notebook.label -sticky nswe}}

Style map: -foreground { {background !selected} systemControlTextColor {background selected} black {!background selected} systemSelectedTabTextColor disabled systemDisabledControlTextColor}

TProgressbar

Layout: Progressbar.track -sticky nswe

TRadiobutton

Layout: Radiobutton.button -sticky nswe -children {Radiobutton.padding -sticky nswe -children {Radiobutton.label -side left -sticky {}}}

TScrollbar

-

TSpinbox

Layout: Spinbox.buttons -side right -sticky {} -children {Spinbox.uparrow -side top -sticky e Spinbox.downarrow -side bottom -sticky e} Spinbox.field -sticky we -children {Spinbox.textarea -sticky we}

Style map: -foreground { disabled systemDisabledControlTextColor } -selectbackground { !focus systemUnemphasizedSelectedTextBackgroundColor }

Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -sticky nswe -children {Notebook.label -sticky nswe}}

Toolbar

Layout: Toolbar.background -sticky nswe

Toolbutton

Layout: Toolbutton.border -sticky nswe -children {Toolbutton.focus -sticky nswe -children {Toolbutton.padding -sticky nswe -children {Toolbutton.label -sticky nswe}}}

Treeview

Layout: Treeview.field -sticky nswe -children {Treeview.padding -sticky nswe -children {Treeview.treearea -sticky nswe}}

Style map: -background { selected systemSelectedTextBackgroundColor }

Vertical.TScrollbar

Layout: Vertical.Scrollbar.trough -sticky ns -children {Vertical.Scrollbar.thumb -sticky nswe Vertical.Scrollbar.downarrow -side bottom -sticky {} Vertical.Scrollbar.uparrow -side bottom -sticky {}}

"clam" theme style guide

"Checkbutton.indicator" style element options:

"Combobox.field" style element options:

"Radiobutton.indicator" style element options:

"Spinbox.downarrow" style element options:

"Spinbox.uparrow" style element options:

"arrow" style element options:

"bar" style element options:

"border" style element options:

"client" style element options:

"downarrow" style element options:

"field" style element options:

"hgrip" style element options:

"leftarrow" style element options:

"pbar" style element options:

"rightarrow" style element options:

"slider" style element options:

"tab" style element options:

"thumb" style element options:

"trough" style element options:

"uparrow" style element options:

"vgrip" style element options:

"clam" theme style list

.

Style map: -selectforeground {!focus white} -foreground {disabled #999999} -selectbackground {!focus #9e9a91} -background {disabled #dcdad5 active #eeebe7}

ComboboxPopdownFrame

Layout: ComboboxPopdownFrame.border -sticky nswe

Heading

Layout: Treeheading.cell -sticky nswe Treeheading.border -sticky nswe -children {Treeheading.padding -sticky nswe -children {Treeheading.image -side right -sticky {} Treeheading.text -sticky we}}

Horizontal.Sash

Layout: Sash.hsash -sticky nswe -children {Sash.hgrip -sticky nswe}

Item

Layout: Treeitem.padding -sticky nswe -children {Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} Treeitem.text -sticky nswe}

Sash

-

Separator

Layout: Treeitem.separator -sticky nswe

TButton

Layout: Button.border -sticky nswe -border 1 -children {Button.focus -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}}

Style map: -lightcolor {pressed #bab5ab} -background {disabled #dcdad5 pressed #bab5ab active #eeebe7} -bordercolor {alternate #000000} -darkcolor {pressed #bab5ab}

TCheckbutton

Layout: Checkbutton.padding -sticky nswe -children {Checkbutton.indicator -side left -sticky {} Checkbutton.focus -side left -sticky w -children {Checkbutton.label -sticky nswe}}

Style map: -indicatorbackground {pressed #dcdad5 {!disabled alternate} #5895bc {disabled alternate} #a0a0a0 disabled #dcdad5}

TCombobox

Layout: Combobox.downarrow -side right -sticky ns Combobox.field -sticky nswe -children {Combobox.padding -sticky nswe -children {Combobox.textarea -sticky nswe}}

Style map: -foreground {{readonly focus} #ffffff} -fieldbackground {{readonly focus} #4a6984 readonly #dcdad5} -background {active #eeebe7 pressed #eeebe7} -bordercolor {focus #4a6984} -arrowcolor {disabled #999999}

TEntry

Layout: Entry.field -sticky nswe -border 1 -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}

Style map: -lightcolor {focus #6f9dc6} -background {readonly #dcdad5} -bordercolor {focus #4a6984}

TLabelframe

Layout: Labelframe.border -sticky nswe

TMenubutton

Layout: Menubutton.border -sticky nswe -children {Menubutton.focus -sticky nswe -children {Menubutton.indicator -side right -sticky {} Menubutton.padding -sticky we -children {Menubutton.label -side left -sticky {}}}}

TNotebook.Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Style map: -lightcolor {selected #eeebe7 {} #cfcdc8} -padding {selected {4.5p 3p 4.5p 1.5p}} -background {selected #dcdad5 {} #bab5ab}

TProgressbar

-

TRadiobutton

Layout: Radiobutton.padding -sticky nswe -children {Radiobutton.indicator -side left -sticky {} Radiobutton.focus -side left -sticky {} -children {Radiobutton.label -sticky nswe}}

Style map: -indicatorbackground {pressed #dcdad5 {!disabled alternate} #5895bc {disabled alternate} #a0a0a0 disabled #dcdad5}

TScale

-

TScrollbar

-

TSpinbox

Layout: Spinbox.field -side top -sticky we -children {null -side right -sticky {} -children {Spinbox.uparrow -side top -sticky e Spinbox.downarrow -side bottom -sticky e} Spinbox.padding -sticky nswe -children {Spinbox.textarea -sticky nswe}}

Style map: -background {readonly #dcdad5} -bordercolor {focus #4a6984} -arrowcolor {disabled #999999}

Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Toolbutton

Layout: Toolbutton.border -sticky nswe -children {Toolbutton.focus -sticky nswe -children {Toolbutton.padding -sticky nswe -children {Toolbutton.label -sticky nswe}}}

Style map: -lightcolor {pressed #bab5ab} -relief {disabled flat selected sunken pressed sunken active raised} -background {disabled #dcdad5 pressed #bab5ab active #eeebe7} -darkcolor {pressed #bab5ab}

Treeview

Layout: Treeview.field -sticky nswe -border 1 -children {Treeview.padding -sticky nswe -children {Treeview.treearea -sticky nswe}}

Style map: -foreground {disabled #999999 selected #ffffff} -background {disabled #dcdad5 selected #4a6984} -bordercolor {focus #4a6984}

Treeview.Separator

Layout: Treeitem.separator -sticky nswe

Vertical.Sash

Layout: Sash.vsash -sticky nswe -children {Sash.vgrip -sticky nswe}

"classic" theme style guide

"Button.border" style element options:

"Checkbutton.indicator" style element options:

"Combobox.downarrow" style element options:

"Menubutton.indicator" style element options:

"Radiobutton.indicator" style element options:

"Spinbox.downarrow" style element options:

"Spinbox.uparrow" style element options:

"arrow" style element options:

"downarrow" style element options:

"highlight" style element options:

"hsash" style element options:

"leftarrow" style element options:

"rightarrow" style element options:

"slider" style element options:

"uparrow" style element options:

"vsash" style element options:

"classic" theme style list

.

Style map: -highlightcolor {focus black} -foreground {disabled #a3a3a3} -background {disabled #d9d9d9 active #ececec}

ComboboxPopdownFrame

Layout: ComboboxPopdownFrame.border -sticky nswe

Heading

Layout: Treeheading.cell -sticky nswe Treeheading.border -sticky nswe -children {Treeheading.padding -sticky nswe -children {Treeheading.image -side right -sticky {} Treeheading.text -sticky we}}

Horizontal.TScale

Layout: Horizontal.Scale.highlight -sticky nswe -children {Horizontal.Scale.trough -sticky nswe -children {Horizontal.Scale.slider -side left -sticky {}}}

Item

Layout: Treeitem.padding -sticky nswe -children {Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} Treeitem.text -sticky nswe}

Sash

-

Separator

Layout: Treeitem.separator -sticky nswe

TButton

Layout: Button.highlight -sticky nswe -children {Button.border -sticky nswe -border 1 -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}}

Style map: -relief {{!disabled pressed} sunken}

TCheckbutton

Layout: Checkbutton.highlight -sticky nswe -children {Checkbutton.border -sticky nswe -children {Checkbutton.padding -sticky nswe -children {Checkbutton.indicator -side left -sticky {} Checkbutton.label -side left -sticky nswe}}}

Style map: -indicatorrelief {alternate raised selected sunken pressed sunken} -indicatorcolor {pressed #d9d9d9 alternate #b05e5e selected #b03060}

TCombobox

Layout: Combobox.highlight -sticky nswe -children {Combobox.field -sticky nswe -children {Combobox.downarrow -side right -sticky ns Combobox.padding -sticky nswe -children {Combobox.textarea -sticky nswe}}}

Style map: -fieldbackground {readonly #d9d9d9 disabled #d9d9d9}

TEntry

Layout: Entry.highlight -sticky nswe -children {Entry.field -sticky nswe -border 1 -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}}

Style map: -fieldbackground {readonly #d9d9d9 disabled #d9d9d9}

TLabelframe

Layout: Labelframe.border -sticky nswe

TMenubutton

Layout: Menubutton.highlight -sticky nswe -children {Menubutton.border -sticky nswe -children {Menubutton.indicator -side right -sticky {} Menubutton.padding -sticky we -children {Menubutton.label -sticky {}}}}

TNotebook.Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Style map: -background {selected #d9d9d9}

TProgressbar

-

TRadiobutton

Layout: Radiobutton.highlight -sticky nswe -children {Radiobutton.border -sticky nswe -children {Radiobutton.padding -sticky nswe -children {Radiobutton.indicator -side left -sticky {} Radiobutton.label -side left -sticky nswe}}}

Style map: -indicatorrelief {alternate raised selected sunken pressed sunken} -indicatorcolor {pressed #d9d9d9 alternate #b05e5e selected #b03060}

TScale

Style map: -sliderrelief {{pressed !disabled} sunken}

TScrollbar

Style map: -relief {{pressed !disabled} sunken}

TSpinbox

Layout: Spinbox.highlight -sticky nswe -children {Spinbox.field -sticky nswe -children {null -side right -sticky {} -children {Spinbox.uparrow -side top -sticky e Spinbox.downarrow -side bottom -sticky e} Spinbox.padding -sticky nswe -children {Spinbox.textarea -sticky nswe}}}

Style map: -fieldbackground {readonly #d9d9d9 disabled #d9d9d9}

Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Toolbutton

Layout: Toolbutton.focus -sticky nswe -children {Toolbutton.border -sticky nswe -children {Toolbutton.padding -sticky nswe -children {Toolbutton.label -sticky nswe}}}

Style map: -relief {disabled flat selected sunken pressed sunken active raised} -background {pressed #b3b3b3 active #ececec}

Treeview

Layout: Treeview.highlight -sticky nswe -children {Treeview.field -sticky nswe -border 1 -children {Treeview.padding -sticky nswe -children {Treeview.treearea -sticky nswe}}}

Style map: -foreground {disabled #a3a3a3 selected #000000} -background {disabled #d9d9d9 selected #c3c3c3}

Treeview.Separator

Layout: Treeitem.separator -sticky nswe

Vertical.TScale

Layout: Vertical.Scale.highlight -sticky nswe -children {Vertical.Scale.trough -sticky nswe -children {Vertical.Scale.slider -side top -sticky {}}}

"default" theme style guide

"" style element options:

"Checkbutton.indicator" style element options:

"Combobox.downarrow" style element options:

"Menubutton.indicator" style element options:

"Radiobutton.indicator" style element options:

"Spinbox.downarrow" style element options:

"Spinbox.uparrow" style element options:

"Treeheading.cell" style element options:

"Treeitem.indicator" style element options:

"Treeitem.row" style element options:

"Treeitem.separator" style element options:

"arrow" style element options:

"background" style element options:

"border" style element options:

"client" style element options:

"ctext" style element options:

"downarrow" style element options:

"field" style element options:

"fill" style element options:

"focus" style element options:

"hsash" style element options:

"hseparator" style element options:

"image" style element options:

"indicator" style element options:

"label" style element options:

"leftarrow" style element options:

"padding" style element options:

"pbar" style element options:

"rightarrow" style element options:

"separator" style element options:

"sizegrip" style element options:

"slider" style element options:

"tab" style element options:

"text" style element options:

"textarea" style element options:

"thumb" style element options:

"treearea" style element options:

"trough" style element options:

"uparrow" style element options:

"vsash" style element options:

"vseparator" style element options:

"default" theme style list

.

Style map: -foreground {disabled #a3a3a3} -background {disabled #edeceb active #ececec}

Cell

Layout: Treedata.padding -sticky nswe -children {Treeitem.image -side left -sticky {} Treeitem.text -sticky nswe}

ComboboxPopdownFrame

Layout: ComboboxPopdownFrame.border -sticky nswe

Heading

Layout: Treeheading.cell -sticky nswe Treeheading.border -sticky nswe -children {Treeheading.padding -sticky nswe -children {Treeheading.image -side right -sticky {} Treeheading.text -sticky we}}

Horizontal.Sash

Layout: Sash.hsash -sticky we

Horizontal.TProgressbar

Layout: Horizontal.Progressbar.trough -sticky nswe -children {Horizontal.Progressbar.pbar -side left -sticky ns Horizontal.Progressbar.ctext -side left -sticky {}}

Horizontal.TScale

Layout: Horizontal.Scale.focus -sticky nswe -children {Horizontal.Scale.padding -sticky nswe -children {Horizontal.Scale.trough -sticky nswe -children {Horizontal.Scale.slider -side left -sticky {}}}}

Horizontal.TScrollbar

Layout: Horizontal.Scrollbar.trough -sticky we -children {Horizontal.Scrollbar.leftarrow -side left -sticky {} Horizontal.Scrollbar.rightarrow -side right -sticky {} Horizontal.Scrollbar.thumb -sticky nswe}

Item

Layout: Treeitem.padding -sticky nswe -children {Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} Treeitem.text -sticky nswe}

Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

Row

Layout: Treeitem.row -sticky nswe

Sash

-

Separator

Layout: Treeitem.separator -sticky nswe

TButton

Layout: Button.border -sticky nswe -border 1 -children {Button.focus -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}}

Style map: -relief {{!disabled pressed} sunken}

TCheckbutton

Layout: Checkbutton.padding -sticky nswe -children {Checkbutton.indicator -side left -sticky {} Checkbutton.focus -side left -sticky w -children {Checkbutton.label -sticky nswe}}

Style map: -indicatorbackground {{alternate disabled} #a3a3a3 {alternate pressed} #5895bc alternate #4a6984 {selected disabled} #a3a3a3 {selected pressed} #5895bc selected #4a6984 disabled #edeceb pressed #c3c3c3}

TCombobox

Layout: Combobox.field -sticky nswe -children {Combobox.downarrow -side right -sticky ns Combobox.padding -sticky nswe -children {Combobox.textarea -sticky nswe}}

Style map: -fieldbackground {readonly #edeceb disabled #edeceb} -arrowcolor {disabled #a3a3a3}

TEntry

Layout: Entry.field -sticky nswe -border 1 -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}

Style map: -fieldbackground {readonly #edeceb disabled #edeceb}

TFrame

Layout: Frame.border -sticky nswe

TLabel

Layout: Label.border -sticky nswe -border 1 -children {Label.padding -sticky nswe -border 1 -children {Label.label -sticky nswe}}

TLabelframe

Layout: Labelframe.border -sticky nswe

TMenubutton

Layout: Menubutton.border -sticky nswe -children {Menubutton.focus -sticky nswe -children {Menubutton.indicator -side right -sticky {} Menubutton.padding -sticky we -children {Menubutton.label -side left -sticky {}}}}

Style map: -arrowcolor {disabled #a3a3a3}

TNotebook

Layout: Notebook.client -sticky nswe

TNotebook.Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Style map: -highlightcolor {selected #4a6984} -highlight {selected 1} -background {selected #edeceb}

TPanedwindow

Layout: Panedwindow.background -sticky {}

TProgressbar

-

TRadiobutton

Layout: Radiobutton.padding -sticky nswe -children {Radiobutton.indicator -side left -sticky {} Radiobutton.focus -side left -sticky {} -children {Radiobutton.label -sticky nswe}}

Style map: -indicatorbackground {{alternate disabled} #a3a3a3 {alternate pressed} #5895bc alternate #4a6984 {selected disabled} #a3a3a3 {selected pressed} #5895bc selected #4a6984 disabled #edeceb pressed #c3c3c3}

TScale

Style map: -outercolor {active #ececec}

TScrollbar

Style map: -arrowcolor {disabled #a3a3a3}

TSeparator

Layout: Separator.separator -sticky nswe

TSizegrip

Layout: Sizegrip.sizegrip -side bottom -sticky se

TSpinbox

Layout: Spinbox.field -side top -sticky we -children {null -side right -sticky {} -children {Spinbox.uparrow -side top -sticky e Spinbox.downarrow -side bottom -sticky e} Spinbox.padding -sticky nswe -children {Spinbox.textarea -sticky nswe}}

Style map: -fieldbackground {readonly #edeceb disabled #edeceb} -arrowcolor {disabled #a3a3a3}

Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Toolbutton

Layout: Toolbutton.border -sticky nswe -children {Toolbutton.focus -sticky nswe -children {Toolbutton.padding -sticky nswe -children {Toolbutton.label -sticky nswe}}}

Style map: -relief {disabled flat selected sunken pressed sunken active raised} -background {pressed #c3c3c3 active #ececec}

Treeview

Layout: Treeview.field -sticky nswe -border 1 -children {Treeview.padding -sticky nswe -children {Treeview.treearea -sticky nswe}}

Style map: -foreground {disabled #a3a3a3 selected #ffffff} -background {disabled #edeceb selected #4a6984}

Treeview.Separator

Layout: Treeitem.separator -sticky nswe

Vertical.Sash

Layout: Sash.vsash -sticky ns

Vertical.TProgressbar

Layout: Vertical.Progressbar.trough -sticky nswe -children {Vertical.Progressbar.pbar -side bottom -sticky we}

Vertical.TScale

Layout: Vertical.Scale.focus -sticky nswe -children {Vertical.Scale.padding -sticky nswe -children {Vertical.Scale.trough -sticky nswe -children {Vertical.Scale.slider -side top -sticky {}}}}

Vertical.TScrollbar

Layout: Vertical.Scrollbar.trough -sticky ns -children {Vertical.Scrollbar.uparrow -side top -sticky {} Vertical.Scrollbar.downarrow -side bottom -sticky {} Vertical.Scrollbar.thumb -sticky nswe}PASS

"vista" theme style guide

"Combobox.background" style element options:

"Combobox.border" style element options:

"Combobox.rightdownarrow" style element options:

"ComboboxPopdownFrame.background" style element options:

"Entry.background" style element options:

"Entry.field" style element options:

"Horizontal.Progressbar.pbar" style element options:

"Horizontal.Scale.slider" style element options:

"Horizontal.Scrollbar.grip" style element options:

"Horizontal.Scrollbar.leftarrow" style element options:

"Horizontal.Scrollbar.rightarrow" style element options:

"Horizontal.Scrollbar.thumb" style element options:

"Horizontal.Scrollbar.trough" style element options:

"Menubutton.dropdown" style element options:

"Spinbox.background" style element options:

"Spinbox.downarrow" style element options:

"Spinbox.field" style element options:

"Spinbox.innerbg" style element options:

"Spinbox.uparrow" style element options:

"Vertical.Progressbar.pbar" style element options:

"Vertical.Scale.slider" style element options:

"Vertical.Scrollbar.downarrow" style element options:

"Vertical.Scrollbar.grip" style element options:

"Vertical.Scrollbar.thumb" style element options:

"Vertical.Scrollbar.trough" style element options:

"Vertical.Scrollbar.uparrow" style element options:

"vista" theme style list

.

Style map: -foreground {disabled SystemGrayText}

ComboboxPopdownFrame

Layout: ComboboxPopdownFrame.background -sticky nswe -border 1 -children {ComboboxPopdownFrame.padding -sticky nswe}

Heading

Layout: Treeheading.cell -sticky nswe Treeheading.border -sticky nswe -children {Treeheading.padding -sticky nswe -children {Treeheading.image -side right -sticky {} Treeheading.text -sticky we}}

Horizontal.TProgressbar

Layout: Horizontal.Progressbar.trough -sticky nswe -children {Horizontal.Progressbar.pbar -side left -sticky ns Horizontal.Progressbar.ctext -sticky nswe}

Horizontal.TScale

Layout: Scale.focus -sticky nswe -children {Horizontal.Scale.trough -sticky nswe -children {Horizontal.Scale.track -sticky we Horizontal.Scale.slider -side left -sticky {}}}

Item

Layout: Treeitem.padding -sticky nswe -children {Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} Treeitem.text -sticky nswe}

Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

Separator

Layout: Treeitem.separator -sticky nswe

TButton

Layout: Button.button -sticky nswe -children {Button.focus -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}}

TCheckbutton

Layout: Checkbutton.padding -sticky nswe -children {Checkbutton.indicator -side left -sticky {} Checkbutton.focus -side left -sticky w -children {Checkbutton.label -sticky nswe}}

TCombobox

Layout: Combobox.border -sticky nswe -children {Combobox.rightdownarrow -side right -sticky ns Combobox.padding -sticky nswe -children {Combobox.background -sticky nswe -children {Combobox.focus -sticky nswe -children {Combobox.textarea -sticky nswe}}}}

Style map: -focusfill {{readonly focus} SystemHighlight} -foreground {disabled SystemGrayText {readonly focus} SystemHighlightText} -selectforeground {!focus SystemWindowText} -selectbackground {!focus SystemWindow}

TEntry

Layout: Entry.field -sticky nswe -children {Entry.background -sticky nswe -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}}

Style map: -selectforeground {!focus SystemWindowText} -selectbackground {!focus SystemWindow}

TLabelframe.Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

TMenubutton

Layout: Menubutton.dropdown -side right -sticky ns Menubutton.button -sticky nswe -children {Menubutton.padding -sticky we -children {Menubutton.label -sticky {}}}

TNotebook

Layout: Notebook.client -sticky nswe

TNotebook.Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Style map: -expand {selected {2 2 2 2}}

TProgressbar

-

TRadiobutton

Layout: Radiobutton.padding -sticky nswe -children {Radiobutton.indicator -side left -sticky {} Radiobutton.focus -side left -sticky {} -children {Radiobutton.label -sticky nswe}}

TScale

-

TSpinbox

Layout: Spinbox.field -sticky nswe -children {Spinbox.background -sticky nswe -children {Spinbox.padding -sticky nswe -children {Spinbox.innerbg -sticky nswe -children {Spinbox.textarea -sticky nswe}} Spinbox.uparrow -side top -sticky nse Spinbox.downarrow -side bottom -sticky nse}}

Style map: -selectforeground {!focus SystemWindowText} -selectbackground {!focus SystemWindow}

Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Toolbutton

Layout: Toolbutton.border -sticky nswe -children {Toolbutton.focus -sticky nswe -children {Toolbutton.padding -sticky nswe -children {Toolbutton.label -sticky nswe}}}

Treeview

Layout: Treeview.field -sticky nswe -border 1 -children {Treeview.padding -sticky nswe -children {Treeview.treearea -sticky nswe}}

Style map: -foreground {disabled SystemGrayText selected SystemHighlightText} -background {disabled SystemButtonFace selected SystemHighlight}

Treeview.Separator

Layout: Treeitem.separator -sticky nswe

Vertical.TProgressbar

Layout: Vertical.Progressbar.trough -sticky nswe -children {Vertical.Progressbar.pbar -side bottom -sticky we}

Vertical.TScale

Layout: Scale.focus -sticky nswe -children {Vertical.Scale.trough -sticky nswe -children {Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {}}}

"winnative" theme style guide

"Button.border" style element options:

"Checkbutton.indicator" style element options:

"Combobox.focus" style element options:

"ComboboxPopdownFrame.border" style element options:

"Radiobutton.indicator" style element options:

"Scrollbar.trough" style element options:

"Spinbox.downarrow" style element options:

"Spinbox.uparrow" style element options:

"border" style element options:

"client" style element options:

"downarrow" style element options:

"field" style element options:

"focus" style element options:

"leftarrow" style element options:

"rightarrow" style element options:

"sizegrip" style element options:

"slider" style element options:

"tab" style element options:

"thumb" style element options:

"uparrow" style element options:

"winnative" theme style list

.

Style map: -foreground {disabled SystemGrayText} -embossed {disabled 1}

ComboboxPopdownFrame

Layout: ComboboxPopdownFrame.border -sticky nswe

Heading

Layout: Treeheading.cell -sticky nswe Treeheading.border -sticky nswe -children {Treeheading.padding -sticky nswe -children {Treeheading.image -side right -sticky {} Treeheading.text -sticky we}}

Item

Layout: Treeitem.padding -sticky nswe -children {Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} Treeitem.text -sticky nswe}

Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

Separator

Layout: Treeitem.separator -sticky nswe

TButton

Layout: Button.border -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}

Style map: -relief {{!disabled pressed} sunken}

TCheckbutton

Layout: Checkbutton.padding -sticky nswe -children {Checkbutton.indicator -side left -sticky {} Checkbutton.focus -side left -sticky w -children {Checkbutton.label -sticky nswe}}

TCombobox

Layout: Combobox.field -sticky nswe -children {Combobox.downarrow -side right -sticky ns Combobox.padding -sticky nswe -children {Combobox.focus -sticky nswe -children {Combobox.textarea -sticky nswe}}}

Style map: -focusfill {{readonly focus} SystemHighlight} -foreground {disabled SystemGrayText {readonly focus} SystemHighlightText} -selectforeground {!focus SystemWindowText} -fieldbackground {readonly SystemButtonFace disabled SystemButtonFace} -selectbackground {!focus SystemWindow}

TEntry

Layout: Entry.field -sticky nswe -border 1 -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}

Style map: -selectforeground {!focus SystemWindowText} -selectbackground {!focus SystemWindow} -fieldbackground {readonly SystemButtonFace disabled SystemButtonFace}

TLabelframe

Layout: Labelframe.border -sticky nswe

TLabelframe.Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

TMenubutton

Layout: Menubutton.border -sticky nswe -children {Menubutton.focus -sticky nswe -children {Menubutton.indicator -side right -sticky {} Menubutton.padding -sticky we -children {Menubutton.label -side left -sticky {}}}}

TNotebook

Layout: Notebook.client -sticky nswe

TNotebook.Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Style map: -expand {selected {2 2 2 0}}

TProgressbar

-

TRadiobutton

Layout: Radiobutton.padding -sticky nswe -children {Radiobutton.indicator -side left -sticky {} Radiobutton.focus -side left -sticky {} -children {Radiobutton.label -sticky nswe}}

TScale

-

TSpinbox

Layout: Spinbox.field -side top -sticky we -children {null -side right -sticky {} -children {Spinbox.uparrow -side top -sticky e Spinbox.downarrow -side bottom -sticky e} Spinbox.padding -sticky nswe -children {Spinbox.textarea -sticky nswe}}

Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Toolbutton

Layout: Toolbutton.border -sticky nswe -children {Toolbutton.focus -sticky nswe -children {Toolbutton.padding -sticky nswe -children {Toolbutton.label -sticky nswe}}}

Style map: -relief {disabled flat selected sunken pressed sunken active raised}

Treeview

Layout: Treeview.field -sticky nswe -border 1 -children {Treeview.padding -sticky nswe -children {Treeview.treearea -sticky nswe}}

Style map: -foreground {disabled SystemGrayText selected SystemHighlightText} -background {disabled SystemButtonFace selected SystemHighlight}

Treeview.Separator

Layout: Treeitem.separator -sticky nswe

"xpnative" theme style guide

"Button.button" style element options:

"Checkbutton.indicator" style element options:

"Combobox.downarrow" style element options:

"Combobox.field" style element options:

"Entry.field" style element options:

"Horizontal.Progressbar.pbar" style element options:

"Horizontal.Progressbar.trough" style element options:

"Horizontal.Scale.slider" style element options:

"Horizontal.Scale.track" style element options:

"Horizontal.Scrollbar.grip" style element options:

"Horizontal.Scrollbar.thumb" style element options:

"Horizontal.Scrollbar.trough" style element options:

"Labelframe.border" style element options:

"Menubutton.button" style element options:

"Menubutton.dropdown" style element options:

"NotebookPane.background" style element options:

"Radiobutton.indicator" style element options:

"Scale.trough" style element options:

"Scrollbar.downarrow" style element options:

"Scrollbar.leftarrow" style element options:

"Scrollbar.rightarrow" style element options:

"Scrollbar.uparrow" style element options:

"Spinbox.downarrow" style element options:

"Spinbox.field" style element options:

"Spinbox.uparrow" style element options:

"Toolbutton.border" style element options:

"Treeheading.border" style element options:

"Treeitem.indicator" style element options:

"Treeview.field" style element options:

"Vertical.Progressbar.pbar" style element options:

"Vertical.Progressbar.trough" style element options:

"Vertical.Scale.slider" style element options:

"Vertical.Scale.track" style element options:

"Vertical.Scrollbar.grip" style element options:

"Vertical.Scrollbar.thumb" style element options:

"Vertical.Scrollbar.trough" style element options:

"client" style element options:

"sizegrip" style element options:

"tab" style element options:

"xpnative" theme style list

.

Style map: -foreground {disabled SystemGrayText}

Heading

Layout: Treeheading.cell -sticky nswe Treeheading.border -sticky nswe -children {Treeheading.padding -sticky nswe -children {Treeheading.image -side right -sticky {} Treeheading.text -sticky we}}

Horizontal.TScale

Layout: Scale.focus -sticky nswe -children {Horizontal.Scale.trough -sticky nswe -children {Horizontal.Scale.track -sticky we Horizontal.Scale.slider -side left -sticky {}}}

Horizontal.TScrollbar

Layout: Horizontal.Scrollbar.trough -sticky we -children {Horizontal.Scrollbar.leftarrow -side left -sticky {} Horizontal.Scrollbar.rightarrow -side right -sticky {} Horizontal.Scrollbar.thumb -sticky nswe -unit 1 -children {Horizontal.Scrollbar.grip -sticky {}}}

Item

Layout: Treeitem.padding -sticky nswe -children {Treeitem.indicator -side left -sticky {} Treeitem.image -side left -sticky {} Treeitem.text -sticky nswe}

Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

Separator

Layout: Treeitem.separator -sticky nswe

TButton

Layout: Button.button -sticky nswe -children {Button.focus -sticky nswe -children {Button.padding -sticky nswe -children {Button.label -sticky nswe}}}

TCheckbutton

Layout: Checkbutton.padding -sticky nswe -children {Checkbutton.indicator -side left -sticky {} Checkbutton.focus -side left -sticky w -children {Checkbutton.label -sticky nswe}}

TCombobox

Layout: Combobox.field -sticky nswe -children {Combobox.downarrow -side right -sticky ns Combobox.padding -sticky nswe -children {Combobox.focus -sticky nswe -children {Combobox.textarea -sticky nswe}}}

Style map: -focusfill {{readonly focus} SystemHighlight} -foreground {disabled SystemGrayText {readonly focus} SystemHighlightText} -selectforeground {!focus SystemWindowText} -selectbackground {!focus SystemWindow}

TEntry

Layout: Entry.field -sticky nswe -border 1 -children {Entry.padding -sticky nswe -children {Entry.textarea -sticky nswe}}

Style map: -selectforeground {!focus SystemWindowText} -selectbackground {!focus SystemWindow}

TLabelframe.Label

Layout: Label.fill -sticky nswe -children {Label.text -sticky nswe}

TMenubutton

Layout: Menubutton.dropdown -side right -sticky ns Menubutton.button -sticky nswe -children {Menubutton.padding -sticky we -children {Menubutton.label -sticky {}}}

TNotebook

Layout: Notebook.client -sticky nswe

TNotebook.Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Style map: -expand {selected {2 2 2 2}}

TProgressbar

-

TRadiobutton

Layout: Radiobutton.padding -sticky nswe -children {Radiobutton.indicator -side left -sticky {} Radiobutton.focus -side left -sticky {} -children {Radiobutton.label -sticky nswe}}

TScale

-

TScrollbar

-

TSpinbox

Layout: Spinbox.field -side top -sticky we -children {null -side right -sticky {} -children {Spinbox.uparrow -side top -sticky e Spinbox.downarrow -side bottom -sticky e} Spinbox.padding -sticky nswe -children {Spinbox.textarea -sticky nswe}}

Style map: -selectforeground {!focus SystemWindowText} -selectbackground {!focus SystemWindow}

Tab

Layout: Notebook.tab -sticky nswe -children {Notebook.padding -side top -sticky nswe -children {Notebook.focus -side top -sticky nswe -children {Notebook.label -side top -sticky {}}}}

Toolbutton

Layout: Toolbutton.border -sticky nswe -children {Toolbutton.focus -sticky nswe -children {Toolbutton.padding -sticky nswe -children {Toolbutton.label -sticky nswe}}}

Treeview

Layout: Treeview.field -sticky nswe -border 1 -children {Treeview.padding -sticky nswe -children {Treeview.treearea -sticky nswe}}

Style map: -foreground {disabled SystemGrayText selected SystemHighlightText} -background {disabled SystemButtonFace selected SystemHighlight}

Treeview.Separator

Layout: Treeitem.separator -sticky nswe

Vertical.TScale

Layout: Scale.focus -sticky nswe -children {Vertical.Scale.trough -sticky nswe -children {Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {}}}

Vertical.TScrollbar

Layout: Vertical.Scrollbar.trough -sticky ns -children {Vertical.Scrollbar.uparrow -side top -sticky {} Vertical.Scrollbar.downarrow -side bottom -sticky {} Vertical.Scrollbar.thumb -sticky nswe -unit 1 -children {Vertical.Scrollbar.grip -sticky {}}}PASS

Index

Constants

View Source
const (
	Arrow             = cursor("arrow")
	BasedArrowDown    = cursor("based_arrow_down")
	BasedArrowUp      = cursor("based_arrow_up")
	Boat              = cursor("boat")
	Bogosity          = cursor("bogosity")
	BottomLeftCorner  = cursor("bottom_left_corner")
	BottomRightCorner = cursor("bottom_right_corner")
	BottomSide        = cursor("bottom_side")
	BottomTee         = cursor("bottom_tee")
	BoxSpiral         = cursor("box_spiral")
	CenterPtr         = cursor("center_ptr")
	Circle            = cursor("circle")
	Clock             = cursor("clock")
	CoffeeMug         = cursor("coffee_mug")
	Cross             = cursor("cross")
	CrossReverse      = cursor("cross_reverse")
	Crosshair         = cursor("crosshair")
	CursorIcon        = cursor("icon")
	DiamondCross      = cursor("diamond_cross")
	Dot               = cursor("dot")
	Dotbox            = cursor("dotbox")
	DoubleArrow       = cursor("double_arrow")
	DraftLarge        = cursor("draft_large")
	DraftSmall        = cursor("draft_small")
	DrapedBox         = cursor("draped_box")
	Exchange          = cursor("exchange")
	Fleur             = cursor("fleur")
	Gobbler           = cursor("gobbler")
	Gumby             = cursor("gumby")
	Hand1             = cursor("hand1")
	Hand2             = cursor("hand2")
	Heart             = cursor("heart")
	IronCross         = cursor("iron_cross")
	LeftPtr           = cursor("left_ptr")
	LeftSide          = cursor("left_side")
	LeftTee           = cursor("left_tee")
	Leftbutton        = cursor("leftbutton")
	LlAngle           = cursor("ll_angle")
	LrAngle           = cursor("lr_angle")
	Man               = cursor("man")
	Middlebutton      = cursor("middlebutton")
	Mouse             = cursor("mouse")
	None              = cursor("none")
	Pencil            = cursor("pencil")
	Pirate            = cursor("pirate")
	Plus              = cursor("plus")
	QuestionArrow     = cursor("question_arrow")
	RightPtr          = cursor("right_ptr")
	RightSide         = cursor("right_side")
	RightTee          = cursor("right_tee")
	Rightbutton       = cursor("rightbutton")
	Sailboat          = cursor("sailboat")
	SbDownArrow       = cursor("sb_down_arrow")
	SbHDoubleArrow    = cursor("sb_h_double_arrow")
	SbLeftArrow       = cursor("sb_left_arrow")
	SbRightArrow      = cursor("sb_right_arrow")
	SbUpArrow         = cursor("sb_up_arrow")
	SbVDoubleArrow    = cursor("sb_v_double_arrow")
	Shuttle           = cursor("shuttle")
	Sizing            = cursor("sizing")
	Spider            = cursor("spider")
	Spraycan          = cursor("spraycan")
	Star              = cursor("star")
	Target            = cursor("target")
	Tcross            = cursor("tcross")
	TopLeftArrow      = cursor("top_left_arrow")
	TopLeftCorner     = cursor("top_left_corner")
	TopRightCorner    = cursor("top_right_corner")
	TopSide           = cursor("top_side")
	TopTee            = cursor("top_tee")
	Trek              = cursor("trek")
	UlAngle           = cursor("ul_angle")
	Umbrella          = cursor("umbrella")
	UrAngle           = cursor("ur_angle")
	Watch             = cursor("watch")
	XCursor           = cursor("X_cursor")
	Xterm             = cursor("xterm")
)

Named cursor constants recognized on all platforms.

Writing, for example, 'Arrow' as an option is the same as writing 'Cursor("arrow")', but the compiler will catch any typos in the cursor name.

View Source
const (
	CursorSize = cursor("size")
	No         = cursor("no")
	SizeNeSw   = cursor("size_ne_sw")
	SizeNs     = cursor("size_ns")
	SizeNwSe   = cursor("size_nw_se")
	SizeWe     = cursor("size_we")
	Starting   = cursor("starting")
	Uparrow    = cursor("uparrow")
)

Additional Windows cursors.

View Source
const (
	Aliasarrow            = cursor("aliasarrow")
	Bucket                = cursor("bucket")
	Cancel                = cursor("cancel")
	Closedhand            = cursor("closedhand")
	Contextualmenuarrow   = cursor("contextualmenuarrow")
	Copyarrow             = cursor("copyarrow")
	Countingdownhand      = cursor("countingdownhand")
	Countingupanddownhand = cursor("countingupanddownhand")
	Countinguphand        = cursor("countinguphand")
	CrossHair             = cursor("cross-hair")
	CursorText            = cursor("text")
	Eyedrop               = cursor("eyedrop")
	EyedropFull           = cursor("eyedrop-full")
	Fist                  = cursor("fist")
	Hand                  = cursor("hand")
	Help                  = cursor("help")
	Movearrow             = cursor("movearrow")
	Notallowed            = cursor("notallowed")
	Openhand              = cursor("openhand")
	Pointinghand          = cursor("pointinghand")
	Poof                  = cursor("poof")
	Resize                = cursor("resize")
	Resizebottomleft      = cursor("resizebottomleft")
	Resizebottomright     = cursor("resizebottomright")
	Resizedown            = cursor("resizedown")
	Resizeleft            = cursor("resizeleft")
	Resizeleftright       = cursor("resizeleftright")
	Resizeright           = cursor("resizeright")
	Resizetopleft         = cursor("resizetopleft")
	Resizetopright        = cursor("resizetopright")
	Resizeup              = cursor("resizeup")
	Resizeupdown          = cursor("resizeupdown")
	Spinning              = cursor("spinning")
	ZoomIn                = cursor("zoom-in")
	ZoomOut               = cursor("zoom-out")
)

Additional macOS cursors.

View Source
const (
	Agua                 = "agua"                 // R:0 G:255 B:255
	AliceBlue            = "AliceBlue"            // R:240 G:248 B:255
	AntiqueWhite         = "AntiqueWhite"         // R:250 G:235 B:215
	AntiqueWhite1        = "AntiqueWhite1"        // R:255 G:239 B:219
	AntiqueWhite2        = "AntiqueWhite2"        // R:238 G:223 B:204
	AntiqueWhite3        = "AntiqueWhite3"        // R:205 G:192 B:176
	AntiqueWhite4        = "AntiqueWhite4"        // R:139 G:131 B:120
	Aquamarine           = "aquamarine"           // R:127 G:255 B:212
	Aquamarine1          = "aquamarine1"          // R:127 G:255 B:212
	Aquamarine2          = "aquamarine2"          // R:118 G:238 B:198
	Aquamarine3          = "aquamarine3"          // R:102 G:205 B:170
	Aquamarine4          = "aquamarine4"          // R:69 G:139 B:116
	Azure                = "azure"                // R:240 G:255 B:255
	Azure1               = "azure1"               // R:240 G:255 B:255
	Azure2               = "azure2"               // R:224 G:238 B:238
	Azure3               = "azure3"               // R:193 G:205 B:205
	Azure4               = "azure4"               // R:131 G:139 B:139
	Beige                = "beige"                // R:245 G:245 B:220
	Bisque               = "bisque"               // R:255 G:228 B:196
	Bisque1              = "bisque1"              // R:255 G:228 B:196
	Bisque2              = "bisque2"              // R:238 G:213 B:183
	Bisque3              = "bisque3"              // R:205 G:183 B:158
	Bisque4              = "bisque4"              // R:139 G:125 B:107
	Black                = "black"                // R:0 G:0 B:0
	BlanchedAlmond       = "BlanchedAlmond"       // R:255 G:235 B:205
	Blue                 = "blue"                 // R:0 G:0 B:255
	Blue1                = "blue1"                // R:0 G:0 B:255
	Blue2                = "blue2"                // R:0 G:0 B:238
	Blue3                = "blue3"                // R:0 G:0 B:205
	Blue4                = "blue4"                // R:0 G:0 B:139
	BlueViolet           = "BlueViolet"           // R:138 G:43 B:226
	Brown                = "brown"                // R:165 G:42 B:42
	Brown1               = "brown1"               // R:255 G:64 B:64
	Brown2               = "brown2"               // R:238 G:59 B:59
	Brown3               = "brown3"               // R:205 G:51 B:51
	Brown4               = "brown4"               // R:139 G:35 B:35
	Burlywood            = "burlywood"            // R:222 G:184 B:135
	Burlywood1           = "burlywood1"           // R:255 G:211 B:155
	Burlywood2           = "burlywood2"           // R:238 G:197 B:145
	Burlywood3           = "burlywood3"           // R:205 G:170 B:125
	Burlywood4           = "burlywood4"           // R:139 G:115 B:85
	CadetBlue            = "CadetBlue"            // R:95 G:158 B:160
	CadetBlue1           = "CadetBlue1"           // R:152 G:245 B:255
	CadetBlue2           = "CadetBlue2"           // R:142 G:229 B:238
	CadetBlue3           = "CadetBlue3"           // R:122 G:197 B:205
	CadetBlue4           = "CadetBlue4"           // R:83 G:134 B:139
	Chartreuse           = "chartreuse"           // R:127 G:255 B:0
	Chartreuse1          = "chartreuse1"          // R:127 G:255 B:0
	Chartreuse2          = "chartreuse2"          // R:118 G:238 B:0
	Chartreuse3          = "chartreuse3"          // R:102 G:205 B:0
	Chartreuse4          = "chartreuse4"          // R:69 G:139 B:0
	Chocolate            = "chocolate"            // R:210 G:105 B:30
	Chocolate1           = "chocolate1"           // R:255 G:127 B:36
	Chocolate2           = "chocolate2"           // R:238 G:118 B:33
	Chocolate3           = "chocolate3"           // R:205 G:102 B:29
	Chocolate4           = "chocolate4"           // R:139 G:69 B:19
	Coral                = "coral"                // R:255 G:127 B:80
	Coral1               = "coral1"               // R:255 G:114 B:86
	Coral2               = "coral2"               // R:238 G:106 B:80
	Coral3               = "coral3"               // R:205 G:91 B:69
	Coral4               = "coral4"               // R:139 G:62 B:47
	CornflowerBlue       = "CornflowerBlue"       // R:100 G:149 B:237
	Cornsilk             = "cornsilk"             // R:255 G:248 B:220
	Cornsilk1            = "cornsilk1"            // R:255 G:248 B:220
	Cornsilk2            = "cornsilk2"            // R:238 G:232 B:205
	Cornsilk3            = "cornsilk3"            // R:205 G:200 B:177
	Cornsilk4            = "cornsilk4"            // R:139 G:136 B:120
	Crymson              = "crymson"              // R:220 G:20 B:60
	Cyan                 = "cyan"                 // R:0 G:255 B:255
	Cyan1                = "cyan1"                // R:0 G:255 B:255
	Cyan2                = "cyan2"                // R:0 G:238 B:238
	Cyan3                = "cyan3"                // R:0 G:205 B:205
	Cyan4                = "cyan4"                // R:0 G:139 B:139
	DarkBlue             = "DarkBlue"             // R:0 G:0 B:139
	DarkCyan             = "DarkCyan"             // R:0 G:139 B:139
	DarkGoldenrod        = "DarkGoldenrod"        // R:184 G:134 B:11
	DarkGoldenrod1       = "DarkGoldenrod1"       // R:255 G:185 B:15
	DarkGoldenrod2       = "DarkGoldenrod2"       // R:238 G:173 B:14
	DarkGoldenrod3       = "DarkGoldenrod3"       // R:205 G:149 B:12
	DarkGoldenrod4       = "DarkGoldenrod4"       // R:139 G:101 B:8
	DarkGray             = "DarkGray"             // R:169 G:169 B:169
	DarkGreen            = "DarkGreen"            // R:0 G:100 B:0
	DarkGrey             = "DarkGrey"             // R:169 G:169 B:169
	DarkKhaki            = "DarkKhaki"            // R:189 G:183 B:107
	DarkMagenta          = "DarkMagenta"          // R:139 G:0 B:139
	DarkOliveGreen       = "DarkOliveGreen"       // R:85 G:107 B:47
	DarkOliveGreen1      = "DarkOliveGreen1"      // R:202 G:255 B:112
	DarkOliveGreen2      = "DarkOliveGreen2"      // R:188 G:238 B:104
	DarkOliveGreen3      = "DarkOliveGreen3"      // R:162 G:205 B:90
	DarkOliveGreen4      = "DarkOliveGreen4"      // R:110 G:139 B:61
	DarkOrange           = "DarkOrange"           // R:255 G:140 B:0
	DarkOrange1          = "DarkOrange1"          // R:255 G:127 B:0
	DarkOrange2          = "DarkOrange2"          // R:238 G:118 B:0
	DarkOrange3          = "DarkOrange3"          // R:205 G:102 B:0
	DarkOrange4          = "DarkOrange4"          // R:139 G:69 B:0
	DarkOrchid           = "DarkOrchid"           // R:153 G:50 B:204
	DarkOrchid1          = "DarkOrchid1"          // R:191 G:62 B:255
	DarkOrchid2          = "DarkOrchid2"          // R:178 G:58 B:238
	DarkOrchid3          = "DarkOrchid3"          // R:154 G:50 B:205
	DarkOrchid4          = "DarkOrchid4"          // R:104 G:34 B:139
	DarkRed              = "DarkRed"              // R:139 G:0 B:0
	DarkSalmon           = "DarkSalmon"           // R:233 G:150 B:122
	DarkSeaGreen         = "DarkSeaGreen"         // R:143 G:188 B:143
	DarkSeaGreen1        = "DarkSeaGreen1"        // R:193 G:255 B:193
	DarkSeaGreen2        = "DarkSeaGreen2"        // R:180 G:238 B:180
	DarkSeaGreen3        = "DarkSeaGreen3"        // R:155 G:205 B:155
	DarkSeaGreen4        = "DarkSeaGreen4"        // R:105 G:139 B:105
	DarkSlateBlue        = "DarkSlateBlue"        // R:72 G:61 B:139
	DarkSlateGray        = "DarkSlateGray"        // R:47 G:79 B:79
	DarkSlateGray1       = "DarkSlateGray1"       // R:151 G:255 B:255
	DarkSlateGray2       = "DarkSlateGray2"       // R:141 G:238 B:238
	DarkSlateGray3       = "DarkSlateGray3"       // R:121 G:205 B:205
	DarkSlateGray4       = "DarkSlateGray4"       // R:82 G:139 B:139
	DarkSlateGrey        = "DarkSlateGrey"        // R:47 G:79 B:79
	DarkTurquoise        = "DarkTurquoise"        // R:0 G:206 B:209
	DarkViolet           = "DarkViolet"           // R:148 G:0 B:211
	DeepPink             = "DeepPink"             // R:255 G:20 B:147
	DeepPink1            = "DeepPink1"            // R:255 G:20 B:147
	DeepPink2            = "DeepPink2"            // R:238 G:18 B:137
	DeepPink3            = "DeepPink3"            // R:205 G:16 B:118
	DeepPink4            = "DeepPink4"            // R:139 G:10 B:80
	DeepSkyBlue          = "DeepSkyBlue"          // R:0 G:191 B:255
	DeepSkyBlue1         = "DeepSkyBlue1"         // R:0 G:191 B:255
	DeepSkyBlue2         = "DeepSkyBlue2"         // R:0 G:178 B:238
	DeepSkyBlue3         = "DeepSkyBlue3"         // R:0 G:154 B:205
	DeepSkyBlue4         = "DeepSkyBlue4"         // R:0 G:104 B:139
	DimGray              = "DimGray"              // R:105 G:105 B:105
	DimGrey              = "DimGrey"              // R:105 G:105 B:105
	DodgerBlue           = "DodgerBlue"           // R:30 G:144 B:255
	DodgerBlue1          = "DodgerBlue1"          // R:30 G:144 B:255
	DodgerBlue2          = "DodgerBlue2"          // R:28 G:134 B:238
	DodgerBlue3          = "DodgerBlue3"          // R:24 G:116 B:205
	DodgerBlue4          = "DodgerBlue4"          // R:16 G:78 B:139
	Firebrick            = "firebrick"            // R:178 G:34 B:34
	Firebrick1           = "firebrick1"           // R:255 G:48 B:48
	Firebrick2           = "firebrick2"           // R:238 G:44 B:44
	Firebrick3           = "firebrick3"           // R:205 G:38 B:38
	Firebrick4           = "firebrick4"           // R:139 G:26 B:26
	FloralWhite          = "FloralWhite"          // R:255 G:250 B:240
	ForestGreen          = "ForestGreen"          // R:34 G:139 B:34
	Fuchsia              = "fuchsia"              // R:255 G:0 B:255
	Gainsboro            = "gainsboro"            // R:220 G:220 B:220
	GhostWhite           = "GhostWhite"           // R:248 G:248 B:255
	Gold                 = "gold"                 // R:255 G:215 B:0
	Gold1                = "gold1"                // R:255 G:215 B:0
	Gold2                = "gold2"                // R:238 G:201 B:0
	Gold3                = "gold3"                // R:205 G:173 B:0
	Gold4                = "gold4"                // R:139 G:117 B:0
	Goldenrod            = "goldenrod"            // R:218 G:165 B:32
	Goldenrod1           = "goldenrod1"           // R:255 G:193 B:37
	Goldenrod2           = "goldenrod2"           // R:238 G:180 B:34
	Goldenrod3           = "goldenrod3"           // R:205 G:155 B:29
	Goldenrod4           = "goldenrod4"           // R:139 G:105 B:20
	Gray                 = "gray"                 // R:128 G:128 B:128
	Gray0                = "gray0"                // R:0 G:0 B:0
	Gray1                = "gray1"                // R:3 G:3 B:3
	Gray10               = "gray10"               // R:26 G:26 B:26
	Gray100              = "gray100"              // R:255 G:255 B:255
	Gray11               = "gray11"               // R:28 G:28 B:28
	Gray12               = "gray12"               // R:31 G:31 B:31
	Gray13               = "gray13"               // R:33 G:33 B:33
	Gray14               = "gray14"               // R:36 G:36 B:36
	Gray15               = "gray15"               // R:38 G:38 B:38
	Gray16               = "gray16"               // R:41 G:41 B:41
	Gray17               = "gray17"               // R:43 G:43 B:43
	Gray18               = "gray18"               // R:46 G:46 B:46
	Gray19               = "gray19"               // R:48 G:48 B:48
	Gray2                = "gray2"                // R:5 G:5 B:5
	Gray20               = "gray20"               // R:51 G:51 B:51
	Gray21               = "gray21"               // R:54 G:54 B:54
	Gray22               = "gray22"               // R:56 G:56 B:56
	Gray23               = "gray23"               // R:59 G:59 B:59
	Gray24               = "gray24"               // R:61 G:61 B:61
	Gray25               = "gray25"               // R:64 G:64 B:64
	Gray26               = "gray26"               // R:66 G:66 B:66
	Gray27               = "gray27"               // R:69 G:69 B:69
	Gray28               = "gray28"               // R:71 G:71 B:71
	Gray29               = "gray29"               // R:74 G:74 B:74
	Gray3                = "gray3"                // R:8 G:8 B:8
	Gray30               = "gray30"               // R:77 G:77 B:77
	Gray31               = "gray31"               // R:79 G:79 B:79
	Gray32               = "gray32"               // R:82 G:82 B:82
	Gray33               = "gray33"               // R:84 G:84 B:84
	Gray34               = "gray34"               // R:87 G:87 B:87
	Gray35               = "gray35"               // R:89 G:89 B:89
	Gray36               = "gray36"               // R:92 G:92 B:92
	Gray37               = "gray37"               // R:94 G:94 B:94
	Gray38               = "gray38"               // R:97 G:97 B:97
	Gray39               = "gray39"               // R:99 G:99 B:99
	Gray4                = "gray4"                // R:10 G:10 B:10
	Gray40               = "gray40"               // R:102 G:102 B:102
	Gray41               = "gray41"               // R:105 G:105 B:105
	Gray42               = "gray42"               // R:107 G:107 B:107
	Gray43               = "gray43"               // R:110 G:110 B:110
	Gray44               = "gray44"               // R:112 G:112 B:112
	Gray45               = "gray45"               // R:115 G:115 B:115
	Gray46               = "gray46"               // R:117 G:117 B:117
	Gray47               = "gray47"               // R:120 G:120 B:120
	Gray48               = "gray48"               // R:122 G:122 B:122
	Gray49               = "gray49"               // R:125 G:125 B:125
	Gray5                = "gray5"                // R:13 G:13 B:13
	Gray50               = "gray50"               // R:127 G:127 B:127
	Gray51               = "gray51"               // R:130 G:130 B:130
	Gray52               = "gray52"               // R:133 G:133 B:133
	Gray53               = "gray53"               // R:135 G:135 B:135
	Gray54               = "gray54"               // R:138 G:138 B:138
	Gray55               = "gray55"               // R:140 G:140 B:140
	Gray56               = "gray56"               // R:143 G:143 B:143
	Gray57               = "gray57"               // R:145 G:145 B:145
	Gray58               = "gray58"               // R:148 G:148 B:148
	Gray59               = "gray59"               // R:150 G:150 B:150
	Gray6                = "gray6"                // R:15 G:15 B:15
	Gray60               = "gray60"               // R:153 G:153 B:153
	Gray61               = "gray61"               // R:156 G:156 B:156
	Gray62               = "gray62"               // R:158 G:158 B:158
	Gray63               = "gray63"               // R:161 G:161 B:161
	Gray64               = "gray64"               // R:163 G:163 B:163
	Gray65               = "gray65"               // R:166 G:166 B:166
	Gray66               = "gray66"               // R:168 G:168 B:168
	Gray67               = "gray67"               // R:171 G:171 B:171
	Gray68               = "gray68"               // R:173 G:173 B:173
	Gray69               = "gray69"               // R:176 G:176 B:176
	Gray7                = "gray7"                // R:18 G:18 B:18
	Gray70               = "gray70"               // R:179 G:179 B:179
	Gray71               = "gray71"               // R:181 G:181 B:181
	Gray72               = "gray72"               // R:184 G:184 B:184
	Gray73               = "gray73"               // R:186 G:186 B:186
	Gray74               = "gray74"               // R:189 G:189 B:189
	Gray75               = "gray75"               // R:191 G:191 B:191
	Gray76               = "gray76"               // R:194 G:194 B:194
	Gray77               = "gray77"               // R:196 G:196 B:196
	Gray78               = "gray78"               // R:199 G:199 B:199
	Gray79               = "gray79"               // R:201 G:201 B:201
	Gray8                = "gray8"                // R:20 G:20 B:20
	Gray80               = "gray80"               // R:204 G:204 B:204
	Gray81               = "gray81"               // R:207 G:207 B:207
	Gray82               = "gray82"               // R:209 G:209 B:209
	Gray83               = "gray83"               // R:212 G:212 B:212
	Gray84               = "gray84"               // R:214 G:214 B:214
	Gray85               = "gray85"               // R:217 G:217 B:217
	Gray86               = "gray86"               // R:219 G:219 B:219
	Gray87               = "gray87"               // R:222 G:222 B:222
	Gray88               = "gray88"               // R:224 G:224 B:224
	Gray89               = "gray89"               // R:227 G:227 B:227
	Gray9                = "gray9"                // R:23 G:23 B:23
	Gray90               = "gray90"               // R:229 G:229 B:229
	Gray91               = "gray91"               // R:232 G:232 B:232
	Gray92               = "gray92"               // R:235 G:235 B:235
	Gray93               = "gray93"               // R:237 G:237 B:237
	Gray94               = "gray94"               // R:240 G:240 B:240
	Gray95               = "gray95"               // R:242 G:242 B:242
	Gray96               = "gray96"               // R:245 G:245 B:245
	Gray97               = "gray97"               // R:247 G:247 B:247
	Gray98               = "gray98"               // R:250 G:250 B:250
	Gray99               = "gray99"               // R:252 G:252 B:252
	Green                = "green"                // R:0 G:128 B:0
	Green1               = "green1"               // R:0 G:255 B:0
	Green2               = "green2"               // R:0 G:238 B:0
	Green3               = "green3"               // R:0 G:205 B:0
	Green4               = "green4"               // R:0 G:139 B:0
	GreenYellow          = "GreenYellow"          // R:173 G:255 B:47
	Grey                 = "grey"                 // R:128 G:128 B:128
	Grey0                = "grey0"                // R:0 G:0 B:0
	Grey1                = "grey1"                // R:3 G:3 B:3
	Grey10               = "grey10"               // R:26 G:26 B:26
	Grey100              = "grey100"              // R:255 G:255 B:255
	Grey11               = "grey11"               // R:28 G:28 B:28
	Grey12               = "grey12"               // R:31 G:31 B:31
	Grey13               = "grey13"               // R:33 G:33 B:33
	Grey14               = "grey14"               // R:36 G:36 B:36
	Grey15               = "grey15"               // R:38 G:38 B:38
	Grey16               = "grey16"               // R:41 G:41 B:41
	Grey17               = "grey17"               // R:43 G:43 B:43
	Grey18               = "grey18"               // R:46 G:46 B:46
	Grey19               = "grey19"               // R:48 G:48 B:48
	Grey2                = "grey2"                // R:5 G:5 B:5
	Grey20               = "grey20"               // R:51 G:51 B:51
	Grey21               = "grey21"               // R:54 G:54 B:54
	Grey22               = "grey22"               // R:56 G:56 B:56
	Grey23               = "grey23"               // R:59 G:59 B:59
	Grey24               = "grey24"               // R:61 G:61 B:61
	Grey25               = "grey25"               // R:64 G:64 B:64
	Grey26               = "grey26"               // R:66 G:66 B:66
	Grey27               = "grey27"               // R:69 G:69 B:69
	Grey28               = "grey28"               // R:71 G:71 B:71
	Grey29               = "grey29"               // R:74 G:74 B:74
	Grey3                = "grey3"                // R:8 G:8 B:8
	Grey30               = "grey30"               // R:77 G:77 B:77
	Grey31               = "grey31"               // R:79 G:79 B:79
	Grey32               = "grey32"               // R:82 G:82 B:82
	Grey33               = "grey33"               // R:84 G:84 B:84
	Grey34               = "grey34"               // R:87 G:87 B:87
	Grey35               = "grey35"               // R:89 G:89 B:89
	Grey36               = "grey36"               // R:92 G:92 B:92
	Grey37               = "grey37"               // R:94 G:94 B:94
	Grey38               = "grey38"               // R:97 G:97 B:97
	Grey39               = "grey39"               // R:99 G:99 B:99
	Grey4                = "grey4"                // R:10 G:10 B:10
	Grey40               = "grey40"               // R:102 G:102 B:102
	Grey41               = "grey41"               // R:105 G:105 B:105
	Grey42               = "grey42"               // R:107 G:107 B:107
	Grey43               = "grey43"               // R:110 G:110 B:110
	Grey44               = "grey44"               // R:112 G:112 B:112
	Grey45               = "grey45"               // R:115 G:115 B:115
	Grey46               = "grey46"               // R:117 G:117 B:117
	Grey47               = "grey47"               // R:120 G:120 B:120
	Grey48               = "grey48"               // R:122 G:122 B:122
	Grey49               = "grey49"               // R:125 G:125 B:125
	Grey5                = "grey5"                // R:13 G:13 B:13
	Grey50               = "grey50"               // R:127 G:127 B:127
	Grey51               = "grey51"               // R:130 G:130 B:130
	Grey52               = "grey52"               // R:133 G:133 B:133
	Grey53               = "grey53"               // R:135 G:135 B:135
	Grey54               = "grey54"               // R:138 G:138 B:138
	Grey55               = "grey55"               // R:140 G:140 B:140
	Grey56               = "grey56"               // R:143 G:143 B:143
	Grey57               = "grey57"               // R:145 G:145 B:145
	Grey58               = "grey58"               // R:148 G:148 B:148
	Grey59               = "grey59"               // R:150 G:150 B:150
	Grey6                = "grey6"                // R:15 G:15 B:15
	Grey60               = "grey60"               // R:153 G:153 B:153
	Grey61               = "grey61"               // R:156 G:156 B:156
	Grey62               = "grey62"               // R:158 G:158 B:158
	Grey63               = "grey63"               // R:161 G:161 B:161
	Grey64               = "grey64"               // R:163 G:163 B:163
	Grey65               = "grey65"               // R:166 G:166 B:166
	Grey66               = "grey66"               // R:168 G:168 B:168
	Grey67               = "grey67"               // R:171 G:171 B:171
	Grey68               = "grey68"               // R:173 G:173 B:173
	Grey69               = "grey69"               // R:176 G:176 B:176
	Grey7                = "grey7"                // R:18 G:18 B:18
	Grey70               = "grey70"               // R:179 G:179 B:179
	Grey71               = "grey71"               // R:181 G:181 B:181
	Grey72               = "grey72"               // R:184 G:184 B:184
	Grey73               = "grey73"               // R:186 G:186 B:186
	Grey74               = "grey74"               // R:189 G:189 B:189
	Grey75               = "grey75"               // R:191 G:191 B:191
	Grey76               = "grey76"               // R:194 G:194 B:194
	Grey77               = "grey77"               // R:196 G:196 B:196
	Grey78               = "grey78"               // R:199 G:199 B:199
	Grey79               = "grey79"               // R:201 G:201 B:201
	Grey8                = "grey8"                // R:20 G:20 B:20
	Grey80               = "grey80"               // R:204 G:204 B:204
	Grey81               = "grey81"               // R:207 G:207 B:207
	Grey82               = "grey82"               // R:209 G:209 B:209
	Grey83               = "grey83"               // R:212 G:212 B:212
	Grey84               = "grey84"               // R:214 G:214 B:214
	Grey85               = "grey85"               // R:217 G:217 B:217
	Grey86               = "grey86"               // R:219 G:219 B:219
	Grey87               = "grey87"               // R:222 G:222 B:222
	Grey88               = "grey88"               // R:224 G:224 B:224
	Grey89               = "grey89"               // R:227 G:227 B:227
	Grey9                = "grey9"                // R:23 G:23 B:23
	Grey90               = "grey90"               // R:229 G:229 B:229
	Grey91               = "grey91"               // R:232 G:232 B:232
	Grey92               = "grey92"               // R:235 G:235 B:235
	Grey93               = "grey93"               // R:237 G:237 B:237
	Grey94               = "grey94"               // R:240 G:240 B:240
	Grey95               = "grey95"               // R:242 G:242 B:242
	Grey96               = "grey96"               // R:245 G:245 B:245
	Grey97               = "grey97"               // R:247 G:247 B:247
	Grey98               = "grey98"               // R:250 G:250 B:250
	Grey99               = "grey99"               // R:252 G:252 B:252
	Honeydew             = "honeydew"             // R:240 G:255 B:240
	Honeydew1            = "honeydew1"            // R:240 G:255 B:240
	Honeydew2            = "honeydew2"            // R:224 G:238 B:224
	Honeydew3            = "honeydew3"            // R:193 G:205 B:193
	Honeydew4            = "honeydew4"            // R:131 G:139 B:131
	HotPink              = "HotPink"              // R:255 G:105 B:180
	HotPink1             = "HotPink1"             // R:255 G:110 B:180
	HotPink2             = "HotPink2"             // R:238 G:106 B:167
	HotPink3             = "HotPink3"             // R:205 G:96 B:144
	HotPink4             = "HotPink4"             // R:139 G:58 B:98
	IndianRed            = "IndianRed"            // R:205 G:92 B:92
	IndianRed1           = "IndianRed1"           // R:255 G:106 B:106
	IndianRed2           = "IndianRed2"           // R:238 G:99 B:99
	IndianRed3           = "IndianRed3"           // R:205 G:85 B:85
	IndianRed4           = "IndianRed4"           // R:139 G:58 B:58
	Indigo               = "indigo"               // R:75 G:0 B:130
	Ivory                = "ivory"                // R:255 G:255 B:240
	Ivory1               = "ivory1"               // R:255 G:255 B:240
	Ivory2               = "ivory2"               // R:238 G:238 B:224
	Ivory3               = "ivory3"               // R:205 G:205 B:193
	Ivory4               = "ivory4"               // R:139 G:139 B:131
	Khaki                = "khaki"                // R:240 G:230 B:140
	Khaki1               = "khaki1"               // R:255 G:246 B:143
	Khaki2               = "khaki2"               // R:238 G:230 B:133
	Khaki3               = "khaki3"               // R:205 G:198 B:115
	Khaki4               = "khaki4"               // R:139 G:134 B:78
	Lavender             = "lavender"             // R:230 G:230 B:250
	LavenderBlush        = "LavenderBlush"        // R:255 G:240 B:245
	LavenderBlush1       = "LavenderBlush1"       // R:255 G:240 B:245
	LavenderBlush2       = "LavenderBlush2"       // R:238 G:224 B:229
	LavenderBlush3       = "LavenderBlush3"       // R:205 G:193 B:197
	LavenderBlush4       = "LavenderBlush4"       // R:139 G:131 B:134
	LawnGreen            = "LawnGreen"            // R:124 G:252 B:0
	LemonChiffon         = "LemonChiffon"         // R:255 G:250 B:205
	LemonChiffon1        = "LemonChiffon1"        // R:255 G:250 B:205
	LemonChiffon2        = "LemonChiffon2"        // R:238 G:233 B:191
	LemonChiffon3        = "LemonChiffon3"        // R:205 G:201 B:165
	LemonChiffon4        = "LemonChiffon4"        // R:139 G:137 B:112
	LightBlue            = "LightBlue"            // R:173 G:216 B:230
	LightBlue1           = "LightBlue1"           // R:191 G:239 B:255
	LightBlue2           = "LightBlue2"           // R:178 G:223 B:238
	LightBlue3           = "LightBlue3"           // R:154 G:192 B:205
	LightBlue4           = "LightBlue4"           // R:104 G:131 B:139
	LightCoral           = "LightCoral"           // R:240 G:128 B:128
	LightCyan            = "LightCyan"            // R:224 G:255 B:255
	LightCyan1           = "LightCyan1"           // R:224 G:255 B:255
	LightCyan2           = "LightCyan2"           // R:209 G:238 B:238
	LightCyan3           = "LightCyan3"           // R:180 G:205 B:205
	LightCyan4           = "LightCyan4"           // R:122 G:139 B:139
	LightGoldenrod       = "LightGoldenrod"       // R:238 G:221 B:130
	LightGoldenrod1      = "LightGoldenrod1"      // R:255 G:236 B:139
	LightGoldenrod2      = "LightGoldenrod2"      // R:238 G:220 B:130
	LightGoldenrod3      = "LightGoldenrod3"      // R:205 G:190 B:112
	LightGoldenrod4      = "LightGoldenrod4"      // R:139 G:129 B:76
	LightGoldenrodYellow = "LightGoldenrodYellow" // R:250 G:250 B:210
	LightGray            = "LightGray"            // R:211 G:211 B:211
	LightGreen           = "LightGreen"           // R:144 G:238 B:144
	LightGrey            = "LightGrey"            // R:211 G:211 B:211
	LightPink            = "LightPink"            // R:255 G:182 B:193
	LightPink1           = "LightPink1"           // R:255 G:174 B:185
	LightPink2           = "LightPink2"           // R:238 G:162 B:173
	LightPink3           = "LightPink3"           // R:205 G:140 B:149
	LightPink4           = "LightPink4"           // R:139 G:95 B:101
	LightSalmon          = "LightSalmon"          // R:255 G:160 B:122
	LightSalmon1         = "LightSalmon1"         // R:255 G:160 B:122
	LightSalmon2         = "LightSalmon2"         // R:238 G:149 B:114
	LightSalmon3         = "LightSalmon3"         // R:205 G:129 B:98
	LightSalmon4         = "LightSalmon4"         // R:139 G:87 B:66
	LightSeaGreen        = "LightSeaGreen"        // R:32 G:178 B:170
	LightSkyBlue         = "LightSkyBlue"         // R:135 G:206 B:250
	LightSkyBlue1        = "LightSkyBlue1"        // R:176 G:226 B:255
	LightSkyBlue2        = "LightSkyBlue2"        // R:164 G:211 B:238
	LightSkyBlue3        = "LightSkyBlue3"        // R:141 G:182 B:205
	LightSkyBlue4        = "LightSkyBlue4"        // R:96 G:123 B:139
	LightSlateBlue       = "LightSlateBlue"       // R:132 G:112 B:255
	LightSlateGray       = "LightSlateGray"       // R:119 G:136 B:153
	LightSlateGrey       = "LightSlateGrey"       // R:119 G:136 B:153
	LightSteelBlue       = "LightSteelBlue"       // R:176 G:196 B:222
	LightSteelBlue1      = "LightSteelBlue1"      // R:202 G:225 B:255
	LightSteelBlue2      = "LightSteelBlue2"      // R:188 G:210 B:238
	LightSteelBlue3      = "LightSteelBlue3"      // R:162 G:181 B:205
	LightSteelBlue4      = "LightSteelBlue4"      // R:110 G:123 B:139
	LightYellow          = "LightYellow"          // R:255 G:255 B:224
	LightYellow1         = "LightYellow1"         // R:255 G:255 B:224
	LightYellow2         = "LightYellow2"         // R:238 G:238 B:209
	LightYellow3         = "LightYellow3"         // R:205 G:205 B:180
	LightYellow4         = "LightYellow4"         // R:139 G:139 B:122
	Lime                 = "lime"                 // R:0 G:255 B:0
	LimeGreen            = "LimeGreen"            // R:50 G:205 B:50
	Linen                = "linen"                // R:250 G:240 B:230
	Magenta              = "magenta"              // R:255 G:0 B:255
	Magenta1             = "magenta1"             // R:255 G:0 B:255
	Magenta2             = "magenta2"             // R:238 G:0 B:238
	Magenta3             = "magenta3"             // R:205 G:0 B:205
	Magenta4             = "magenta4"             // R:139 G:0 B:139
	Maroon               = "maroon"               // R:128 G:0 B:0
	Maroon1              = "maroon1"              // R:255 G:52 B:179
	Maroon2              = "maroon2"              // R:238 G:48 B:167
	Maroon3              = "maroon3"              // R:205 G:41 B:144
	Maroon4              = "maroon4"              // R:139 G:28 B:98
	MediumAquamarine     = "MediumAquamarine"     // R:102 G:205 B:170
	MediumBlue           = "MediumBlue"           // R:0 G:0 B:205
	MediumOrchid         = "MediumOrchid"         // R:186 G:85 B:211
	MediumOrchid1        = "MediumOrchid1"        // R:224 G:102 B:255
	MediumOrchid2        = "MediumOrchid2"        // R:209 G:95 B:238
	MediumOrchid3        = "MediumOrchid3"        // R:180 G:82 B:205
	MediumOrchid4        = "MediumOrchid4"        // R:122 G:55 B:139
	MediumPurple         = "MediumPurple"         // R:147 G:112 B:219
	MediumPurple1        = "MediumPurple1"        // R:171 G:130 B:255
	MediumPurple2        = "MediumPurple2"        // R:159 G:121 B:238
	MediumPurple3        = "MediumPurple3"        // R:137 G:104 B:205
	MediumPurple4        = "MediumPurple4"        // R:93 G:71 B:139
	MediumSeaGreen       = "MediumSeaGreen"       // R:60 G:179 B:113
	MediumSlateBlue      = "MediumSlateBlue"      // R:123 G:104 B:238
	MediumSpringGreen    = "MediumSpringGreen"    // R:0 G:250 B:154
	MediumTurquoise      = "MediumTurquoise"      // R:72 G:209 B:204
	MediumVioletRed      = "MediumVioletRed"      // R:199 G:21 B:133
	MidnightBlue         = "MidnightBlue"         // R:25 G:25 B:112
	MintCream            = "MintCream"            // R:245 G:255 B:250
	MistyRose            = "MistyRose"            // R:255 G:228 B:225
	MistyRose1           = "MistyRose1"           // R:255 G:228 B:225
	MistyRose2           = "MistyRose2"           // R:238 G:213 B:210
	MistyRose3           = "MistyRose3"           // R:205 G:183 B:181
	MistyRose4           = "MistyRose4"           // R:139 G:125 B:123
	Moccasin             = "moccasin"             // R:255 G:228 B:181
	NavajoWhite          = "NavajoWhite"          // R:255 G:222 B:173
	NavajoWhite1         = "NavajoWhite1"         // R:255 G:222 B:173
	NavajoWhite2         = "NavajoWhite2"         // R:238 G:207 B:161
	NavajoWhite3         = "NavajoWhite3"         // R:205 G:179 B:139
	NavajoWhite4         = "NavajoWhite4"         // R:139 G:121 B:94
	Navy                 = "navy"                 // R:0 G:0 B:128
	NavyBlue             = "NavyBlue"             // R:0 G:0 B:128
	OldLace              = "OldLace"              // R:253 G:245 B:230
	Olive                = "olive"                // R:128 G:128 B:0
	OliveDrab            = "OliveDrab"            // R:107 G:142 B:35
	OliveDrab1           = "OliveDrab1"           // R:192 G:255 B:62
	OliveDrab2           = "OliveDrab2"           // R:179 G:238 B:58
	OliveDrab3           = "OliveDrab3"           // R:154 G:205 B:50
	OliveDrab4           = "OliveDrab4"           // R:105 G:139 B:34
	Orange               = "orange"               // R:255 G:165 B:0
	Orange1              = "orange1"              // R:255 G:165 B:0
	Orange2              = "orange2"              // R:238 G:154 B:0
	Orange3              = "orange3"              // R:205 G:133 B:0
	Orange4              = "orange4"              // R:139 G:90 B:0
	OrangeRed            = "OrangeRed"            // R:255 G:69 B:0
	OrangeRed1           = "OrangeRed1"           // R:255 G:69 B:0
	OrangeRed2           = "OrangeRed2"           // R:238 G:64 B:0
	OrangeRed3           = "OrangeRed3"           // R:205 G:55 B:0
	OrangeRed4           = "OrangeRed4"           // R:139 G:37 B:0
	Orchid               = "orchid"               // R:218 G:112 B:214
	Orchid1              = "orchid1"              // R:255 G:131 B:250
	Orchid2              = "orchid2"              // R:238 G:122 B:233
	Orchid3              = "orchid3"              // R:205 G:105 B:201
	Orchid4              = "orchid4"              // R:139 G:71 B:137
	PaleGoldenrod        = "PaleGoldenrod"        // R:238 G:232 B:170
	PaleGreen            = "PaleGreen"            // R:152 G:251 B:152
	PaleGreen1           = "PaleGreen1"           // R:154 G:255 B:154
	PaleGreen2           = "PaleGreen2"           // R:144 G:238 B:144
	PaleGreen3           = "PaleGreen3"           // R:124 G:205 B:124
	PaleGreen4           = "PaleGreen4"           // R:84 G:139 B:84
	PaleTurquoise        = "PaleTurquoise"        // R:175 G:238 B:238
	PaleTurquoise1       = "PaleTurquoise1"       // R:187 G:255 B:255
	PaleTurquoise2       = "PaleTurquoise2"       // R:174 G:238 B:238
	PaleTurquoise3       = "PaleTurquoise3"       // R:150 G:205 B:205
	PaleTurquoise4       = "PaleTurquoise4"       // R:102 G:139 B:139
	PaleVioletRed        = "PaleVioletRed"        // R:219 G:112 B:147
	PaleVioletRed1       = "PaleVioletRed1"       // R:255 G:130 B:171
	PaleVioletRed2       = "PaleVioletRed2"       // R:238 G:121 B:159
	PaleVioletRed3       = "PaleVioletRed3"       // R:205 G:104 B:127
	PaleVioletRed4       = "PaleVioletRed4"       // R:139 G:71 B:93
	PapayaWhip           = "PapayaWhip"           // R:255 G:239 B:213
	PeachPuff            = "PeachPuff"            // R:255 G:218 B:185
	PeachPuff1           = "PeachPuff1"           // R:255 G:218 B:185
	PeachPuff2           = "PeachPuff2"           // R:238 G:203 B:173
	PeachPuff3           = "PeachPuff3"           // R:205 G:175 B:149
	PeachPuff4           = "PeachPuff4"           // R:139 G:119 B:101
	Peru                 = "peru"                 // R:205 G:133 B:63
	Pink                 = "pink"                 // R:255 G:192 B:203
	Pink1                = "pink1"                // R:255 G:181 B:197
	Pink2                = "pink2"                // R:238 G:169 B:184
	Pink3                = "pink3"                // R:205 G:145 B:158
	Pink4                = "pink4"                // R:139 G:99 B:108
	Plum                 = "plum"                 // R:221 G:160 B:221
	Plum1                = "plum1"                // R:255 G:187 B:255
	Plum2                = "plum2"                // R:238 G:174 B:238
	Plum3                = "plum3"                // R:205 G:150 B:205
	Plum4                = "plum4"                // R:139 G:102 B:139
	PowderBlue           = "PowderBlue"           // R:176 G:224 B:230
	Purple               = "purple"               // R:128 G:0 B:128
	Purple1              = "purple1"              // R:155 G:48 B:255
	Purple2              = "purple2"              // R:145 G:44 B:238
	Purple3              = "purple3"              // R:125 G:38 B:205
	Purple4              = "purple4"              // R:85 G:26 B:139
	Red                  = "red"                  // R:255 G:0 B:0
	Red1                 = "red1"                 // R:255 G:0 B:0
	Red2                 = "red2"                 // R:238 G:0 B:0
	Red3                 = "red3"                 // R:205 G:0 B:0
	Red4                 = "red4"                 // R:139 G:0 B:0
	RosyBrown            = "RosyBrown"            // R:188 G:143 B:143
	RosyBrown1           = "RosyBrown1"           // R:255 G:193 B:193
	RosyBrown2           = "RosyBrown2"           // R:238 G:180 B:180
	RosyBrown3           = "RosyBrown3"           // R:205 G:155 B:155
	RosyBrown4           = "RosyBrown4"           // R:139 G:105 B:105
	RoyalBlue            = "RoyalBlue"            // R:65 G:105 B:225
	RoyalBlue1           = "RoyalBlue1"           // R:72 G:118 B:255
	RoyalBlue2           = "RoyalBlue2"           // R:67 G:110 B:238
	RoyalBlue3           = "RoyalBlue3"           // R:58 G:95 B:205
	RoyalBlue4           = "RoyalBlue4"           // R:39 G:64 B:139
	SaddleBrown          = "SaddleBrown"          // R:139 G:69 B:19
	Salmon               = "salmon"               // R:250 G:128 B:114
	Salmon1              = "salmon1"              // R:255 G:140 B:105
	Salmon2              = "salmon2"              // R:238 G:130 B:98
	Salmon3              = "salmon3"              // R:205 G:112 B:84
	Salmon4              = "salmon4"              // R:139 G:76 B:57
	SandyBrown           = "SandyBrown"           // R:244 G:164 B:96
	SeaGreen             = "SeaGreen"             // R:46 G:139 B:87
	SeaGreen1            = "SeaGreen1"            // R:84 G:255 B:159
	SeaGreen2            = "SeaGreen2"            // R:78 G:238 B:148
	SeaGreen3            = "SeaGreen3"            // R:67 G:205 B:128
	SeaGreen4            = "SeaGreen4"            // R:46 G:139 B:87
	Seashell             = "seashell"             // R:255 G:245 B:238
	Seashell1            = "seashell1"            // R:255 G:245 B:238
	Seashell2            = "seashell2"            // R:238 G:229 B:222
	Seashell3            = "seashell3"            // R:205 G:197 B:191
	Seashell4            = "seashell4"            // R:139 G:134 B:130
	Sienna               = "sienna"               // R:160 G:82 B:45
	Sienna1              = "sienna1"              // R:255 G:130 B:71
	Sienna2              = "sienna2"              // R:238 G:121 B:66
	Sienna3              = "sienna3"              // R:205 G:104 B:57
	Sienna4              = "sienna4"              // R:139 G:71 B:38
	Silver               = "silver"               // R:192 G:192 B:192
	SkyBlue              = "SkyBlue"              // R:135 G:206 B:235
	SkyBlue1             = "SkyBlue1"             // R:135 G:206 B:255
	SkyBlue2             = "SkyBlue2"             // R:126 G:192 B:238
	SkyBlue3             = "SkyBlue3"             // R:108 G:166 B:205
	SkyBlue4             = "SkyBlue4"             // R:74 G:112 B:139
	SlateBlue            = "SlateBlue"            // R:106 G:90 B:205
	SlateBlue1           = "SlateBlue1"           // R:131 G:111 B:255
	SlateBlue2           = "SlateBlue2"           // R:122 G:103 B:238
	SlateBlue3           = "SlateBlue3"           // R:105 G:89 B:205
	SlateBlue4           = "SlateBlue4"           // R:71 G:60 B:139
	SlateGray            = "SlateGray"            // R:112 G:128 B:144
	SlateGray1           = "SlateGray1"           // R:198 G:226 B:255
	SlateGray2           = "SlateGray2"           // R:185 G:211 B:238
	SlateGray3           = "SlateGray3"           // R:159 G:182 B:205
	SlateGray4           = "SlateGray4"           // R:108 G:123 B:139
	SlateGrey            = "SlateGrey"            // R:112 G:128 B:144
	Snow                 = "snow"                 // R:255 G:250 B:250
	Snow1                = "snow1"                // R:255 G:250 B:250
	Snow2                = "snow2"                // R:238 G:233 B:233
	Snow3                = "snow3"                // R:205 G:201 B:201
	Snow4                = "snow4"                // R:139 G:137 B:137
	SpringGreen          = "SpringGreen"          // R:0 G:255 B:127
	SpringGreen1         = "SpringGreen1"         // R:0 G:255 B:127
	SpringGreen2         = "SpringGreen2"         // R:0 G:238 B:118
	SpringGreen3         = "SpringGreen3"         // R:0 G:205 B:102
	SpringGreen4         = "SpringGreen4"         // R:0 G:139 B:69
	SteelBlue            = "SteelBlue"            // R:70 G:130 B:180
	SteelBlue1           = "SteelBlue1"           // R:99 G:184 B:255
	SteelBlue2           = "SteelBlue2"           // R:92 G:172 B:238
	SteelBlue3           = "SteelBlue3"           // R:79 G:148 B:205
	SteelBlue4           = "SteelBlue4"           // R:54 G:100 B:139
	Tan                  = "tan"                  // R:210 G:180 B:140
	Tan1                 = "tan1"                 // R:255 G:165 B:79
	Tan2                 = "tan2"                 // R:238 G:154 B:73
	Tan3                 = "tan3"                 // R:205 G:133 B:63
	Tan4                 = "tan4"                 // R:139 G:90 B:43
	Teal                 = "teal"                 // R:0 G:128 B:128
	Thistle              = "thistle"              // R:216 G:191 B:216
	Thistle1             = "thistle1"             // R:255 G:225 B:255
	Thistle2             = "thistle2"             // R:238 G:210 B:238
	Thistle3             = "thistle3"             // R:205 G:181 B:205
	Thistle4             = "thistle4"             // R:139 G:123 B:139
	Tomato               = "tomato"               // R:255 G:99 B:71
	Tomato1              = "tomato1"              // R:255 G:99 B:71
	Tomato2              = "tomato2"              // R:238 G:92 B:66
	Tomato3              = "tomato3"              // R:205 G:79 B:57
	Tomato4              = "tomato4"              // R:139 G:54 B:38
	Turquoise            = "turquoise"            // R:64 G:224 B:208
	Turquoise1           = "turquoise1"           // R:0 G:245 B:255
	Turquoise2           = "turquoise2"           // R:0 G:229 B:238
	Turquoise3           = "turquoise3"           // R:0 G:197 B:205
	Turquoise4           = "turquoise4"           // R:0 G:134 B:139
	Violet               = "violet"               // R:238 G:130 B:238
	VioletRed            = "VioletRed"            // R:208 G:32 B:144
	VioletRed1           = "VioletRed1"           // R:255 G:62 B:150
	VioletRed2           = "VioletRed2"           // R:238 G:58 B:140
	VioletRed3           = "VioletRed3"           // R:205 G:50 B:120
	VioletRed4           = "VioletRed4"           // R:139 G:34 B:82
	Wheat                = "wheat"                // R:245 G:222 B:179
	Wheat1               = "wheat1"               // R:255 G:231 B:186
	Wheat2               = "wheat2"               // R:238 G:216 B:174
	Wheat3               = "wheat3"               // R:205 G:186 B:150
	Wheat4               = "wheat4"               // R:139 G:126 B:102
	White                = "white"                // R:255 G:255 B:255
	WhiteSmoke           = "WhiteSmoke"           // R:245 G:245 B:245
	Yellow               = "yellow"               // R:255 G:255 B:0
	Yellow1              = "yellow1"              // R:255 G:255 B:0
	Yellow2              = "yellow2"              // R:238 G:238 B:0
	Yellow3              = "yellow3"              // R:205 G:205 B:0
	Yellow4              = "yellow4"              // R:139 G:139 B:0
	YellowGreen          = "YellowGreen"          // R:154 G:205 B:50
)

Named colors. Writing, for example, 'Background(Agua)' is the same as writing 'Background("agua")' but the compiler can catch any typos in the color name.

View Source
const (
	SystemActiveAreaFill                   = "systemActiveAreaFill"
	SystemAlertBackgroundActive            = "systemAlertBackgroundActive"
	SystemAlertBackgroundInactive          = "systemAlertBackgroundInactive"
	SystemAlternatePrimaryHighlightColor   = "systemAlternatePrimaryHighlightColor"
	SystemAppleGuideCoachmark              = "systemAppleGuideCoachmark"
	SystemBevelActiveDark                  = "systemBevelActiveDark"
	SystemBevelActiveLight                 = "systemBevelActiveLight"
	SystemBevelInactiveDark                = "systemBevelInactiveDark"
	SystemBevelInactiveLight               = "systemBevelInactiveLight"
	SystemBlack                            = "systemBlack"
	SystemButtonActiveDarkHighlight        = "systemButtonActiveDarkHighlight"
	SystemButtonActiveDarkShadow           = "systemButtonActiveDarkShadow"
	SystemButtonActiveLightHighlight       = "systemButtonActiveLightHighlight"
	SystemButtonActiveLightShadow          = "systemButtonActiveLightShadow"
	SystemButtonFaceActive                 = "systemButtonFaceActive"
	SystemButtonFaceInactive               = "systemButtonFaceInactive"
	SystemButtonFacePressed                = "systemButtonFacePressed"
	SystemButtonFrame                      = "systemButtonFrame"
	SystemButtonFrameActive                = "systemButtonFrameActive"
	SystemButtonFrameInactive              = "systemButtonFrameInactive"
	SystemButtonInactiveDarkHighlight      = "systemButtonInactiveDarkHighlight"
	SystemButtonInactiveDarkShadow         = "systemButtonInactiveDarkShadow"
	SystemButtonInactiveLightHighlight     = "systemButtonInactiveLightHighlight"
	SystemButtonInactiveLightShadow        = "systemButtonInactiveLightShadow"
	SystemButtonPressedDarkHighlight       = "systemButtonPressedDarkHighlight"
	SystemButtonPressedDarkShadow          = "systemButtonPressedDarkShadow"
	SystemButtonPressedLightHighlight      = "systemButtonPressedLightHighlight"
	SystemButtonPressedLightShadow         = "systemButtonPressedLightShadow"
	SystemChasingArrows                    = "systemChasingArrows"
	SystemControlAccentColor               = "systemControlAccentColor"
	SystemControlTextColor                 = "systemControlTextColor"
	SystemDialogBackgroundActive           = "systemDialogBackgroundActive"
	SystemDialogBackgroundInactive         = "systemDialogBackgroundInactive"
	SystemDisabledControlTextColor         = "systemDisabledControlTextColor"
	SystemDocumentWindowBackground         = "systemDocumentWindowBackground"
	SystemDragHilite                       = "systemDragHilite"
	SystemDrawerBackground                 = "systemDrawerBackground"
	SystemFinderWindowBackground           = "systemFinderWindowBackground"
	SystemFocusHighlight                   = "systemFocusHighlight"
	SystemHighlightAlternate               = "systemHighlightAlternate"
	SystemHighlightSecondary               = "systemHighlightSecondary"
	SystemIconLabelBackground              = "systemIconLabelBackground"
	SystemIconLabelBackgroundSelected      = "systemIconLabelBackgroundSelected"
	SystemLabelColor                       = "systemLabelColor"
	SystemLinkColor                        = "systemLinkColor"
	SystemListViewBackground               = "systemListViewBackground"
	SystemListViewColumnDivider            = "systemListViewColumnDivider"
	SystemListViewEvenRowBackground        = "systemListViewEvenRowBackground"
	SystemListViewOddRowBackground         = "systemListViewOddRowBackground"
	SystemListViewSeparator                = "systemListViewSeparator"
	SystemListViewSortColumnBackground     = "systemListViewSortColumnBackground"
	SystemMenuActive                       = "systemMenuActive"
	SystemMenuBackground                   = "systemMenuBackground"
	SystemMenuBackgroundSelected           = "systemMenuBackgroundSelected"
	SystemModelessDialogBackgroundActive   = "systemModelessDialogBackgroundActive"
	SystemModelessDialogBackgroundInactive = "systemModelessDialogBackgroundInactive"
	SystemMovableModalBackground           = "systemMovableModalBackground"
	SystemNotificationWindowBackground     = "systemNotificationWindowBackground"
	SystemPlaceholderTextColor             = "systemPlaceholderTextColor"
	SystemPopupArrowActive                 = "systemPopupArrowActive"
	SystemPopupArrowInactive               = "systemPopupArrowInactive"
	SystemPopupArrowPressed                = "systemPopupArrowPressed"
	SystemPrimaryHighlightColor            = "systemPrimaryHighlightColor"
	SystemScrollBarDelimiterActive         = "systemScrollBarDelimiterActive"
	SystemScrollBarDelimiterInactive       = "systemScrollBarDelimiterInactive"
	SystemSecondaryHighlightColor          = "systemSecondaryHighlightColor"
	SystemSelectedTabTextColor             = "systemSelectedTabTextColor"
	SystemSelectedTextBackgroundColor      = "systemSelectedTextBackgroundColor"
	SystemSelectedTextColor                = "systemSelectedTextColor"
	SystemSeparatorColor                   = "systemSeparatorColor"
	SystemSheetBackground                  = "systemSheetBackground"
	SystemSheetBackgroundOpaque            = "systemSheetBackgroundOpaque"
	SystemSheetBackgroundTransparent       = "systemSheetBackgroundTransparent"
	SystemStaticAreaFill                   = "systemStaticAreaFill"
	SystemTextBackgroundColor              = "systemTextBackgroundColor"
	SystemTextColor                        = "systemTextColor"
	SystemToolbarBackground                = "systemToolbarBackground"
	SystemTransparent                      = "systemTransparent"
	SystemUtilityWindowBackgroundActive    = "systemUtilityWindowBackgroundActive"
	SystemUtilityWindowBackgroundInactive  = "systemUtilityWindowBackgroundInactive"
	SystemWhite                            = "systemWhite"
	SystemWindowBackgroundColor            = "systemWindowBackgroundColor"
	SystemWindowBackgroundColor1           = "systemWindowBackgroundColor1"
	SystemWindowBackgroundColor2           = "systemWindowBackgroundColor2"
	SystemWindowBackgroundColor3           = "systemWindowBackgroundColor3"
	SystemWindowBackgroundColor4           = "systemWindowBackgroundColor4"
	SystemWindowBackgroundColor5           = "systemWindowBackgroundColor5"
	SystemWindowBackgroundColor6           = "systemWindowBackgroundColor6"
	SystemWindowBackgroundColor7           = "systemWindowBackgroundColor7"
	SystemWindowBody                       = "systemWindowBody"
)

Additional system colors available on macOS.

View Source
const (
	System3dDarkShadow        = "system3dDarkShadow"
	System3dLight             = "system3dLight"
	SystemActiveBorder        = "systemActiveBorder"
	SystemActiveCaption       = "systemActiveCaption"
	SystemAppWorkspace        = "systemAppWorkspace"
	SystemBackground          = "systemBackground"
	SystemButtonHighlight     = "systemButtonHighlight"
	SystemButtonShadow        = "systemButtonShadow"
	SystemButtonText          = "systemButtonText"
	SystemCaptionText         = "systemCaptionText"
	SystemDisabledText        = "systemDisabledText"
	SystemGrayText            = "systemGrayText"
	SystemHighlightText       = "systemHighlightText"
	SystemInactiveBorder      = "systemInactiveBorder"
	SystemInactiveCaption     = "systemInactiveCaption"
	SystemInactiveCaptionText = "systemInactiveCaptionText"
	SystemInfoBackground      = "systemInfoBackground"
	SystemInfoText            = "systemInfoText"
	SystemMenuText            = "systemMenuText"
	SystemScrollbar           = "systemScrollbar"
	SystemWindow              = "systemWindow"
	SystemWindowFrame         = "systemWindowFrame"
	SystemWindowText          = "systemWindowText"
)

Additional system colors available on Windows. Note that the actual color values depend on the currently active OS theme.

View Source
const (
	SystemButtonFace = "systemButtonFace"
	SystemHighlight  = "systemHighlight"
	SystemMenu       = "systemMenu"
)

Additional system colors available both on macOS and Windows.

View Source
const (
	DefaultFont      = "TkDefaultFont"      // Default for items not otherwise specified.
	TextFont         = "TkTextFont"         // Used for entry widgets, listboxes, etc.
	FixedFont        = "TkFixedFont"        // A standard fixed-width font.
	MenuFont         = "TkMenuFont"         // The font used for menu items.
	HeadingFont      = "TkHeadingFont"      // Font for column headings in lists and tables.
	CaptionFont      = "TkCaptionFont"      // A font for window and dialog caption bars.
	SmallCaptionFont = "TkSmallCaptionFont" // A smaller caption font for tool dialogs.
	IconFont         = "TkIconFont"         // A font for icon captions.
	TooltipFont      = "TkTooltipFont"      // A font for tooltips.
)

Default generic font names

View Source
const (
	// Font attributes
	NORMAL     = "normal"
	BOLD       = "bold"
	ITALIC     = "italic"
	ROMAN      = "roman"
	UNDERLINE  = "underline"
	OVERSTRIKE = "overstrike"
	// Common font names (for Courier use the CourierFont() function)
	HELVETICA = "helvetica"
	TIMES     = "times"
	// Text justify attributes (also used in other contexts)
	CENTER = "center" // also used as an anchor
	LEFT   = "left"   // also used as a pack side option
	RIGHT  = "right"  // also used as a pack side option
	// Text wrapping
	NONE = "none" // Also used as a Treeview select mode
	CHAR = "char"
	WORD = "word"
	// Text end position
	END = "end"
	// MessageBox icon names
	INFO     = "info"
	QUESTION = "question"
	WARNING  = "warning"
	ERROR    = "error"
	// Anchor and sticky options (CENTER is also an anchor option)
	N    = "n"
	S    = "s"
	W    = "w"
	E    = "e"
	NEWS = "nswe"
	WE   = "we"
	NS   = "ns"
	// Pack fill options
	FILL_X    = "x"
	FILL_Y    = "y"
	FILL_BOTH = "both"
	// Pack side options (can also use LEFT and RIGHT)
	TOP    = "top"
	BOTTOM = "bottom"
	// Orientation (e.g., for TPanedWindow)
	VERTICAL   = "vertical"
	HORIZONTAL = "horizontal"
	// Select mode
	EXTENDED = "extended"
	BROWSE   = "browse"
	// Select type
	CELL = "cell"
	ITEM = "item"
	// Relief
	FLAT   = "flat"
	GROOVE = "groove"
	RAISED = "raised"
	RIDGE  = "ridge"
	SOLID  = "solid"
	SUNKEN = "sunken"
	// Window Manager protocols
	WM_TAKE_FOCUS    = "WM_TAKE_FOCUS"
	WM_DELETE_WINDOW = "WM_DELETE_WINDOW"
)

Common Tk-specific words.

Although Go's style guide recommends MixedCase, these are all in ALL_CAPS to avoid namespace collisions. For the pack fill options a prefix is used to avoid colliding with the X() and Y() option functions.

See https://gitlab.com/cznic/tk9.0/-/issues/25

View Source
const (
	// ThemeEnvVar, if non-blank and containing a valid built-in theme
	// name, is used to set the default application theme. Calling
	// StyleThemeUse() will override the default.
	ThemeEnvVar = "TK9_THEME"

	// ScaleEnvVar, if a valid (floating point) number, sets the TkScaling
	// value at package initialization to NativeScaling*TK9_SCALE.
	ScaleEnvVar = "TK9_SCALE"
)
View Source
const (
	// Errors will panic with a stack trace.
	PanicOnError = iota
	// Errors will be recorded into the Error variable using errors.Join
	CollectErrors
)

Error modes

View Source
const (
	Wait = cursor("wait")
)

Additional macOS and Windows cursors.

Variables

View Source
var (

	// Extensions register Tk extensions or extra packages. User code must
	// not directly mutate Extensions.
	Extensions = map[ExtensionKey]Extension{}

	AlreadyInitialized = errors.New("Already initialized")
	NotInitialized     = errors.New("Not initialized")
)
View Source
var (
	// Themes register Tk themes. User code must not directly mutate Themes.
	Themes = map[ThemeKey]Theme{}

	AlreadyActivated  = errors.New("Already activated")
	AlreadyRegistered = errors.New("Already registered")
	Finalized         = errors.New("Finalized")
	NotActivated      = errors.New("Not activated")
	NotFound          = errors.New("Not found")
)
View Source
var App = &Window{}

App is the main/root application window.

View Source
var Error error

Error records errors when CollectErrors is true.

View Source
var ErrorMode int

ErrorMode selects the action taken on errors.

View Source
var NativeScaling float64

NativeScaling is the value returned by TKScaling in package initialization before it is possibly changed using the ScaleEnvVar value.

Functions

func ActivateTheme added in v0.53.0

func ActivateTheme(name string) (err error)

ActivateTheme searches Themes to find first theme named like 'name' and call its Activate method. The search is case insensitive, using strings.ToLower, and white space is normalized. If there's no match, ActivateTheme returns NotFound.

Any package can register themes but only the main package can activate a theme.

func Bell added in v0.4.8

func Bell(options ...Opt)

Bell — Ring a display's bell

Description

This command rings the bell on the display for window and returns an empty string. If the -displayof option is omitted, the display of the application's main window is used by default. The command uses the current bell-related settings for the display, which may be modified with programs such as xset.

If -nice is not specified, this command also resets the screen saver for the screen. Some screen savers will ignore this, but others will reset so that the screen becomes visible again.

More information might be available at the Tcl/Tk bell page.

func Bind added in v0.4.10

func Bind(options ...any)

bind — Arrange for X events to invoke functions

Description

Bind tag options...

The bind command associates commands with X events. If all three arguments are specified, bind will arrange for script (a Tcl script called the “binding script”) to be evaluated whenever the event(s) given by sequence occur in the window(s) identified by tag. If script is prefixed with a “+”, then it is appended to any existing binding for sequence; otherwise script replaces any existing binding. If script is an empty string then the current binding for sequence is destroyed, leaving sequence unbound. In all of the cases where a script argument is provided, bind returns an empty string.

If sequence is specified without a script, then the script currently bound to sequence is returned, or an empty string is returned if there is no binding for sequence. If neither sequence nor script is specified, then the return value is a list whose elements are all the sequences for which there exist bindings for tag.

The tag argument determines which window(s) the binding applies to. If tag begins with a dot, as in .a.b.c, then it must be the path name for a window; otherwise it may be an arbitrary string. Each window has an associated list of tags, and a binding applies to a particular window if its tag is among those specified for the window. Although the Bindtags command may be used to assign an arbitrary set of binding tags to a window, the default binding tags provide the following behavior:

  • If a tag is the name of an internal window the binding applies to that window.
  • If the tag is the name of a class of widgets, such as Button, the binding applies to all widgets in that class.
  • If the tag is the name of a toplevel window the binding applies to the toplevel window and all its internal windows.
  • If tag has the value all, the binding applies to all windows in the application.

Example usage in _examples/events.go.

Additional information might be available at the Tcl/Tk bind page.

func Bindtags added in v0.58.0

func Bindtags(w *Window, tagList ...any) (r []string)

bindtags — Determine which bindings apply to a window, and order of evaluation

Description

When a binding is created with the bind command, it is associated either with a particular window such as .a.b.c, a class name such as Button, the keyword all, or any other string. All of these forms are called binding tags. Each window contains a list of binding tags that determine how events are processed for the window. When an event occurs in a window, it is applied to each of the window's tags in order: for each tag, the most specific binding that matches the given tag and event is executed. See the bind command for more information on the matching process.

By default, each window has four binding tags consisting of the name of the window, the window's class name, the name of the window's nearest toplevel ancestor, and all, in that order. Toplevel windows have only three tags by default, since the toplevel name is the same as that of the window. The bindtags command allows the binding tags for a window to be read and modified.

If bindtags is invoked with only one argument, then the current set of binding tags for window is returned as a list. If the tagList argument is specified to bindtags, then it must be a proper list; the tags for window are changed to the elements of the list. The elements of tagList may be arbitrary strings; however, any tag starting with a dot is treated as the name of a window; if no window by that name exists at the time an event is processed, then the tag is ignored for that event. The order of the elements in tagList determines the order in which binding scripts are executed in response to events. For example, the command

Bindtags(myBtn, "all", App, "Button", myBtn)

reverses the order in which binding scripts will be evaluated for a button myBtn so that all bindings are invoked first, following by bindings for buttons (App), followed by class bindings, followed by bindings for myBtn. If tagList is an empty list then the binding tags for window are returned to the default state described above.

The bindtags command may be used to introduce arbitrary additional binding tags for a window, or to remove standard tags. For example, the command

Bindtags(myBtn, myBtn, "TrickyButton", App, "all")

replaces the Button tag for myBtn with TrickyButton. This means that the default widget bindings for buttons, which are associated with the Button tag, will no longer apply to myBtn, but any bindings associated with TrickyButton (perhaps some new button behavior) will apply.

Additional information might be available at the Tcl/Tk bindtags page.

func ChooseColor added in v0.5.18

func ChooseColor(options ...Opt) string

ChooseColor — pops up a dialog box for the user to select a color.

Description

ChooseColor pops up a dialog box for the user to select a color. The following option-value pairs are possible as command line arguments:

Specifies the color to display in the color dialog when it pops up. color must be in a form acceptable to the Tk_GetColor function.

Makes window the logical parent of the color dialog. The color dialog is displayed on top of its parent window.

Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title will be displayed.

If the user selects a color, ChooseColor will return the name of the color in a form acceptable to Tk_GetColor. If the user cancels the operation, both commands will return the empty string.

More information might be available at the Tcl/Tk choosecolor page.

func ChooseDirectory added in v0.5.18

func ChooseDirectory(options ...Opt) string

ChooseDirectory — pops up a dialog box for the user to select a directory.

Description

The procedure tk_chooseDirectory pops up a dialog box for the user to select a directory. The following option-value pairs are possible as command line arguments:

Specifies that the directories in directory should be displayed when the dialog pops up. If this parameter is not specified, the initial directory defaults to the current working directory on non-Windows systems and on Windows systems prior to Vista. On Vista and later systems, the initial directory defaults to the last user-selected directory for the application. If the parameter specifies a relative path, the return value will convert the relative path to an absolute path.

Specifies a message to include in the client area of the dialog. This is only available on Mac OS X.

Specifies whether the user may specify non-existent directories. If this parameter is true, then the user may only select directories that already exist. The default value is false.

Makes window the logical parent of the dialog. The dialog is displayed on top of its parent window. On Mac OS X, this turns the file dialog into a sheet attached to the parent window.

Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title will be displayed.

More information might be available at the Tcl/Tk chooseDirectory page.

func ClipboardAppend added in v0.5.18

func ClipboardAppend(data string, options ...Opt)

ClipboardAppend — Manipulate Tk clipboard

Description

This command provides a Tcl interface to the Tk clipboard, which stores data for later retrieval using the selection mechanism (via the -selection CLIPBOARD option). In order to copy data into the clipboard, clipboard clear must be called, followed by a sequence of one or more calls to clipboard append. To ensure that the clipboard is updated atomically, all appends should be completed before returning to the event loop.

ClipboardAppend appends 'data' to the clipboard on window's display in the form given by type with the representation given by format and claims ownership of the clipboard on window's display.

The format argument specifies the representation that should be used to transmit the selection to the requester (the second column of Table 2 of the ICCCM), and defaults to STRING. If format is STRING, the selection is transmitted as 8-bit ASCII characters. If format is ATOM, then the data is divided into fields separated by white space; each field is converted to its atom value, and the 32-bit atom value is transmitted instead of the atom name. For any other format, data is divided into fields separated by white space and each field is converted to a 32-bit integer; an array of integers is transmitted to the selection requester. Note that strings passed to clipboard append are concatenated before conversion, so the caller must take care to ensure appropriate spacing across string boundaries. All items appended to the clipboard with the same type must have the same format.

The format argument is needed only for compatibility with clipboard requesters that do not use Tk. If the Tk toolkit is being used to retrieve the CLIPBOARD selection then the value is converted back to a string at the requesting end, so format is irrelevant.

Type specifies the form in which the selection is to be returned (the desired “target” for conversion, in ICCCM terminology), and should be an atom name such as STRING or FILE_NAME; see the Inter-Client Communication Conventions Manual for complete details. Type defaults to STRING.

More information might be available at the Tcl/Tk clipboard page.

func ClipboardClear added in v0.5.18

func ClipboardClear(options ...Opt)

ClipboardClear — Manipulate Tk clipboard

Description

Claims ownership of the clipboard on window's display and removes any previous contents. Window defaults to App. Returns an empty string.

More information might be available at the Tcl/Tk clipboard page.

func ClipboardGet added in v0.5.18

func ClipboardGet(options ...Opt) string

ClipboardGet — Manipulate Tk clipboard

Description

Retrieve data from the clipboard on window's display. Window defaults to App.

Type specifies the form in which the data is to be returned and should be an atom name such as STRING or FILE_NAME. Type defaults to STRING. This command is equivalent to [SelectionGet](Selection("CLIPBOARD").

Note that on modern X11 systems, the most useful type to retrieve for transferred strings is not STRING, but rather UTF8_STRING.

More information might be available at the Tcl/Tk clipboard page.

func CourierFont added in v0.19.1

func CourierFont() string

CourierFont returns "{courier new}" on Windows and "courier" elsewhere.

func CurrentThemeName added in v0.53.0

func CurrentThemeName() (r string)

CurrentThemeName returns the name of the currently activated theme, if any.

func Destroy added in v0.4.8

func Destroy(options ...Opt)

Destroy — Destroy one or more windows

Description

This command deletes the windows given by the window arguments, plus all of their descendants. If a window “.” (App) is deleted then all windows will be destroyed and the application will (normally) exit. The windows are destroyed in order, and if an error occurs in destroying a window the command aborts without destroying the remaining windows. No error is returned if window does not exist.

func Finalize added in v0.1.2

func Finalize() (err error)

Finalize releases all resources held, if any. This may include temporary files. Finalize is intended to be called on process shutdown only.

func Focus added in v0.4.10

func Focus(options ...Opt) string

Focus — Manage the input focus

Description

The focus command is used to manage the Tk input focus. At any given time, one window on each display is designated as the focus window; any key press or key release events for the display are sent to that window. It is normally up to the window manager to redirect the focus among the top-level windows of a display. For example, some window managers automatically set the input focus to a top-level window whenever the mouse enters it; others redirect the input focus only when the user clicks on a window. Usually the window manager will set the focus only to top-level windows, leaving it up to the application to redirect the focus among the children of the top-level.

Tk remembers one focus window for each top-level (the most recent descendant of that top-level to receive the focus); when the window manager gives the focus to a top-level, Tk automatically redirects it to the remembered window. Within a top-level Tk uses an explicit focus model by default. Moving the mouse within a top-level does not normally change the focus; the focus changes only when a widget decides explicitly to claim the focus (e.g., because of a button click), or when the user types a key such as Tab that moves the focus.

The Tcl procedure tk_focusFollowsMouse may be invoked to create an implicit focus model: it reconfigures Tk so that the focus is set to a window whenever the mouse enters it. The Tcl procedures tk_focusNext and tk_focusPrev implement a focus order among the windows of a top-level; they are used in the default bindings for Tab and Shift-Tab, among other things.

The focus command can take any of the following forms:

Focus()

Returns the path name of the focus window on the display containing the application's main window, or an empty string if no window in this application has the focus on that display. Note: it is better to specify the display explicitly using -displayof (see below) so that the code will work in applications using multiple displays.

Focus(window)

If the application currently has the input focus on window's display, this command resets the input focus for window's display to window and returns an empty string. If the application does not currently have the input focus on window's display, window will be remembered as the focus for its top-level; the next time the focus arrives at the top-level, Tk will redirect it to window. If window is an empty string then the command does nothing.

Focus(Displayof(window))

Returns the name of the focus window on the display containing window. If the focus window for window's display is not in this application, the return value is an empty string.

Focus(Force(window))

Sets the focus of window's display to window, even if the application does not currently have the input focus for the display. This command should be used sparingly, if at all. In normal usage, an application should not claim the focus for itself; instead, it should wait for the window manager to give it the focus. If window is an empty string then the command does nothing.

Focus(Lastfor(window))

Returns the name of the most recent window to have the input focus among all the windows in the same top-level as window. If no window in that top-level has ever had the input focus, or if the most recent focus window has been deleted, then the name of the top-level is returned. The return value is the window that will receive the input focus the next time the window manager gives the focus to the top-level.

Quirks

When an internal window receives the input focus, Tk does not actually set the X focus to that window; as far as X is concerned, the focus will stay on the top-level window containing the window with the focus. However, Tk generates FocusIn and FocusOut events just as if the X focus were on the internal window. This approach gets around a number of problems that would occur if the X focus were actually moved; the fact that the X focus is on the top-level is invisible unless you use C code to query the X server directly.

More information might be available at the Tcl/Tk focus page.

func FontConfigure added in v0.34.0

func FontConfigure(name string, options ...any) []string

font — Create and inspect fonts.

Description

Query or modify the desired attributes for the named font called fontname. If no option is specified, returns a list describing all the options and their values for fontname. If a single option is specified with no value, then returns the current value of that attribute. If one or more option-value pairs are specified, then the command modifies the given named font to have the given values; in this case, all widgets using that font will redisplay themselves using the new attributes for the font. See FONT OPTIONS below for a list of the possible attributes.

Note that on Aqua/macOS, the system fonts (see PLATFORM SPECIFIC FONTS below) may not be actually altered because they are implemented by the system theme. To achieve the effect of modification, use font actual to get their configuration and font create to synthesize a copy of the font which can be modified.

More information might be available at the Tcl/Tk font page.

func FontFamilies added in v0.5.18

func FontFamilies(options ...Opt) []string

FontFamilies — Create and inspect fonts.

Description

The return value is a list of the case-insensitive names of all font families that exist on window's display. If the Displayof argument is omitted, it defaults to the main window.

Additional information might be available at the Tcl/Tk font page.

func Fontchooser added in v0.5.18

func Fontchooser(options ...Opt)

Fontchooser — control font selection dialog

Description

The tk fontchooser command controls the Tk font selection dialog. It uses the native platform font selection dialog where available, or a dialog implemented in Tcl otherwise.

Unlike most of the other Tk dialog commands, tk fontchooser does not return an immediate result, as on some platforms (Mac OS X) the standard font dialog is modeless while on others (Windows) it is modal. To get the user-selected font use FontchooserFont() from a handler assigned via Command.

Set one or more of the configurations options below (analogous to Tk widget configuration).

Specifies/returns the logical parent window of the font selection dialog (similar to the -parent option to other dialogs). The font selection dialog is hidden if it is visible when the parent window is destroyed.

Specifies/returns the title of the dialog. Has no effect on platforms where the font selection dialog does not support titles.

Specifies/returns the font that is currently selected in the dialog if it is visible, or that will be initially selected when the dialog is shown (if supported by the platform). Can be set to the empty string to indicate that no font should be selected. Fonts can be specified in any form given by the "FONT DESCRIPTION" section in the font manual page.

Specifies the command called when a font selection has been made by the user. To obtain the font description, call FontchooserFont from the handler.

Additional information might be available at the Tcl/Tk fontchooser page.

func FontchooserFont added in v0.5.18

func FontchooserFont() []string

FontchooserFont — control font selection dialog

Description

Returns the selected font description in the form

family size style...

Additional information might be available at the Tcl/Tk fontchooser page.

func FontchooserHide added in v0.5.18

func FontchooserHide()

FontchooserHide — control font selection dialog

Description

Hide the font selection dialog if it is visible and cause any pending tk fontchooser show command to return.

Additional information might be available at the Tcl/Tk fontchooser page.

func FontchooserShow added in v0.5.18

func FontchooserShow()

FontchooserShow — control font selection dialog

Description

Show the font selection dialog. Depending on the platform, may return immediately or only once the dialog has been withdrawn.

Additional information might be available at the Tcl/Tk fontchooser page.

func GetOpenFile added in v0.5.18

func GetOpenFile(options ...Opt) (r []string)

GetOpenFile — pop up a dialog box for the user to select a file to open.

Description

GetOpenFile pops up a dialog box for the user to select a file to open. The function is usually associated with the Open command in the File menu. Its purpose is for the user to select an existing file only. If the user enters a non-existent file, the dialog box gives the user an error prompt and requires the user to give an alternative selection. If an application allows the user to create new files, it should do so by providing a separate New menu command.

Specifies a string that will be appended to the filename if the user enters a filename without an extension. The default value is the empty string, which means no extension will be appended to the filename in any case. This option is ignored on Mac OS X, which does not require extensions to filenames, and the UNIX implementation guesses reasonable values for this from the -filetypes option when this is not supplied.

If a File types listbox exists in the file dialog on the particular platform, this option gives the filetypes in this listbox. When the user choose a filetype in the listbox, only the files of that type are listed. If this option is unspecified, or if it is set to the empty list, or if the File types listbox is not supported by the particular platform then all files are listed regardless of their types. See the section SPECIFYING FILE PATTERNS below for a discussion on the contents of filePatternList.

Specifies that the files in directory should be displayed when the dialog pops up. If this parameter is not specified, the initial directory defaults to the current working directory on non-Windows systems and on Windows systems prior to Vista. On Vista and later systems, the initial directory defaults to the last user-selected directory for the application. If the parameter specifies a relative path, the return value will convert the relative path to an absolute path.

Specifies a filename to be displayed in the dialog when it pops up.

Allows the user to choose multiple files from the Open dialog.

Makes window the logical parent of the file dialog. The file dialog is displayed on top of its parent window. On Mac OS X, this turns the file dialog into a sheet attached to the parent window.

Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title is displayed.

Additional information might be available at the Tcl/Tk getopenfile page.

func GetSaveFile added in v0.5.18

func GetSaveFile(options ...Opt) string

GetSaveFile — pop up a dialog box for the user to select a file to save.

Description

GetSaveFile pops up a dialog box for the user to select a file to save.

The functio is usually associated with the Save as command in the File menu. If the user enters a file that already exists, the dialog box prompts the user for confirmation whether the existing file should be overwritten or not.

Configures how the Save dialog reacts when the selected file already exists, and saving would overwrite it. A true value requests a confirmation dialog be presented to the user. A false value requests that the overwrite take place without confirmation. Default value is true.

Specifies a string that will be appended to the filename if the user enters a filename without an extension. The default value is the empty string, which means no extension will be appended to the filename in any case. This option is ignored on Mac OS X, which does not require extensions to filenames, and the UNIX implementation guesses reasonable values for this from the -filetypes option when this is not supplied.

If a File types listbox exists in the file dialog on the particular platform, this option gives the filetypes in this listbox. When the user choose a filetype in the listbox, only the files of that type are listed. If this option is unspecified, or if it is set to the empty list, or if the File types listbox is not supported by the particular platform then all files are listed regardless of their types. See the section SPECIFYING FILE PATTERNS below for a discussion on the contents of filePatternList.

Specifies that the files in directory should be displayed when the dialog pops up. If this parameter is not specified, the initial directory defaults to the current working directory on non-Windows systems and on Windows systems prior to Vista. On Vista and later systems, the initial directory defaults to the last user-selected directory for the application. If the parameter specifies a relative path, the return value will convert the relative path to an absolute path.

Specifies a filename to be displayed in the dialog when it pops up.

Makes window the logical parent of the file dialog. The file dialog is displayed on top of its parent window. On Mac OS X, this turns the file dialog into a sheet attached to the parent window.

Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title is displayed.

Additional information might be available at the Tcl/Tk getopenfile page.

func Grab added in v0.56.1

func Grab(options ...Opt)

grab — Confine pointer and keyboard events to a window sub-tree

Description

Same as GrabSet().

More information might be available at the Tcl/Tk grab page.

func GrabCurrent added in v0.56.1

func GrabCurrent(options ...Opt) []string

grab — Confine pointer and keyboard events to a window sub-tree

Description

If window is specified, returns the name of the current grab window in this application for window's display, or an empty string if there is no such window. If window is omitted, the command returns a list whose elements are all of the windows grabbed by this application for all displays, or an empty string if the application has no grabs.

More information might be available at the Tcl/Tk grab page.

func GrabRelease added in v0.56.1

func GrabRelease(w Opt)

grab — Confine pointer and keyboard events to a window sub-tree

Description

Releases the grab on window if there is one, otherwise does nothing.

More information might be available at the Tcl/Tk grab page.

func GrabSet added in v0.56.1

func GrabSet(options ...Opt)

grab — Confine pointer and keyboard events to a window sub-tree

Description

Sets a grab on window. If -global is specified then the grab is global, otherwise it is local. If a grab was already in effect for this application on window's display then it is automatically released. If there is already a grab on window and it has the same global/local form as the requested grab, then the command does nothing.

More information might be available at the Tcl/Tk grab page.

func GrabStatus added in v0.56.1

func GrabStatus(w Opt) string

grab — Confine pointer and keyboard events to a window sub-tree

Description

Returns none if no grab is currently set on window, local if a local grab is set on window, and global if a global grab is set.

More information might be available at the Tcl/Tk grab page.

func Grid added in v0.5.18

func Grid(w Widget, options ...Opt)

Grid — Geometry manager that arranges widgets in a grid

Description

The arguments consist of the names of one or more content windows followed by pairs of arguments that specify how to manage the content. The characters -, x and ^, can be specified instead of a window name to alter the default location of a window, as described in the RELATIVE PLACEMENT section, below.

The following options are supported:

Insert the window so that it occupies the nth column in the grid. Column numbers start with 0. If this option is not supplied, then the window is arranged just to the right of previous window specified on this call to grid, or column “0” if it is the first window. For each x that immediately precedes the window, the column position is incremented by one. Thus the x represents a blank column for this row in the grid.

Insert the window so that it occupies n columns in the grid. The default is one column, unless the window name is followed by a -, in which case the columnspan is incremented once for each immediately following -.

  • In container

Insert the window(s) in the container window given by container. The default is the first window's parent window.

The amount specifies how much horizontal internal padding to leave on each side of the content. This is space is added inside the content border. The amount must be a valid screen distance, such as 2 or .5c. It defaults to 0.

The amount specifies how much vertical internal padding to leave on the top and bottom of the content. This space is added inside the content border. The amount defaults to 0.

The amount specifies how much horizontal external padding to leave on each side of the content, in screen units. Amount may be a list of two values to specify padding for left and right separately. The amount defaults to 0. This space is added outside the content border.

The amount specifies how much vertical external padding to leave on the top and bottom of the content, in screen units. Amount may be a list of two values to specify padding for top and bottom separately. The amount defaults to 0. This space is added outside the content border.

Insert the content so that it occupies the nth row in the grid. Row numbers start with 0. If this option is not supplied, then the content is arranged on the same row as the previous content specified on this call to grid, or the next row after the highest occupied row if this is the first content.

Insert the content so that it occupies n rows in the grid. The default is one row. If the next grid command contains ^ characters instead of content that line up with the columns of this content, then the rowspan of this content is extended by one.

If a content's cell is larger than its requested dimensions, this option may be used to position (or stretch) the content within its cell. Style is a string that contains zero or more of the characters n, s, e or w. The string can optionally contain spaces or commas, but they are ignored. Each letter refers to a side (north, south, east, or west) that the content will “stick” to. If both n and s (or e and w) are specified, the content will be stretched to fill the entire height (or width) of its cavity. The -sticky option subsumes the combination of -anchor and -fill that is used by pack. The default is “”, which causes the content to be centered in its cavity, at its requested size.

If any of the content is already managed by the geometry manager then any unspecified options for them retain their previous values rather than receiving default values.

More information might be available at the Tcl/Tk grid page.

func GridAnchor added in v0.33.0

func GridAnchor(w *Window, anchor string) string

Grid — Geometry manager that arranges widgets in a grid

Description

The anchor value controls how to place the grid within the container window when no row/column has any weight. See THE GRID ALGORITHM below for further details. The default anchor is nw.

More information might be available at the Tcl/Tk grid page.

func GridColumnConfigure added in v0.16.2

func GridColumnConfigure(w Widget, index int, options ...Opt)

Grid — Geometry manager that arranges widgets in a grid

Description

Query or set the column properties of the index column of the geometry container, window. The valid options are -minsize, -weight, -uniform and -pad. If one or more options are provided, then index may be given as a list of column indices to which the configuration options will operate on. Indices may be integers, window names or the keyword all. For all the options apply to all columns currently occupied be content windows. For a window name, that window must be a content of this container and the options apply to all columns currently occupied be the content. The -minsize option sets the minimum size, in screen units, that will be permitted for this column. The -weight option (an integer value) sets the relative weight for apportioning any extra spaces among columns. A weight of zero (0) indicates the column will not deviate from its requested size. A column whose weight is two will grow at twice the rate as a column of weight one when extra space is allocated to the layout. The -uniform option, when a non-empty value is supplied, places the column in a uniform group with other columns that have the same value for -uniform. The space for columns belonging to a uniform group is allocated so that their sizes are always in strict proportion to their -weight values. See THE GRID ALGORITHM below for further details. The -pad option specifies the number of screen units that will be added to the largest window contained completely in that column when the grid geometry manager requests a size from the containing window. If only an option is specified, with no value, the current value of that option is returned. If only the container window and index is specified, all the current settings are returned in a list of “-option value” pairs.

More information might be available at the Tcl/Tk grid page.

func GridForget added in v0.58.0

func GridForget(w ...*Window)

Grid — Geometry manager that arranges widgets in a grid

Description

Removes each of the windows from grid for its container and unmaps their windows. The content will no longer be managed by the grid geometry manager. The configuration options for that window are forgotten, so that if the window is managed once more by the grid geometry manager, the initial default settings are used.

If the last content window of the container becomes unmanaged, this will also send the virtual event <<NoManagedChild>> to the container; the container may choose to resize itself (or otherwise respond) to such a change.

More information might be available at the Tcl/Tk grid page.

func GridRemove added in v0.58.0

func GridRemove(w ...*Window)

Grid — Geometry manager that arranges widgets in a grid

Description

Removes each of the windows from grid for its container and unmaps their windows. The content will no longer be managed by the grid geometry manager. However, the configuration options for that window are remembered, so that if the content window is managed once more by the grid geometry manager, the previous values are retained.

If the last content window of the container becomes unmanaged, this will also send the virtual event <<NoManagedChild>> to the container; the container may choose to resize itself (or otherwise respond) to such a change.

More information might be available at the Tcl/Tk grid page.

func GridRowConfigure added in v0.16.2

func GridRowConfigure(w Widget, index int, options ...Opt)

Grid — Geometry manager that arranges widgets in a grid

Description

Query or set the row properties of the index row of the geometry container, window. The valid options are -minsize, -weight, -uniform and -pad. If one or more options are provided, then index may be given as a list of row indices to which the configuration options will operate on. Indices may be integers, window names or the keyword all. For all the options apply to all rows currently occupied by content windows. For a window name, that window must be a content window of this container and the options apply to all rows currently occupied by the container window. The -minsize option sets the minimum size, in screen units, that will be permitted for this row. The -weight option (an integer value) sets the relative weight for apportioning any extra spaces among rows. A weight of zero (0) indicates the row will not deviate from its requested size. A row whose weight is two will grow at twice the rate as a row of weight one when extra space is allocated to the layout. The -uniform option, when a non-empty value is supplied, places the row in a uniform group with other rows that have the same value for -uniform. The space for rows belonging to a uniform group is allocated so that their sizes are always in strict proportion to their -weight values. See THE GRID ALGORITHM below for further details. The -pad option specifies the number of screen units that will be added to the largest window contained completely in that row when the grid geometry manager requests a size from the containing window. If only an option is specified, with no value, the current value of that option is returned. If only the container window and index is specified, all the current settings are returned in a list of “-option value” pairs.

More information might be available at the Tcl/Tk grid page.

func Initialize added in v0.1.2

func Initialize()

Initalize enforces the parts of package initialization that are otherwise done lazily. The function may panic if ErrorMode is PanicOnError.

func InitializeExtension added in v0.58.0

func InitializeExtension(name string) (err error)

InitializeExtension searches Extensions to find first extension named 'name' and call its Initialize method. The search is case sensitive, white space is normalized. If there's no match, InitializeExtension returns NotFound.

Any package can register extensions but only the main package can initialize an extension.

func MessageBox added in v0.5.18

func MessageBox(options ...Opt) string

tk_messageBox — pops up a message window and waits for user response.

Description

This procedure creates and displays a message window with an application-specified message, an icon and a set of buttons. Each of the buttons in the message window is identified by a unique symbolic name (see the -type options). After the message window is popped up, tk_messageBox waits for the user to select one of the buttons. Then it returns the symbolic name of the selected button. The following optins are supported:

Specifies the handler to invoke when the user closes the dialog. The actual command consists of string followed by a space and the name of the button clicked by the user to close the dialog. This is only available on Mac OS X.

Name gives the symbolic name of the default button for this message window ( “ok”, “cancel”, and so on). See -type for a list of the symbolic names. If this option is not specified, the first button in the dialog will be made the default.

Specifies an auxiliary message to the main message given by the -message option. The message detail will be presented beneath the main message and, where supported by the OS, in a less emphasized font than the main message.

Specifies an icon to display. IconImage must be one of the following: error, info, question or warning. If this option is not specified, then the info icon will be displayed.

Specifies the message to display in this message box. The default value is an empty string.

Makes window the logical parent of the message box. The message box is displayed on top of its parent window.

Specifies a string to display as the title of the message box. The default value is an empty string.

  • Type predefinedType

Arranges for a predefined set of buttons to be displayed. The following values are possible for predefinedType:

  • abortretryignore - Displays three buttons whose symbolic names are abort, retry and ignore.
  • ok - Displays one button whose symbolic name is ok.
  • okcancel - Displays two buttons whose symbolic names are ok and cancel.
  • retrycancel - Displays two buttons whose symbolic names are retry and cancel.
  • yesno - Displays two buttons whose symbolic names are yes and no.
  • yesnocancel - Displays three buttons whose symbolic names are yes, no and cancel.

More information might be available at the Tcl/Tk messageBox page.

func Pack added in v0.4.10

func Pack(options ...Opt)

Pack — Geometry manager that packs around edges of cavity

Description

The options consist of one or more content windows followed by options that specify how to manage the content. See THE PACKER ALGORITHM for details on how the options are used by the packer.

The first argument must be a *Window.

The following options are supported:

Other must the name of another window. Use its container as the container for the content, and insert the content just after other in the packing order.

Anchor must be a valid anchor position such as n or sw; it specifies where to position each content in its parcel. Defaults to center.

Other must the name of another window. Use its container as the container for the content, and insert the content just before other in the packing order.

Specifies whether the content should be expanded to consume extra space in their container. Boolean may have any proper boolean value, such as 1 or no. Defaults to 0.

If a content's parcel is larger than its requested dimensions, this option may be used to stretch the content. Style must have one of the following values:

  • "none" - Give the content its requested dimensions plus any internal padding requested with -ipadx or -ipady. This is the default.
  • "x" - Stretch the content horizontally to fill the entire width of its parcel (except leave external padding as specified by -padx).
  • "y" - Stretch the content vertically to fill the entire height of its parcel (except leave external padding as specified by -pady).
  • "both": Stretch the content both horizontally and vertically.

.

  • In container

Insert the window at the end of the packing order for the container window given by container.

Amount specifies how much horizontal internal padding to leave on each side of the content. Amount must be a valid screen distance, such as 2 or .5c. It defaults to 0.

Amount specifies how much vertical internal padding to leave on each side of the content. Amount defaults to 0.

Amount specifies how much horizontal external padding to leave on each side of the content. Amount may be a list of two values to specify padding for left and right separately. Amount defaults to 0.

Amount specifies how much vertical external padding to leave on each side of the content. Amount may be a list of two values to specify padding for top and bottom separately. Amount defaults to 0.

Specifies which side of the container the content will be packed against. Must be "left", "right", "top", or "bottom". Defaults to top.

If no -in, -after or -before option is specified then each of the content will be inserted at the end of the packing list for its parent unless it is already managed by the packer (in which case it will be left where it is). If one of these options is specified then all the content will be inserted at the specified point. If any of the content are already managed by the geometry manager then any unspecified options for them retain their previous values rather than receiving default values.

Additional information might be available at the Tcl/Tk pack page.

func Place added in v0.4.10

func Place(options ...Opt)

Place — Geometry manager for fixed or rubber-sheet placement

Description

The placer is a geometry manager for Tk. It provides simple fixed placement of windows, where you specify the exact size and location of one window, called the content, within another window, called the container. The placer also provides rubber-sheet placement, where you specify the size and location of the content in terms of the dimensions of the container, so that the content changes size and location in response to changes in the size of the container. Lastly, the placer allows you to mix these styles of placement so that, for example, the content has a fixed width and height but is centered inside the container.

The first argument must be a *Window.

The following options are supported:

Where specifies which point of window is to be positioned at the (x,y) location selected by the -x, -y, -relx, and -rely options. The anchor point is in terms of the outer area of window including its border, if any. Thus if where is se then the lower-right corner of window's border will appear at the given (x,y) location in the container. The anchor position defaults to nw.

Mode determines the degree to which borders within the container are used in determining the placement of the content. The default and most common value is inside. In this case the placer considers the area of the container to be the innermost area of the container, inside any border: an option of -x 0 corresponds to an x-coordinate just inside the border and an option of -relwidth 1.0 means window will fill the area inside the container's border.

If mode is outside then the placer considers the area of the container to include its border; this mode is typically used when placing window outside its container, as with the options -x 0 -y 0 -anchor ne. Lastly, mode may be specified as ignore, in which case borders are ignored: the area of the container is considered to be its official X area, which includes any internal border but no external border. A bordermode of ignore is probably not very useful.

Size specifies the height for window in screen units (i.e. any of the forms accepted by Tk_GetPixels). The height will be the outer dimension of window including its border, if any. If size is an empty string, or if no -height or -relheight option is specified, then the height requested internally by the window will be used.

  • In container

Container specifies the path name of the window relative to which window is to be placed. Container must either be window's parent or a descendant of window's parent. In addition, container and window must both be descendants of the same top-level window. These restrictions are necessary to guarantee that window is visible whenever container is visible. If this option is not specified then the other window defaults to window's parent.

Size specifies the height for window. In this case the height is specified as a floating-point number relative to the height of the container: 0.5 means window will be half as high as the container, 1.0 means window will have the same height as the container, and so on. If both -height and -relheight are specified for a content, their values are summed. For example, -relheight 1.0 -height -2 makes the content 2 pixels shorter than the container.

Size specifies the width for window. In this case the width is specified as a floating-point number relative to the width of the container: 0.5 means window will be half as wide as the container, 1.0 means window will have the same width as the container, and so on. If both -width and -relwidth are specified for a content, their values are summed. For example, -relwidth 1.0 -width 5 makes the content 5 pixels wider than the container.

Location specifies the x-coordinate within the container window of the anchor point for window. In this case the location is specified in a relative fashion as a floating-point number: 0.0 corresponds to the left edge of the container and 1.0 corresponds to the right edge of the container. Location need not be in the range 0.0-1.0. If both -x and -relx are specified for a content then their values are summed. For example, -relx 0.5 -x -2 positions the left edge of the content 2 pixels to the left of the center of its container.

Location specifies the y-coordinate within the container window of the anchor point for window. In this case the value is specified in a relative fashion as a floating-point number: 0.0 corresponds to the top edge of the container and 1.0 corresponds to the bottom edge of the container. Location need not be in the range 0.0-1.0. If both -y and -rely are specified for a content then their values are summed. For example, -rely 0.5 -x 3 positions the top edge of the content 3 pixels below the center of its container.

Size specifies the width for window in screen units (i.e. any of the forms accepted by Tk_GetPixels). The width will be the outer width of window including its border, if any. If size is an empty string, or if no -width or -relwidth option is specified, then the width requested internally by the window will be used.

  • X location

Location specifies the x-coordinate within the container window of the anchor point for window. The location is specified in screen units (i.e. any of the forms accepted by Tk_GetPixels) and need not lie within the bounds of the container window.

  • Y location

Location specifies the y-coordinate within the container window of the anchor point for window. The location is specified in screen units (i.e. any of the forms accepted by Tk_GetPixels) and need not lie within the bounds of the container window.

If the same value is specified separately with two different options, such as -x and -relx, then the most recent option is used and the older one is ignored.

Additional information might be available at the Tcl/Tk place page.

func Popup(menu *Window, x, y int, entry any)

tk_popup — Post a popup menu

Description

This procedure posts a menu at a given position on the screen and configures Tk so that the menu and its cascaded children can be traversed with the mouse or the keyboard. Menu is the name of a menu widget and x and y are the root coordinates at which to display the menu. If entry is omitted or an empty string, the menu's upper left corner is positioned at the given point. Otherwise entry gives the index of an entry in menu and the menu will be positioned so that the entry is positioned over the given point.

Additional information might be available at the Tcl/Tk popup page.

func StyleConfigure added in v0.19.3

func StyleConfigure(style string, options ...any) []string

ttk::style — Manipulate style database

Description

Sets the default value of the specified option(s) in style. If style does not exist, it is created. Example:

StyleConfigure(".", Font("times"), Background(LightBlue))

If only style and -option are specified, get the default value for option -option of style style. Example:

StyleConfigure(".", Font)

If only style is specified, get the default value for all options of style style. Example:

StyleConfigure(".")

Additional information might be available at the Tcl/Tk style page. There's also a Styles and Themes tutorial at tkdoc.com.

func StyleElementCreate added in v0.19.5

func StyleElementCreate(elementName, typ string, options ...any) string

ttk::style — Manipulate style database

Description

Creates a new element in the current theme of type type. The only cross-platform built-in element type is image (see ttk_image(n)) but themes may define other element types (see Ttk_RegisterElementFactory). On suitable versions of Windows an element factory is registered to create Windows theme elements (see ttk_vsapi(n)). Examples:

StyleElementCreate("TSpinbox.uparrow", "from", "default") // Inherit the existing element from theme 'default'.

StyleElementCreate("Red.Corner.TButton.indicator", "image", NewPhoto(File("red_corner.png")), Width(10))

imageN := NewPhoto(...)
StyleElementCreate("TCheckbutton.indicator", "image", image5, "disabled selected", image6, "disabled alternate",
	image8, "disabled", image9, "alternate", image7, "!selected", image4, Width(20), Border(4), Sticky("w"))

After the type "image" comes a list of one or more images. Every image is optionally followed by a space separated list of states the image applies to. An exclamation mark before the state is a negation.

Additional information might be available at the Tcl/Tk modifying a button and Tcl/Tk style pages. There's also a Styles and Themes tutorial at tkdoc.com.

func StyleElementNames added in v0.19.5

func StyleElementNames() []string

ttk::style — Manipulate style database

Description

Returns the list of elements defined in the current theme.

Additional information might be available at the Tcl/Tk style page. There's also a Styles and Themes tutorial at tkdoc.com.

func StyleElementOptions added in v0.19.5

func StyleElementOptions(element string) []string

ttk::style — Manipulate style database

Description

Returns the list of element's options.

Additional information might be available at the Tcl/Tk style page. There's also a Styles and Themes tutorial at tkdoc.com.

func StyleLayout added in v0.19.5

func StyleLayout(style string, options ...any) string

ttk::style — Manipulate style database

Description

Define the widget layout for style style. See LAYOUTS below for the format of layoutSpec. If layoutSpec is omitted, return the layout specification for style style. Example:

StyleLayout("Red.Corner.Button",
	"Button.border", Sticky("nswe"), Border(1), Children(
		"Button.focus", Sticky("nswe"), Children(
			"Button.padding", Sticky("nswe"), Children(
				"Button.label", Sticky("nswe"),
				"Red.Corner.TButton.indicator", Side("right"), Sticky("ne")))))

Additional information might be available at the Tcl/Tk modifying a button and Tcl/Tk style pages. There's also a Styles and Themes tutorial at tkdoc.com.

func StyleLookup added in v0.26.1

func StyleLookup(style string, options ...any) string

ttk::style — Manipulate style database

Description

Returns the value specified for -option in style style in state state, using the standard lookup rules for element options. state is a list of state names; if omitted, it defaults to all bits off (the “normal” state). If the default argument is present, it is used as a fallback value in case no specification for -option is found. If style does not exist, it is created. For example,

StyleLookup("TButton", Font)

may return "TkDefaultFont", depending on the operating system, theme in use and the configured style options.

Additional information might be available at the Tcl/Tk style page. There's also a Styles and Themes tutorial at tkdoc.com.

func StyleMap added in v0.26.1

func StyleMap(style string, options ...any) string

ttk::style — Manipulate style database

Description

Sets dynamic (state dependent) values of the specified option(s) in style. Each statespec / value pair is examined in order; the value corresponding to the first matching statespec is used. If style does not exist, it is created. If only style and -option are specified, get the dynamic values for option -option of style style. If only style is specified, get the dynamic values for all options of style 'style'.

With no options the function returns the currently configured style map for 'style'. For example,

StyleMap("TButton")

may return "-relief {{!disabled pressed} sunken}", depending on the operating system, theme in use and the configured style options.

Setting a style map is done by providing a list of options, each option is followed by a list of states and a value. For example:

StyleMap("TButton",
	Background, "disabled", "#112233", "active", "#445566",
	Foreground, "disabled", "#778899",
        Relief, "pressed", "!disabled", "sunken")

Widget states

The widget state is a bitmap of independent state flags.

  • active - The mouse cursor is over the widget and pressing a mouse button will cause some action to occur
  • alternate - A widget-specific alternate display format
  • background - Windows and Mac have a notion of an “active” or foreground window. The background state is set for widgets in a background window, and cleared for those in the foreground window
  • disabled - Widget is disabled under program control
  • focus - Widget has keyboard focus
  • invalid - The widget’s value is invalid
  • pressed - Widget is being pressed
  • readonly - Widget should not allow user modification
  • selected - “On”, “true”, or “current” for things like Checkbuttons and radiobuttons
  • hover - The mouse cursor is within the widget. This is similar to the active state; it is used in some themes for widgets that provide distinct visual feedback for the active widget in addition to the active element within the widget.
  • user1-user6 - Freely usable for other purposes

A state specification is a sequence of state names, optionally prefixed with an exclamation point indicating that the bit is off.

Additional information might be available at the Tcl/Tk style page. There's also a Styles and Themes tutorial at tkdoc.com.

func StyleThemeNames added in v0.17.1

func StyleThemeNames() []string

ttk::style — Manipulate style database

Description

Returns a list of all known themes.

Additional information might be available at the Tcl/Tk style page.

func StyleThemeStyles added in v0.17.1

func StyleThemeStyles(themeName ...string) []string

ttk::style — Manipulate style database

Description

Returns a list of all styles in themeName. If themeName is omitted, the current theme is used.

Additional information might be available at the Tcl/Tk style page.

func StyleThemeUse added in v0.17.1

func StyleThemeUse(themeName ...string) string

ttk::style — Manipulate style database

Description

Without a argument the result is the name of the current theme. Otherwise this command sets the current theme to themeName, and refreshes all widgets.

Additional information might be available at the Tcl/Tk style page. There's also a Styles and Themes tutorial at tkdoc.com.

This mechanism is separate from the RegisterTheme/ActivateTheme one. Use of this function is best suited for the built in themes like "clam" etc.

func TclAfter added in v0.58.0

func TclAfter(ms time.Duration, script ...any) string

after — Execute a command after a time delay

Description

If script is not specified, the command sleeps for duration 'ms' and then returns. Negative duration 'ms' is treated as zero. While the command is sleeping the application does not respond to events.

If script is specified, the command returns immediately, but it arranges for a Tcl command to be executed ms milliseconds later as an event handler. The command will be executed exactly once, at the given time. The command will be executed at global level (outside the context of any Tcl procedure). If an error occurs while executing the delayed command then the background error will be reported by the command registered with interp bgerror. The after command returns an identifier that can be used to cancel the delayed command using after cancel. A ms value of 0 (or negative) queues the event immediately with priority over other event types (if not installed withn an event proc, which will wait for next round of events).

More information might be available at the [Tcl/Tk after] page.

func TclAfterCancel added in v0.58.0

func TclAfterCancel(id string)

after — Execute a command after a time delay

Description

Cancels the execution of a delayed command that was previously scheduled. Id indicates which command should be canceled; it must have been the return value from a previous after command. If the command given by id has already been executed then the after cancel command has no effect.

More information might be available at the [Tcl/Tk after] page.

func TclAfterIdle added in v0.58.0

func TclAfterIdle(script any) string

after — Execute a command after a time delay

Description

Concatenates the script arguments together with space separators (just as in the concat command), and arranges for the resulting script to be evaluated later as an idle callback. The script will be run exactly once, the next time the event loop is entered and there are no events to process. The command returns an identifier that can be used to cancel the delayed command using after cancel. If an error occurs while executing the script then the background error will be reported by the command registered with interp bgerror.

More information might be available at the [Tcl/Tk after] page.

func TeX added in v0.18.0

func TeX(src string, scale float64) (png []byte)

TeX is like Tex2 but report errors using ErrorMode and Error.

func TeX2 added in v0.31.0

func TeX2(src string, scale float64) (png []byte, err error)

TeX2 renders TeX 'src' as a png file that shows the TeX "snippet" in a fixed 600 dpi resolution. The result is afterwards resized using the 'scale' factor. Scale factor 1.0 means no resize.

Only plain Tex and a subset of some of the default Computer Modern fonts are supported. Many small fonts are not available.

func TeXImg added in v0.30.0

func TeXImg(src string, scale float64) (img image.Image)

TeXImg renders is line TeX but returns an image.Image.

func TeXImg2 added in v0.31.0

func TeXImg2(src string, scale float64) (img image.Image, err error)

TeXImg2 renders is line TeX2 but returns an image.Image.

func TkScaling added in v0.18.0

func TkScaling(options ...any) float64

tk — Manipulate Tk internal state

Description

Sets and queries the current scaling factor used by Tk to convert between physical units (for example, points, inches, or millimeters) and pixels. The number argument is a floating point number that specifies the number of pixels per point on window's display. If the window argument is omitted, it defaults to the main window. If the number argument is omitted, the current value of the scaling factor is returned.

A “point” is a unit of measurement equal to 1/72 inch. A scaling factor of 1.0 corresponds to 1 pixel per point, which is equivalent to a standard 72 dpi monitor. A scaling factor of 1.25 would mean 1.25 pixels per point, which is the setting for a 90 dpi monitor; setting the scaling factor to 1.25 on a 72 dpi monitor would cause everything in the application to be displayed 1.25 times as large as normal. The initial value for the scaling factor is set when the application starts, based on properties of the installed monitor, but it can be changed at any time. Measurements made after the scaling factor is changed will use the new scaling factor, but it is undefined whether existing widgets will resize themselves dynamically to accommodate the new scaling factor.

- Displayof window

- Number

Additional information might be available at the Tcl/Tk tk page.

func TooltipClear added in v0.49.0

func TooltipClear(pattern string)

tooltip — Tooltip management

Description

Prevents the specified widgets from showing tooltips. pattern is a glob pattern and defaults to matching all widgets.

More information might be available at the Tklib tooltip page.

func TooltipConfigure added in v0.49.0

func TooltipConfigure(options ...any) string

tooltip — Tooltip management

Description

Queries or modifies the configuration options of the tooltip. The supported options are -backgroud, -foreground and -font. If one option is specified with no value, returns the value of that option. Otherwise, sets the given options to the corresponding values.

More information might be available at the Tklib tooltip page.

func TooltipDelay added in v0.49.0

func TooltipDelay(delay time.Duration) string

tooltip — Tooltip management

Description

Query or set the hover delay. This is the interval that the pointer must remain over the widget before the tooltip is displayed. The delay is specified in milliseconds and must be greater than or equal to 50 ms. With a negative argument the current delay is returned.

More information might be available at the Tklib tooltip page.

func TooltipFade added in v0.49.0

func TooltipFade(v bool) string

tooltip — Tooltip management

Description

Enable or disable fading of the tooltip. The fading is enabled by default on Win32 and Aqua. The tooltip will fade away on Leave events instead disappearing.

More information might be available at the Tklib tooltip page.

func TooltipOff added in v0.49.0

func TooltipOff(v bool) string

tooltip — Tooltip management

Description

Disable all tooltips

More information might be available at the Tklib tooltip page.

func TooltipOn added in v0.49.0

func TooltipOn(v bool) string

tooltip — Tooltip management

Description

Enables tooltips for defined widgets.

More information might be available at the Tklib tooltip page.

func Update added in v0.5.18

func Update()

Update — Process pending events and idle callbacks

More information might be available at the Tcl/Tk update page.

func WinfoHeight added in v0.43.0

func WinfoHeight(w *Window) string

winfo — Return window-related information

Description

Returns a decimal string giving window's height in pixels. When a window is first created its height will be 1 pixel; the height will eventually be changed by a geometry manager to fulfil the window's needs. If you need the true height immediately after creating a widget, invoke update to force the geometry manager to arrange it, or use winfo reqheight to get the window's requested height instead of its actual height.

More information might be available at the Tcl/Tk winfo page.

func WinfoScreenHeight added in v0.53.0

func WinfoScreenHeight(w *Window) string

winfo — Return window-related information

Description

Returns a decimal string giving the height of window's screen, in pixels.

More information might be available at the Tcl/Tk winfo page.

func WinfoScreenWidth added in v0.53.0

func WinfoScreenWidth(w *Window) string

winfo — Return window-related information

Description

Returns a decimal string giving the width of window's screen, in pixels.

More information might be available at the Tcl/Tk winfo page.

func WinfoWidth added in v0.43.0

func WinfoWidth(w *Window) string

winfo — Return window-related information

Description

Returns a decimal string giving window's width in pixels. When a window is first created its width will be 1 pixel; the width will eventually be changed by a geometry manager to fulfil the window's needs. If you need the true width immediately after creating a widget, invoke update to force the geometry manager to arrange it, or use winfo reqwidth to get the window's requested width instead of its actual width.

More information might be available at the Tcl/Tk winfo page.

func WmAttributes added in v0.58.0

func WmAttributes(w *Window, options ...any) string

wm — Communicate with window manager

Description

  • wm attributes window
  • wm attributes window ?option?
  • wm attributes window ?option value option value...?

This subcommand returns or sets platform specific attributes associated with a window. The first form returns a list of the platform specific flags and their values. The second form returns the value for the specific option. The third form sets one or more of the values. The values are as follows:

Topmost: Specifies whether this is a topmost window (displays above all other windows).

Type: Requests that the window should be interpreted by the window manager as being of the specified type(s). This may cause the window to be decorated in a different way or otherwise managed differently, though exactly what happens is entirely up to the window manager. A list of types may be used, in order of preference. The following values are mapped to constants defined in the EWMH specification (using others is possible, but not advised):

  • "desktop" Indicates a desktop feature.
  • "dock" Indicates a dock/panel feature.
  • "toolbar" Indicates a toolbar window that should be acting on behalf of another window, as indicated with wm transient.
  • "menu" Indicates a torn-off menu that should be acting on behalf of another window, as indicated with wm transient.
  • "utility" Indicates a utility window (e.g., palette or toolbox) that should be acting on behalf of another window, as indicated with wm transient.
  • "splash" Indicates a splash screen, displayed during application start up.
  • "dialog" Indicates a general dialog window, that should be acting on behalf of another window, as indicated with wm transient.
  • "dropdownMenu" Indicates a menu summoned from a menu bar, which should usually also be set to be override-redirected (with wm overrideredirect).
  • "popupMenu" Indicates a popup menu, which should usually also be set to be override-redirected (with wm overrideredirect).
  • "tooltip" Indicates a tooltip window, which should usually also be set to be override-redirected (with wm overrideredirect).
  • "notification" Indicates a window that provides a background notification of some event, which should usually also be set to be override-redirected (with wm overrideredirect).
  • "combo" Indicates the drop-down list of a combobox widget, which should usually also be set to be override-redirected (with wm overrideredirect).
  • "dnd" Indicates a window that represents something being dragged, which should usually also be set to be override-redirected (with wm overrideredirect).
  • "normal" Indicates a window that has no special interpretation.

More information might be available at the Tcl/Tk wm page.

func WmDeiconify added in v0.54.0

func WmDeiconify(w *Window)

wm — Communicate with window manager

Description

Arrange for window to be displayed in normal (non-iconified) form. This is done by mapping the window. If the window has never been mapped then this command will not map the window, but it will ensure that when the window is first mapped it will be displayed in de-iconified form. On Windows, a deiconified window will also be raised and be given the focus (made the active window). Returns an empty string.

More information might be available at the Tcl/Tk wm page.

func WmGeometry added in v0.53.0

func WmGeometry(w *Window, geometry ...string) string

wm — Communicate with window manager

Description

If newGeometry is specified, then the geometry of window is changed and an empty string is returned. Otherwise the current geometry for window is returned (this is the most recent geometry specified either by manual resizing or in a wm geometry command). NewGeometry has the form =widthxheight±x±y, where any of =, widthxheight, or ±x±y may be omitted. Width and height are positive integers specifying the desired dimensions of window. If window is gridded (see GRIDDED GEOMETRY MANAGEMENT below) then the dimensions are specified in grid units; otherwise they are specified in pixel units.

X and y specify the desired location of window on the screen, in pixels. If x is preceded by +, it specifies the number of pixels between the left edge of the screen and the left edge of window's border; if preceded by - then x specifies the number of pixels between the right edge of the screen and the right edge of window's border. If y is preceded by + then it specifies the number of pixels between the top of the screen and the top of window's border; if y is preceded by - then it specifies the number of pixels between the bottom of window's border and the bottom of the screen.

If newGeometry is specified as an empty string then any existing user-specified geometry for window is cancelled, and the window will revert to the size requested internally by its widgets.

Note that this is related to winfo geometry, but not the same. That can only query the geometry, and always reflects Tk's current understanding of the actual size and location of window, whereas wm geometry allows both setting and querying of the window manager's understanding of the size and location of the window. This can vary significantly, for example to reflect the addition of decorative elements to window such as title bars, and window managers are not required to precisely follow the requests made through this command.

More information might be available at the Tcl/Tk wm page.

func WmIconify added in v0.54.0

func WmIconify(w *Window)

wm — Communicate with window manager

Description

Arrange for window to be iconified. It window has not yet been mapped for the first time, this command will arrange for it to appear in the iconified state when it is eventually mapped.

More information might be available at the Tcl/Tk wm page.

func WmMaxSize added in v0.26.3

func WmMaxSize(w *Window) (width, height int)

wm — Communicate with window manager

Description

Returns the maximum width and height currently in effect. The maximum size defaults to the size of the screen. See the sections on geometry management below for more information.

More information might be available at the Tcl/Tk wm page.

func WmMinSize added in v0.53.0

func WmMinSize(w *Window, widthHeight ...any) (r string)

wm — Communicate with window manager

Description

If width and height are specified, they give the minimum permissible dimensions for window. For gridded windows the dimensions are specified in grid units; otherwise they are specified in pixel units. The window manager will restrict the window's dimensions to be greater than or equal to width and height. If width and height are specified, then the command returns an empty string. Otherwise it returns a Tcl list with two elements, which are the minimum width and height currently in effect. The minimum size defaults to one pixel in each dimension. See the sections on geometry management below for more information.

More information might be available at the Tcl/Tk wm page.

func WmProtocol added in v0.42.0

func WmProtocol(w *Window, name string, command any) string

wm — Communicate with window manager

Description

This command is used to manage window manager protocols. The name argument in the wm protocol command is the name of an atom corresponding to a window manager protocol. Examples include WM_DELETE_WINDOW or WM_SAVE_YOURSELF or WM_TAKE_FOCUS. A window manager protocol is a class of messages sent from a window manager to a Tk application outside of the normal event processing system. The main example is the WM_DELETE_WINDOW protocol; these messages are sent when the user clicks the close widget in the title bar of a window. Handlers for window manager protocols are installed with the wm protocol command. As a rule, if no handler has been installed for a protocol by the wm protocol command then all messages of that protocol are ignored. The WM_DELETE_WINDOW protocol is an exception to this rule. At start-up Tk installs a handler for this protocol, which responds by destroying the window. The wm protocol command can be used to replace this default handler by one which responds differently.

A common requirement is to make sure that even if the user clicks the application's close button (X) a close handling function will be called (e.g., to prompt to save unsaved changes). For example, to ensure a custom func onQuit() function is called use:

WmProtocol(App, "WM_DELETE_WINDOW", onQuit)

The list of available window manager protocols depends on the window manager, but all window managers supported by Tk provide WM_DELETE_WINDOW. On the Windows platform, a WM_SAVE_YOURSELF message is sent on user logout or system restart.

If both name and command are specified, then command becomes the handler for the protocol specified by name. The atom for name will be added to window's WM_PROTOCOLS property to tell the window manager that the application has a handler for the protocol specified by name, and command will be invoked in the future whenever the window manager sends a message of that protocol to the Tk application. In this case the wm protocol command returns an empty string. If name is specified but command is not (is nil), then the current handler for name is returned, or an empty string if there is no handler defined for name (as a special case, the default handler for WM_DELETE_WINDOW is not returned). If command is specified as an empty string then the atom for name is removed from the WM_PROTOCOLS property of window and the handler is destroyed; an empty string is returned. Lastly, if neither name nor command is specified, the wm protocol command returns a list of all of the protocols for which handlers are currently defined for window.

More information might be available at the Tcl/Tk wm page.

func WmSetMaxSize added in v0.26.3

func WmSetMaxSize(w *Window, width, height int)

wm — Communicate with window manager

Description

Width and height give the maximum permissible dimensions for window. For gridded windows the dimensions are specified in grid units; otherwise they are specified in pixel units. The window manager will restrict the window's dimensions to be less than or equal to width and height. If width and height are specified, then the command returns an empty string. Otherwise it returns a Tcl list with two elements, which are the maximum width and height currently in effect. The maximum size defaults to the size of the screen. See the sections on geometry management below for more information.

More information might be available at the Tcl/Tk wm page.

func WmTransient added in v0.56.1

func WmTransient(options ...Opt) string

wm — Communicate with window manager

Description

If container is specified, then the window manager is informed that window is a transient window (e.g. pull-down menu) working on behalf of container (where container is the path name for a top-level window). If container is specified as an empty string then window is marked as not being a transient window any more. Otherwise the command returns the path name of window's current container, or an empty string if window is not currently a transient window. A transient window will mirror state changes in the container and inherit the state of the container when initially mapped. The directed graph with an edge from each transient to its container must be acyclic. In particular, it is an error to attempt to make a window a transient of itself. The window manager may also decorate a transient window differently, removing some features normally present (e.g., minimize and maximize buttons) though this is entirely at the discretion of the window manager.

More information might be available at the Tcl/Tk wm page.

func WmWithdraw added in v0.54.0

func WmWithdraw(w *Window)

wm — Communicate with window manager

Description

Arranges for window to be withdrawn from the screen. This causes the window to be unmapped and forgotten about by the window manager. If the window has never been mapped, then this command causes the window to be mapped in the withdrawn state. Not all window managers appear to know how to handle windows that are mapped in the withdrawn state. Note that it sometimes seems to be necessary to withdraw a window and then re-map it (e.g. with wm deiconify) to get some window managers to pay attention to changes in window attributes such as group.

More information might be available at the Tcl/Tk wm page.

Types

type ButtonWidget added in v0.11.0

type ButtonWidget struct {
	*Window
}

ButtonWidget represents the Tcl/Tk button widget/window

func Button added in v0.2.0

func Button(options ...Opt) *ButtonWidget

Button — Create and manipulate 'button' action widgets

Description

The button command creates a new window (given by the pathName argument) and makes it into a button widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the button such as its colors, font, text, and initial relief. The button command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A button is a widget that displays a textual string, bitmap or image. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the -wraplength option) and one of the characters may optionally be underlined using the It can display itself in either of three different ways, according to the -state option; it can be made to appear raised, sunken, or flat; and it can be made to flash. When a user invokes the button (by pressing mouse button 1 with the cursor over the button), then the Tcl command specified in the -command option is invoked.

Use Window.Button to create a Button with a particular parent.

More information might be available at the Tcl/Tk button page.

Standard options

Widget specific options

Command

Specifies a Tcl command to associate with the button. This command is typically invoked when mouse button 1 is released over the button window.

Default

Specifies one of three states for the default ring: normal, active, or disabled. In active state, the button is drawn with the platform specific appearance for a default button. In normal state, the button is drawn with the platform specific appearance for a non-default button, leaving enough space to draw the default button appearance. The normal and active states will result in buttons of the same size. In disabled state, the button is drawn with the non-default button appearance without leaving space for the default appearance. The disabled state may result in a smaller button than the active state.

Height

Specifies a desired height for the button. If an image or bitmap is being displayed in the button then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in lines of text. If this option is not specified, the button's desired height is computed from the size of the image or bitmap or text being displayed in it.

Overrelief

Specifies an alternative relief for the button, to be used when the mouse cursor is over the widget. This option can be used to make toolbar buttons, by configuring -relief flat -overrelief raised. If the value of this option is the empty string, then no alternative relief is used when the mouse cursor is over the button. The empty string is the default value.

State

Specifies one of three states for the button: normal, active, or disabled. In normal state the button is displayed using the -foreground and -background options. The active state is typically used when the pointer is over the button. In active state the button is displayed using the -activeforeground and -activebackground options. Disabled state means that the button should be insensitive: the default bindings will refuse to activate the widget and will ignore mouse button presses. In this state the -disabledforeground and -background options determine how the button is displayed.

Width

Specifies a desired width for the button. If an image or bitmap is being displayed in the button then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels). For a text button (no image or with -compound none) then the width specifies how much space in characters to allocate for the text label. If the width is negative then this specifies a minimum width. If this option is not specified, the button's desired width is computed from the size of the image or bitmap or text being displayed in it.

func Exit added in v0.5.18

func Exit(options ...Opt) *ButtonWidget

Exit provides a canned Button with default Txt "Exit", bound to the ExitHandler.

Use Window.Exit to create a Exit with a particular parent.

func (*ButtonWidget) Invoke added in v0.44.0

func (w *ButtonWidget) Invoke() string

button — Create and manipulate 'button' action widgets

Description

Invoke the Tcl command associated with the button, if there is one. The return value is the return value from the Tcl command, or an empty string if there is no command associated with the button. This command is ignored if the button's state is disabled.

Additional information might be available at the Tcl/Tk button page.

type CanvasWidget added in v0.11.0

type CanvasWidget struct {
	*Window
}

CanvasWidget represents the Tcl/Tk canvas widget/window

func Canvas added in v0.2.0

func Canvas(options ...Opt) *CanvasWidget

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Use Window.Canvas to create a Canvas with a particular parent.

More information might be available at the Tcl/Tk canvas page.

Standard options

Widget specific options

Closeenough

Specifies a floating-point value indicating how close the mouse cursor must be to an item before it is considered to be the item. Defaults to 1.0.

Confine

Specifies a boolean value that indicates whether or not it should be allowable to set the canvas's view outside the region defined by the scrollRegion argument. Defaults to true, which means that the view will be constrained within the scroll region.

Height

Specifies a desired window height that the canvas widget should request from its geometry manager. The value may be specified in any of the forms described in the COORDINATES section below.

Scrollregion

Specifies a list with four coordinates describing the left, top, right, and bottom coordinates of a rectangular region. This region is used for scrolling purposes and is considered to be the boundary of the information in the canvas. Each of the coordinates may be specified in any of the forms given in the COORDINATES section below.

State

Modifies the default state of the canvas where state may be set to one of: normal, disabled, or hidden. Individual canvas objects all have their own state option which may override the default state. Many options can take separate specifications such that the appearance of the item can be different in different situations. The options that start with active control the appearance when the mouse pointer is over it, while the option starting with disabled controls the appearance when the state is disabled. Canvas items which are disabled will not react to canvas bindings.

Width

Specifies a desired window width that the canvas widget should request from its geometry manager. The value may be specified in any of the forms described in the COORDINATES section below.

Xscrollincrement

Specifies an increment for horizontal scrolling, in any of the usual forms permitted for screen distances. If the value of this option is greater than zero, the horizontal view in the window will be constrained so that the canvas x coordinate at the left edge of the window is always an even multiple of xScrollIncrement; furthermore, the units for scrolling (e.g., the change in view when the left and right arrows of a scrollbar are selected) will also be xScrollIncrement. If the value of this option is negative or zero, then horizontal scrolling is unconstrained.

Yscrollincrement

Specifies an increment for vertical scrolling, in any of the usual forms permitted for screen distances. If the value of this option is greater than zero, the vertical view in the window will be constrained so that the canvas y coordinate at the top edge of the window is always an even multiple of yScrollIncrement; furthermore, the units for scrolling (e.g., the change in view when the top and bottom arrows of a scrollbar are selected) will also be yScrollIncrement. If the value of this option is negative or zero, then vertical scrolling is unconstrained.

func (*CanvasWidget) Bbox added in v0.62.1

func (w *CanvasWidget) Bbox(tagIds ...string) []string

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Returns a list with four elements giving an approximate bounding box for all the items named by the tagOrId arguments. The list has the form “x1 y1 x2 y2” such that the drawn areas of all the named elements are within the region bounded by x1 on the left, x2 on the right, y1 on the top, and y2 on the bottom. The return value may overestimate the actual bounding box by a few pixels. If no items match any of the tagOrId arguments or if the matching items have empty bounding boxes (i.e. they have nothing to display) then an empty string is returned.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreateArc added in v0.62.0

func (w *CanvasWidget) CreateArc(x1, y1, x2, y2 any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Create a new arc in pathName of type type. The exact format of the arguments after type depends on type, but usually they consist of the coordinates for one or more points, followed by specifications for zero or more item options. See the subsections on individual item types below for more on the syntax of this command. This command returns the id for the new item.

Items of type arc appear on the display as arc-shaped regions. An arc is a section of an oval delimited by two angles (specified by either the -start and -extent options or the -height option) and displayed in one of several ways (specified by the -style option). Arcs are created with widget commands of the following form:

pathName create arc x1 y1 x2 y2 ?option value ...?

The arguments x1, y1, x2, and y2 or coordList give the coordinates of two diagonally opposite corners of a rectangular region enclosing the oval that defines the arc (except when -height is specified - see below). After the coordinates there may be any number of option-value pairs, each of which sets one of the configuration options for the item. These same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. An arc item becomes the current item when the mouse pointer is over any part that is painted or (when fully transparent) that would be painted if both the -fill and -outline options were non-empty.

The following standard options are supported by arcs:

The following extra options are supported for arcs:

Provides a shortcut for creating a circular arc segment by defining the distance of the mid-point of the arc from its chord. When this option is used the coordinates are interpreted as the start and end coordinates of the chord, and the options -start and -extent are ignored. The value of distance has the following meaning:

distance > 0 creates a clockwise arc,
distance < 0 creates an counter-clockwise arc,
distance = 0 creates an arc as if this option had not been specified.

If you want the arc to have a specific radius, r, use the formula:

distance = r ± sqrt(r**2 - (chordLength / 2)**2)

choosing the minus sign for the minor arc and the plus sign for the major arc.

Note that itemcget -height always returns 0 so that introspection code can be kept simple.

Specifies how to draw the arc. If type is pieslice (the default) then the arc's region is defined by a section of the oval's perimeter plus two line segments, one between the center of the oval and each end of the perimeter section. If type is chord then the arc's region is defined by a section of the oval's perimeter plus a single line segment connecting the two end points of the perimeter section. If type is arc then the arc's region consists of a section of the perimeter alone. In this last case the -fill option is ignored.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreateBitmap added in v0.62.0

func (w *CanvasWidget) CreateBitmap(x, y any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Items of type bitmap appear on the display as images with two colors, foreground and background. Bitmaps are created with widget commands of the following form:

pathName create bitmap x y ?option value ...?

The arguments x and y or coordList (which must have two elements) specify the coordinates of a point used to position the bitmap on the display, as controlled by the -anchor option. After the coordinates there may be any number of option-value pairs, each of which sets one of the configuration options for the item. These same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. A bitmap item becomes the current item when the mouse pointer is over any part of its bounding box.

The following standard options are supported by bitmaps:

The following extra options are supported for bitmaps:

  • Background color

  • Activebackground color

  • Disabledbackground color

    Specifies the color to use for each of the bitmap's “0” valued pixels in its normal, active and disabled states. Color may have any of the forms accepted by Tk_GetColor. If this option is not specified, or if it is specified as an empty string, then nothing is displayed where the bitmap pixels are 0; this produces a transparent effect.

  • Bitmap bitmap

  • Activebitmap bitmap

  • Disabledbitmap bitmap:

    These options specify the bitmaps to display in the item in its normal, active and disabled states. Bitmap may have any of the forms accepted by Tk_GetBitmap.

  • Foreground color

  • Activeforeground color

  • Disabledforeground color:

    These options specify the color to use for each of the bitmap's “1” valued pixels in its normal, active and disabled states. Color may have any of the forms accepted by Tk_GetColor.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreateImage added in v0.62.0

func (w *CanvasWidget) CreateImage(x, y any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Items of type image are used to display images on a canvas. Images are created with widget commands of the following form:

pathName create image x y ?option value ...?

The arguments x and y or coordList specify the coordinates of a point used to position the image on the display, as controlled by the -anchor option. After the coordinates there may be any number of option-value pairs, each of which sets one of the configuration options for the item. These same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. An image item becomes the current item when the mouse pointer is over any part of its bounding box.

The following standard options are supported by images:

The following extra options are supported for images:

  • Image name

  • Activeimage name

  • Disabledimage name

    Specifies the name of the images to display in the item in is normal, active and disabled states. This image must have been created previously with the image create command.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreateLine added in v0.62.0

func (w *CanvasWidget) CreateLine(x1, y1 any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Items of type line appear on the display as one or more connected line segments or curves. Line items support coordinate indexing operations using the dchars, index and insert widget commands. Lines are created with widget commands of the following form:

pathName create line x1 y1... xn yn ?option value ...?

The following standard options are supported by lines:

The following extra options are supported for lines:

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreateOval added in v0.62.0

func (w *CanvasWidget) CreateOval(x1, y1, x2, y2 any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Items of type oval appear as circular or oval regions on the display. Each oval may have an outline, a fill, or both. Ovals are created with widget commands of the following form:

pathName create oval x1 y1 x2 y2 ?option value ...?

The following standard options are supported by ovals:

There are no oval-specific options.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreatePolygon added in v0.62.0

func (w *CanvasWidget) CreatePolygon(x1, y1 any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Items of type polygon appear as polygonal or curved filled regions on the display. Polygon items support coordinate indexing operations using the dchars, index and insert widget commands. Polygons are created with widget commands of the following form:

pathName create polygon x1 y1 ... xn yn ?option value ...?

The arguments x1 through yn or coordList specify the coordinates for three or more points that define a polygon. The first point should not be repeated as the last to close the shape; Tk will automatically close the periphery between the first and last points. After the coordinates there may be any number of option-value pairs, each of which sets one of the configuration options for the item. These same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. A polygon item is the current item whenever the mouse pointer is over any part of the polygon, whether drawn or not and whether or not the outline is smoothed.

The following standard options are supported by polygons:

The following extra options are supported for polygons:

  • Joinstyle style

    Specifies the ways in which joints are to be drawn at the vertices of the outline. Style may have any of the forms accepted by Tk_GetJoinStyle (bevel, miter, or round). If this option is not specified then it defaults to round.

  • Smooth boolean

    Boolean must have one of the forms accepted by Tcl_GetBoolean or a line smoothing method. Only true and raw are supported in the core (with bezier being an alias for true), but more can be added at runtime. If a boolean false value or empty string is given, no smoothing is applied. A boolean truth value assumes true smoothing. If the smoothing method is true, this indicates that the polygon should be drawn as a curve, rendered as a set of quadratic splines: one spline is drawn for the first and second line segments, one for the second and third, and so on. Straight-line segments can be generated within a curve by duplicating the end-points of the desired line segment. If the smoothing method is raw, this indicates that the polygon should also be drawn as a curve but where the list of coordinates is such that the first coordinate pair (and every third coordinate pair thereafter) is a knot point on a cubic Bezier curve, and the other coordinates are control points on the cubic Bezier curve. Straight line segments can be generated within a curve by making control points equal to their neighbouring knot points. If the last point is not the second point of a pair of control points, the point is repeated (one or two times) so that it also becomes the second point of a pair of control points (the associated knot point will be the first control point).

  • Splinesteps number

    Specifies the degree of smoothness desired for curves: each spline will be approximated with number line segments. This option is ignored unless the -smooth option is true or raw.

Polygon items are different from other items such as rectangles, ovals and arcs in that interior points are considered to be “inside” a polygon (e.g. for purposes of the find closest and find overlapping widget commands) even if it is not filled. For most other item types, an interior point is considered to be inside the item only if the item is filled or if it has neither a fill nor an outline. If you would like an unfilled polygon whose interior points are not considered to be inside the polygon, use a line item instead.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreateRectangle added in v0.62.0

func (w *CanvasWidget) CreateRectangle(x1, y1, x2, y2 any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Items of type rectangle appear as rectangular regions on the display. Each rectangle may have an outline, a fill, or both. Rectangles are created with widget commands of the following form:

pathName create rectangle x1 y1 x2 y2 ?option value ...?

The arguments x1, y1, x2, and y2 or coordList (which must have four elements) give the coordinates of two diagonally opposite corners of the rectangle (the rectangle will include its upper and left edges but not its lower or right edges). After the coordinates there may be any number of option-value pairs, each of which sets one of the configuration options for the item. These same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. A rectangle item becomes the current item when the mouse pointer is over any part that is painted or (when fully transparent) that would be painted if both the -fill and -outline options were non-empty.

The following standard options are supported by rectangles:

There are no rectangle-specific options.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreateText added in v0.62.0

func (w *CanvasWidget) CreateText(x, y any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

A text item displays a string of characters on the screen in one or more lines. Text items support indexing, editing and selection through the dchars widget command, the focus widget command, the icursor widget command, the index widget command, the insert widget command, and the select widget command. Text items are created with widget commands of the following form:

pathName create text x y ?option value ...?

The arguments x and y or coordList (which must have two elements) specify the coordinates of a point used to position the text on the display (see the options below for more information on how text is displayed). After the coordinates there may be any number of option-value pairs, each of which sets one of the configuration options for the item. These same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. A text item becomes the current item when the mouse pointer is over any part of its bounding box.

The following standard options are supported by text items:

The following extra options are supported for text items:

  • Angle rotationDegrees

    RotationDegrees tells how many degrees to rotate the text anticlockwise about the positioning point for the text; it may have any floating-point value from 0.0 to 360.0. For example, if rotationDegrees is 90, then the text will be drawn vertically from bottom to top. This option defaults to 0.0.

  • Font fontName

    Specifies the font to use for the text item. FontName may be any string acceptable to Tk_GetFont. If this option is not specified, it defaults to a system-dependent font.

  • Justify how

    Specifies how to justify the text within its bounding region. How must be one of the values left, right, or center. This option will only matter if the text is displayed as multiple lines. If the option is omitted, it defaults to left.

  • Txt string

    String specifies the characters to be displayed in the text item. Newline characters cause line breaks. The characters in the item may also be changed with the insert and delete widget commands. This option defaults to an empty string.

  • Underline number

    Specifies the integer index of a character within the text to be underlined. 0 corresponds to the first character of the text displayed, 1 to the next character, and so on. -1 means that no underline should be drawn (if the whole text item is to be underlined, the appropriate font should be used instead).

  • Width lineLength

    Specifies a maximum line length for the text, in any of the forms described in the COORDINATES section above. If this option is zero (the default) the text is broken into lines only at newline characters. However, if this option is non-zero then any line that would be longer than lineLength is broken just before a space character to make the line shorter than lineLength; the space character is treated as if it were a newline character.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) CreateWindow added in v0.62.0

func (w *CanvasWidget) CreateWindow(x, y any, options ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

Items of type window cause a particular window to be displayed at a given position on the canvas. Window items are created with widget commands of the following form:

pathName create window x y ?option value ...?

The arguments x and y or coordList (which must have two elements) specify the coordinates of a point used to position the window on the display, as controlled by the -anchor option. After the coordinates there may be any number of option-value pairs, each of which sets one of the configuration options for the item. These same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. Theoretically, a window item becomes the current item when the mouse pointer is over any part of its bounding box, but in practice this typically does not happen because the mouse pointer ceases to be over the canvas at that point.

The following standard options are supported by window items:

The following extra options are supported for window items:

  • Height pixels

    Specifies the height to assign to the item's window. Pixels may have any of the forms described in the COORDINATES section above. If this option is not specified, or if it is specified as zero, then the window is given whatever height it requests internally.

  • Width pixels Specifies the width to assign to the item's window. Pixels may have any of the forms described in the COORDINATES section above. If this option is not specified, or if it is specified as zero, then the window is given whatever width it requests internally.

  • ItemWindow pathName

    Specifies the window to associate with this item. The window specified by pathName must either be a child of the canvas widget or a child of some ancestor of the canvas widget. PathName may not refer to a top-level window.

Note that, due to restrictions in the ways that windows are managed, it is not possible to draw other graphical items (such as lines and images) on top of window items. A window item always obscures any graphics that overlap it, regardless of their order in the display list. Also note that window items, unlike other canvas items, are not clipped for display by their containing canvas's border, and are instead clipped by the parent widget of the window specified by the -window option; when the parent widget is the canvas, this means that the window item can overlap the canvas's border.

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) Delete added in v0.62.0

func (w *CanvasWidget) Delete(tagOrId ...any) (r string)

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

Description

More information might be available at the Tcl/Tk canvas page.

func (*CanvasWidget) Graph added in v0.11.0

func (w *CanvasWidget) Graph(script string) *CanvasWidget

Graph — use gnuplot to draw on a canvas. Graph returns 'w'.

The 'script' argument is passed to a gnuplot executable, which must be installed on the machine. See the gnuplot site for documentation about producing graphs. The script must not use the 'set term <device>' command.

type CheckbuttonWidget added in v0.11.0

type CheckbuttonWidget struct {
	*Window
}

CheckbuttonWidget represents the Tcl/Tk checkbutton widget/window

func Checkbutton added in v0.2.0

func Checkbutton(options ...Opt) *CheckbuttonWidget

Checkbutton — Create and manipulate 'checkbutton' boolean selection widgets

Description

The checkbutton command creates a new window (given by the pathName argument) and makes it into a checkbutton widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the checkbutton such as its colors, font, text, and initial relief. The checkbutton command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A checkbutton is a widget that displays a textual string, bitmap or image and a square called an indicator. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the -wraplength option) and one of the characters may optionally be underlined using the A checkbutton has all of the behavior of a simple button, including the following: it can display itself in either of three different ways, according to the -state option; it can be made to appear raised, sunken, or flat; it can be made to flash; and it invokes a Tcl command whenever mouse button 1 is clicked over the checkbutton.

In addition, checkbuttons can be selected. If a checkbutton is selected then the indicator is normally drawn with a selected appearance, and a Tcl variable associated with the checkbutton is set to a particular value (normally 1). The indicator is drawn with a check mark inside. If the checkbutton is not selected, then the indicator is drawn with a deselected appearance, and the associated variable is set to a different value (typically 0). The indicator is drawn without a check mark inside. In the special case where the variable (if specified) has a value that matches the tristatevalue, the indicator is drawn with a tri-state appearance and is in the tri-state mode indicating mixed or multiple values. (This is used when the check box represents the state of multiple items.) The indicator is drawn in a platform dependent manner. Under Unix and Windows, the background interior of the box is grayed . Under Mac, the indicator is drawn with a dash mark inside. By default, the name of the variable associated with a checkbutton is the same as the name used to create the checkbutton. The variable name, and the on , off and tristate values stored in it, may be modified with options on the command line or in the option database. Configuration options may also be used to modify the way the indicator is displayed (or whether it is displayed at all). By default a checkbutton is configured to select and deselect itself on alternate button clicks. In addition, each checkbutton monitors its associated variable and automatically selects and deselects itself when the variables value changes to and from the button's on , off and tristate values.

Use Window.Checkbutton to create a Checkbutton with a particular parent.

More information might be available at the Tcl/Tk checkbutton page.

Standard options

Widget specific options

Command

Specifies a Tcl command to associate with the button. This command is typically invoked when mouse button 1 is released over the button window. The button's global variable (-variable option) will be updated before the command is invoked.

Height

Specifies a desired height for the button. If an image or bitmap is being displayed in the button then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in lines of text. If this option is not specified, the button's desired height is computed from the size of the image or bitmap or text being displayed in it.

Indicatoron

Specifies whether or not the indicator should be drawn. Must be a proper boolean value. If false, the -relief option is ignored and the widget's relief is always sunken if the widget is selected and raised otherwise.

Offrelief

Specifies the relief for the checkbutton when the indicator is not drawn and the checkbutton is off. The default value is By setting this option to and setting -indicatoron to false and -overrelief to the effect is achieved of having a flat button that raises on mouse-over and which is depressed when activated. This is the behavior typically exhibited by the Bold, Italic, and Underline checkbuttons on the toolbar of a word-processor, for example.

Offvalue

Specifies value to store in the button's associated variable whenever this button is deselected. Defaults to

Onvalue

Specifies value to store in the button's associated variable whenever this button is selected. Defaults to

Overrelief

Specifies an alternative relief for the checkbutton, to be used when the mouse cursor is over the widget. This option can be used to make toolbar buttons, by configuring -relief flat -overrelief raised. If the value of this option is the empty string, then no alternative relief is used when the mouse cursor is over the checkbutton. The empty string is the default value.

Selectcolor

Specifies a background color to use when the button is selected. If indicatorOn is true then the color is used as the background for the indicator regardless of the select state. If indicatorOn is false, this color is used as the background for the entire widget, in place of background or activeBackground, whenever the widget is selected. If specified as an empty string then no special color is used for displaying when the widget is selected.

Selectimage

Specifies an image to display (in place of the -image option) when the checkbutton is selected. This option is ignored unless the -image option has been specified.

State

Specifies one of three states for the checkbutton: normal, active, or disabled. In normal state the checkbutton is displayed using the -foreground and -background options. The active state is typically used when the pointer is over the checkbutton. In active state the checkbutton is displayed using the -activeforeground and -activebackground options. Disabled state means that the checkbutton should be insensitive: the default bindings will refuse to activate the widget and will ignore mouse button presses. In this state the -disabledforeground and -background options determine how the checkbutton is displayed.

Tristateimage

Specifies an image to display (in place of the -image option) when the checkbutton is in tri-state mode. This option is ignored unless the -image option has been specified.

Tristatevalue

Specifies the value that causes the checkbutton to display the multi-value selection, also known as the tri-state mode. Defaults to

Variable

Specifies the name of a global variable to set to indicate whether or not this button is selected. Defaults to the name of the button within its parent (i.e. the last element of the button window's path name).

Width

Specifies a desired width for the button. If an image or bitmap is being displayed in the button then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in characters. If this option is not specified, the button's desired width is computed from the size of the image or bitmap or text being displayed in it.

func (*CheckbuttonWidget) Deselect added in v0.32.0

func (w *CheckbuttonWidget) Deselect()

checkbutton — Create and manipulate 'checkbutton' boolean selection widgets

Description

Deselects the checkbutton and sets the associated variable to its “off” value.

More information might be available at the Tcl/Tk checkbutton page.

func (*CheckbuttonWidget) Invoke added in v0.52.0

func (w *CheckbuttonWidget) Invoke() string

checkbutton — Create and manipulate 'checkbutton' boolean selection widgets

Description

Does just what would have happened if the user invoked the checkbutton with the mouse: toggle the selection state of the button and invoke the Tcl command associated with the checkbutton, if there is one. The return value is the return value from the Tcl command, or an empty string if there is no command associated with the checkbutton. This command is ignored if the checkbutton's state is disabled.

More information might be available at the Tcl/Tk checkbutton page.

func (*CheckbuttonWidget) Select added in v0.32.0

func (w *CheckbuttonWidget) Select()

checkbutton — Create and manipulate 'checkbutton' boolean selection widgets

Description

Selects the checkbutton and sets the associated variable to its “on” value.

More information might be available at the Tcl/Tk checkbutton page.

type EntryWidget added in v0.11.0

type EntryWidget struct {
	*Window
}

EntryWidget represents the Tcl/Tk entry widget/window

func Entry added in v0.2.0

func Entry(options ...Opt) *EntryWidget

Entry — Create and manipulate 'entry' one-line text entry widgets

Description

The entry command creates a new window (given by the pathName argument) and makes it into an entry widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the entry such as its colors, font, and relief. The entry command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

An entry is a widget that displays a one-line text string and allows that string to be edited using widget commands described below, which are typically bound to keystrokes and mouse actions. When first created, an entry's string is empty. A portion of the entry may be selected as described below. If an entry is exporting its selection (see the -exportselection option), then it will observe the standard X11 protocols for handling the selection; entry selections are available as type STRING. Entries also observe the standard Tk rules for dealing with the input focus. When an entry has the input focus it displays an insertion cursor to indicate where new characters will be inserted.

Entries are capable of displaying strings that are too long to fit entirely within the widget's window. In this case, only a portion of the string will be displayed; commands described below may be used to change the view in the window. Entries use the standard -xscrollcommand mechanism for interacting with scrollbars (see the description of the -xscrollcommand option for details). They also support scanning, as described below.

Use Window.Entry to create a Entry with a particular parent.

More information might be available at the Tcl/Tk entry page.

Standard options

Widget specific options

Disabledbackground

Specifies the background color to use when the entry is disabled. If this option is the empty string, the normal background color is used.

Disabledforeground

Specifies the foreground color to use when the entry is disabled. If this option is the empty string, the normal foreground color is used.

Invalidcommand

Specifies a script to eval when -validatecommand returns 0. Setting it to {} disables this feature (the default). The best use of this option is to set it to bell. See VALIDATION below for more information.

Readonlybackground

Specifies the background color to use when the entry is readonly. If this option is the empty string, the normal background color is used.

Show

If this option is specified, then the true contents of the entry are not displayed in the window. Instead, each character in the entry's value will be displayed as the first character in the value of this option, such as This is useful, for example, if the entry is to be used to enter a password. If characters in the entry are selected and copied elsewhere, the information copied will be what is displayed, not the true contents of the entry.

State

Specifies one of three states for the entry: normal, disabled, or readonly. If the entry is readonly, then the value may not be changed using widget commands and no insertion cursor will be displayed, even if the input focus is in the widget; the contents of the widget may still be selected. If the entry is disabled, the value may not be changed, no insertion cursor will be displayed, the contents will not be selectable, and the entry may be displayed in a different color, depending on the values of the -disabledforeground and -disabledbackground options.

Validate

Specifies the mode in which validation should operate: none, focus, focusin, focusout, key, or all. It defaults to none. When you want validation, you must explicitly state which mode you wish to use. See VALIDATION below for more.

Validatecommand

Specifies a script to eval when you want to validate the input into the entry widget. Setting it to {} disables this feature (the default). This command must return a valid Tcl boolean value. If it returns 0 (or the valid Tcl boolean equivalent) then it means you reject the new edition and it will not occur and the -invalidcommand will be evaluated if it is set. If it returns 1, then the new edition occurs. See VALIDATION below for more information.

Width

Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font. If the value is negative or zero, the widget picks a size just large enough to hold its current text.

func (*EntryWidget) Icursor added in v0.58.0

func (w *EntryWidget) Icursor(index any) (r string)

Entry — Create and manipulate 'entry' one-line text entry widgets

Description

Arrange for the insertion cursor to be displayed just before the character given by index. Returns an empty string.

More information might be available at the Tcl/Tk entry page.

type Event added in v0.17.0

type Event struct {
	// Event handlers should set Err on failure.
	Err error
	// Result can be optionally set by the handler. The field is returned by
	// certain methods, for example [TCheckbuttonWidget.Invoke].
	Result string
	// Event source, if any. This field is set when the event handler was
	// created.
	W *Window

	// The window to which the event was reported (the window field from
	// the event). Valid for all event types.  This field is set when the
	// event is handled.
	EventWindow *Window
	// The keysym corresponding to the event, substituted as a textual string.
	// Valid only for Key and KeyRelease events.
	Keysym string
	// The number of the last client request processed by the server (the serial
	// field from the event). Valid for all event types.
	Serial int64
	// The width field from the event. Indicates the new or requested width of the
	// window. Valid only for Configure, ConfigureRequest, Create, ResizeRequest,
	// and Expose events.
	Width string
	// The height field from the event. Valid for the Configure, ConfigureRequest,
	// Create, ResizeRequest, and Expose events. Indicates the new or requested
	// height of the window.
	Height string
	// The x and y fields from the event. For Button, ButtonRelease, Motion, Key,
	// KeyRelease, and MouseWheel events, X and Y indicate the position of the
	// mouse pointer relative to the receiving window. For key events on the
	// Macintosh these are the coordinates of the mouse at the moment when an X11
	// KeyEvent is sent to Tk, which could be slightly later than the time of the
	// physical press or release. For Enter and Leave events, the position where
	// the mouse pointer crossed the window, relative to the receiving window. For
	// Configure and Create requests, the x and y coordinates of the window
	// relative to its parent window.
	X, Y int
	// The x_root and y_root fields from the event. If a virtual-root window
	// manager is being used then the substituted values are the corresponding
	// x-coordinate and y-coordinate in the virtual root. Valid only for Button,
	// ButtonRelease, Enter, Key, KeyRelease, Leave and Motion events. Same meaning
	// as X and Y, except relative to the (virtual) root window.
	XRoot, YRoot int
	// The delta value of a MouseWheel event. The delta value represents
	// the rotation units the mouse wheel has been moved. The sign of the
	// value represents the direction the mouse wheel was scrolled.
	Delta int
	// The state field from the event. For KeyPress, KeyRelease, ButtonPress,
	// ButtonRelease, Enter, Leave, and Motion events, it is a bit field.
	// Visibility events are not currently supported, and the value will be 0.
	State Modifier
	// contains filtered or unexported fields
}

Event communicates information with an event handler. All handlers can use the Err field. Simple handlers, like in

Button(..., Command(func(e *Event) {...}))

can use the 'W' field, if applicable. All other fields are valid only in handlers bound using Bind.

func (*Event) ScrollSet added in v0.17.0

func (e *Event) ScrollSet(w Widget)

ScrollSet communicates events to scrollbars. Example:

var scroll *TScrollbarWidget
// tcl: text .text -yscrollcommand ".scroll set"
t := Text(..., Yscrollcommand(func(e *Event) { e.ScrollSet(scroll) }))

func (*Event) SetReturnCodeBreak added in v0.46.0

func (e *Event) SetReturnCodeBreak()

SetReturnCodeBreak sets return code of 'e' to TCL_BREAK.

func (*Event) SetReturnCodeContinue added in v0.46.0

func (e *Event) SetReturnCodeContinue()

SetReturnCodeContinue sets return code of 'e' to TCL_CONTINUE.

func (*Event) SetReturnCodeError added in v0.46.0

func (e *Event) SetReturnCodeError()

SetReturnCodeError sets return code of 'e' to TCL_ERROR.

func (*Event) SetReturnCodeOK added in v0.46.0

func (e *Event) SetReturnCodeOK()

SetReturnCodeOK sets return code of 'e' to TCL_OK.

func (*Event) SetReturnCodeReturn added in v0.46.0

func (e *Event) SetReturnCodeReturn()

SetReturnCodeReturn sets return code of 'e' to TCL_RETURN.

func (*Event) Xview added in v0.17.0

func (e *Event) Xview(w Widget)

Xview communicates events to views. Example:

var scroll *TScrollbarWidget
t := Text(...)
// tcl: ttk::scrollbar .scroll -command ".text xview"
scroll = TScrollbar(Command(func(e *Event) { e.Xview(t)}))

func (*Event) Yview added in v0.17.0

func (e *Event) Yview(w Widget)

Yview communicates events to views. Example:

var scroll *TScrollbarWidget
t := Text(...)
// tcl: ttk::scrollbar .scroll -command ".text yview"
scroll = TScrollbar(Command(func(e *Event) { e.Yview(t)}))

type EventHandler added in v0.3.0

type EventHandler func(*Event)

EventHandler is the type used by call backs.

type Extension added in v0.58.0

type Extension interface {
	// Initialize is called to perform any one-time initialization of an extension.
	// The Initialize method of an extension in Extensions can be called multiple
	// times but only the first successful call to Initialize will have any effect.
	Initialize(context ExtensionContext) error
}

Extension handles Tk extensions. When calling Extension methods registered in Extension, the context argument is ignored and an instance is created automatically.

type ExtensionContext added in v0.58.0

type ExtensionContext interface {
	// Eval evaluates the tcl script.
	Eval(tcl string) (r string, err error)
	// EvalErr is like Eval, but handles errors according to the current value of
	// [ErrorMode].
	EvalErr(tcl string) (r string)
	RegisterWindow(path string) *Window
	Collect(w *Window, options ...any) string
	// Returns a single Tcl string, no braces, except "{}" is returned for s == "".
	TclSafeString(string) string
}

ExtensionContext provides context to Extension methods.

type ExtensionKey added in v0.58.0

type ExtensionKey struct {
	Type string
	Name string
}

ExtensionKey indexes Extensions

func RegisterExtension added in v0.58.0

func RegisterExtension(name string, e Extension) (r ExtensionKey, err error)

RegisterExtension registers e.

type FileType added in v0.4.10

type FileType struct {
	TypeName   string   // Eg. "Go files"
	Extensions []string // Eg. []string{".go"}
	MacType    string   // Eg. "TEXT"
}

FileType specifies a single file type for the Filetypes option.

type FontFace added in v0.19.3

type FontFace struct {
	// contains filtered or unexported fields
}

FontFace represents a Tk font.

func NewFont added in v0.5.18

func NewFont(options ...Opt) *FontFace

NewFont — Create and inspect fonts.

Description

Creates a new font.

The following options are supported on all platforms, and are used when creating/specifying a font:

The case-insensitive font family name. Tk guarantees to support the font families named Courier (a monospaced “typewriter” font), Times (a serifed “newspaper” font), and Helvetica (a sans-serif “European” font). The most closely matching native font family will automatically be substituted when one of the above font families is used. The name may also be the name of a native, platform-specific font family; in that case it will work as desired on one platform but may not display correctly on other platforms. If the family is unspecified or unrecognized, a platform-specific default font will be chosen.

The desired size of the font. If the size argument is a positive number, it is interpreted as a size in points. If size is a negative number, its absolute value is interpreted as a size in pixels. If a font cannot be displayed at the specified size, a nearby size will be chosen. If size is unspecified or zero, a platform-dependent default size will be chosen.

Sizes should normally be specified in points so the application will remain the same ruler size on the screen, even when changing screen resolutions or moving scripts across platforms. However, specifying pixels is useful in certain circumstances such as when a piece of text must line up with respect to a fixed-size bitmap. The mapping between points and pixels is set when the application starts, based on properties of the installed monitor, but it can be overridden by calling the tk scaling command.

The nominal thickness of the characters in the font. The value normal specifies a normal weight font, while bold specifies a bold font. The closest available weight to the one specified will be chosen. The default weight is normal.

The amount the characters in the font are slanted away from the vertical. Valid values for slant are roman and italic. A roman font is the normal, upright appearance of a font, while an italic font is one that is tilted some number of degrees from upright. The closest available slant to the one specified will be chosen. The default slant is roman.

The value is a boolean flag that specifies whether characters in this font should be underlined. The default value for underline is false.

The value is a boolean flag that specifies whether a horizontal line should be drawn through the middle of characters in this font. The default value for overstrike is false.

Additional information might be available at the Tcl/Tk font page.

func (*FontFace) Delete added in v0.19.3

func (f *FontFace) Delete()

Delete — Manipulate fonts.

Description

Delete the font. If there are widgets using the named font, the named font will not actually be deleted until all the instances are released. Those widgets will continue to display using the last known values for the named font. If a deleted named font is subsequently recreated with another call to font create, the widgets will use the new named font and redisplay themselves using the new attributes of that font.

Additional information might be available at the Tcl/Tk font page.

func (*FontFace) MetricsAscent added in v0.62.2

func (f *FontFace) MetricsAscent(window *Window) int

NewFont — Create and inspect fonts.

Description

Returns the amount in pixels that the tallest letter sticks up above the baseline of the font, plus any extra blank space added by the designer of the font.

Additional information might be available at the Tcl/Tk font page.

func (*FontFace) MetricsDescent added in v0.62.2

func (f *FontFace) MetricsDescent(window *Window) int

NewFont — Create and inspect fonts.

Description

Returns the largest amount in pixels that any letter sticks down below the baseline of the font, plus any extra blank space added by the designer of the font.

Additional information might be available at the Tcl/Tk font page.

func (*FontFace) MetricsFixed added in v0.62.2

func (f *FontFace) MetricsFixed(window *Window) bool

NewFont — Create and inspect fonts.

Description

Returns a boolean flag that is true if this is a fixed-width font, where each normal character is the same width as all the other characters, or is false if this is a proportionally-spaced font, where individual characters have different widths. The widths of control characters, tab characters, and other non-printing characters are not included when calculating this value.

Additional information might be available at the Tcl/Tk font page.

func (*FontFace) MetricsLinespace added in v0.62.2

func (f *FontFace) MetricsLinespace(window *Window) int

NewFont — Create and inspect fonts.

Description

Returns how far apart vertically in pixels two lines of text using the same font should be placed so that none of the characters in one line overlap any of the characters in the other line. This is generally the sum of the ascent above the baseline line plus the descent below the baseline.

Additional information might be available at the Tcl/Tk font page.

func (*FontFace) String added in v0.19.3

func (f *FontFace) String() string

String implements fmt.Stringer.

type FrameWidget added in v0.11.0

type FrameWidget struct {
	*Window
}

FrameWidget represents the Tcl/Tk frame widget/window

func Frame added in v0.2.0

func Frame(options ...Opt) *FrameWidget

Frame — Create and manipulate 'frame' simple container widgets

Description

The frame command creates a new window (given by the pathName argument) and makes it into a frame widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the frame such as its background color and relief. The frame command returns the path name of the new window.

A frame is a simple widget. Its primary purpose is to act as a spacer or container for complex window layouts. The only features of a frame are its background and an optional 3-D border to make the frame appear raised or sunken.

Use Window.Frame to create a Frame with a particular parent.

More information might be available at the Tcl/Tk frame page.

Standard options

Widget specific options

Background

This option is the same as the standard -background option except that its value may also be specified as an empty string. In this case, the widget will display no background or border, and no colors will be consumed from its colormap for its background and border. An empty background will disable drawing the background image.

Backgroundimage

This specifies an image to display on the frame's background within the border of the frame (i.e., the image will be clipped by the frame's highlight ring and border, if either are present); subwidgets of the frame will be drawn on top. The image must have been created with the image create command. If specified as the empty string, no image will be displayed.

Class

Specifies a class for the window. This class will be used when querying the option database for the window's other options, and it will also be used later for other purposes such as bindings. The -class option may not be changed with the configure widget command.

Colormap

Specifies a colormap to use for the window. The value may be either new, in which case a new colormap is created for the window and its children, or the name of another window (which must be on the same screen and have the same visual as pathName), in which case the new window will use the colormap from the specified window. If the -colormap option is not specified, the new window uses the same colormap as its parent. This option may not be changed with the configure widget command.

Container

The value must be a boolean. If true, it means that this window will be used as a container in which some other application will be embedded (for example, a Tk toplevel can be embedded using the -use option). The window will support the appropriate window manager protocols for things like geometry requests. The window should not have any children of its own in this application. This option may not be changed with the configure widget command. Note that -borderwidth, -padx and -pady are ignored when configured as a container since a container has no border.

Height

Specifies the desired height for the window in any of the forms acceptable to Tk_GetPixels. If this option is negative or zero then the window will not request any size at all. Note that this sets the total height of the frame, any -borderwidth or similar is not added. Normally -height should not be used if a propagating geometry manager, such as grid or pack, is used within the frame since the geometry manager will override the height of the frame.

Tile

This specifies how to draw the background image (see -backgroundimage) on the frame. If true (according to Tcl_GetBoolean), the image will be tiled to fill the whole frame, with the origin of the first copy of the image being the top left of the interior of the frame. If false (the default), the image will be centered within the frame.

Visual

Specifies visual information for the new window in any of the forms accepted by Tk_GetVisual. If this option is not specified, the new window will use the same visual as its parent. The -visual option may not be modified with the configure widget command.

Width

Specifies the desired width for the window in any of the forms acceptable to Tk_GetPixels. If this option is negative or zero then the window will not request any size at all. Note that this sets the total width of the frame, any -borderwidth or similar is not added. Normally -width should not be used if a propagating geometry manager, such as grid or pack, is used within the frame since the geometry manager will override the width of the frame.

type Img added in v0.4.10

type Img struct {
	// contains filtered or unexported fields
}

Img represents a Tk image.

func NewBitmap added in v0.5.18

func NewBitmap(options ...Opt) *Img

Bitmap — Images that display two colors

Description

A bitmap is an image whose pixels can display either of two colors or be transparent. A bitmap image is defined by four things: a background color, a foreground color, and two bitmaps, called the source and the mask. Each of the bitmaps specifies 0/1 values for a rectangular array of pixels, and the two bitmaps must have the same dimensions. For pixels where the mask is zero, the image displays nothing, producing a transparent effect. For other pixels, the image displays the foreground color if the source data is one and the background color if the source data is zero.

Additional information might be available at the Tcl/Tk bitmap page.

Specifies a background color for the image in any of the standard ways accepted by Tk. If this option is set to an empty string then the background pixels will be transparent. This effect is achieved by using the source bitmap as the mask bitmap, ignoring any -maskdata or -maskfile options.

Specifies the contents of the source bitmap as a string. The string must adhere to X11 bitmap format (e.g., as generated by the bitmap program). If both the -data and -file options are specified, the -data option takes precedence.

name gives the name of a file whose contents define the source bitmap. The file must adhere to X11 bitmap format (e.g., as generated by the bitmap program).

Specifies a foreground color for the image in any of the standard ways accepted by Tk.

Specifies the contents of the mask as a string. The string must adhere to X11 bitmap format (e.g., as generated by the bitmap program). If both the -maskdata and -maskfile options are specified, the -maskdata option takes precedence.

name gives the name of a file whose contents define the mask. The file must adhere to X11 bitmap format (e.g., as generated by the bitmap program).

func NewPhoto added in v0.5.18

func NewPhoto(options ...Opt) *Img

Photo — Full-color images

A photo is an image whose pixels can display any color with a varying degree of transparency (the alpha channel). A photo image is stored internally in full color (32 bits per pixel), and is displayed using dithering if necessary. Image data for a photo image can be obtained from a file or a string, or it can be supplied from C code through a procedural interface. At present, only PNG, GIF, PPM/PGM, and (read-only) SVG formats are supported, but an interface exists to allow additional image file formats to be added easily. A photo image is (semi)transparent if the image data it was obtained from had transparency information. In regions where no image data has been supplied, it is fully transparent. Transparency may also be modified with the transparency set subcommand.

Specifies the contents of the image as a string. The string should contain binary data or, for some formats, base64-encoded data (this is currently guaranteed to be supported for PNG and GIF images). The format of the string must be one of those for which there is an image file format handler that will accept string data. If both the -data and -file options are specified, the -file option takes precedence.

Specifies the name of the file format for the data specified with the -data or -file option.

name gives the name of a file that is to be read to supply data for the photo image. The file format must be one of those for which there is an image file format handler that can read data.

Specifies that the colors allocated for displaying this image in a window should be corrected for a non-linear display with the specified gamma exponent value. (The intensity produced by most CRT displays is a power function of the input value, to a good approximation; gamma is the exponent and is typically around 2). The value specified must be greater than zero. The default value is one (no correction). In general, values greater than one will make the image lighter, and values less than one will make it darker.

Specifies the height of the image, in pixels. This option is useful primarily in situations where the user wishes to build up the contents of the image piece by piece. A value of zero (the default) allows the image to expand or shrink vertically to fit the data stored in it.

Specifies the resolution of the color cube to be allocated for displaying this image, and thus the number of colors used from the colormaps of the windows where it is displayed. The palette-spec string may be either a single decimal number, specifying the number of shades of gray to use, or three decimal numbers separated by slashes (/), specifying the number of shades of red, green and blue to use, respectively. If the first form (a single number) is used, the image will be displayed in monochrome (i.e., grayscale).

Specifies the width of the image, in pixels. This option is useful primarily in situations where the user wishes to build up the contents of the image piece by piece. A value of zero (the default) allows the image to expand or shrink horizontally to fit the data stored in it.

Additional information might be available at the Tcl/Tk photo page.

func (*Img) Copy added in v0.20.0

func (m *Img) Copy(src *Img, options ...Opt) (r *Img)

photo — Full-color images

Copies a region from the image called sourceImage (which must be a photo image) to the image called imageName, possibly with pixel zooming and/or subsampling. If no options are specified, this command copies the whole of sourceImage into imageName, starting at coordinates (0,0) in imageName.

The following options may be specified:

Specifies a rectangular sub-region of the source image to be copied. (x1,y1) and (x2,y2) specify diagonally opposite corners of the rectangle. If x2 and y2 are not specified, the default value is the bottom-right corner of the source image. The pixels copied will include the left and top edges of the specified rectangle but not the bottom or right edges. If the -from option is not given, the default is the whole source image.

  • To x1 y1 x2 y2

Specifies a rectangular sub-region of the destination image to be affected. (x1,y1) and (x2,y2) specify diagonally opposite corners of the rectangle. If x2 and y2 are not specified, the default value is (x1,y1) plus the size of the source region (after subsampling and zooming, if specified). If x2 and y2 are specified, the source region will be replicated if necessary to fill the destination region in a tiled fashion.

The function returns 'm'.

Additional information might be available at the Tcl/Tk photo page.

func (*Img) Delete added in v0.31.0

func (m *Img) Delete()

image — Create and manipulate images

Description

Deletes 'm!. If there are instances of the image displayed in widgets, the image will not actually be deleted until all of the instances are released. However, the association between the instances and the image manager will be dropped. Existing instances will retain their sizes but redisplay as empty areas. If a deleted image is recreated with another call to image create, the existing instances will use the new image.

func (*Img) Graph added in v0.9.1

func (m *Img) Graph(script string) *Img

Graph — use gnuplot to draw on a photo. Graph returns 'm'

The 'script' argument is passed to a gnuplot executable, which must be installed on the machine. See the gnuplot site for documentation about producing graphs. The script must not use the 'set term <device>' command.

The content of 'm' is replaced, including its internal name.

func (*Img) Height added in v0.9.0

func (m *Img) Height() string

Height — Get the configured option value.

Additional information might be available at the Tcl/Tk photo page.

func (*Img) String added in v0.5.18

func (m *Img) String() string

String implements fmt.Stringer.

func (*Img) Width added in v0.9.0

func (m *Img) Width() string

Width — Get the configured option value.

Additional information might be available at the Tcl/Tk photo page.

type LC added in v0.5.18

type LC struct {
	Line int // 1-based line number within the text content.
	Char int // 0-based char number within the line.
}

LC encodes a text index consisting of a line and char number.

func (LC) String added in v0.5.18

func (lc LC) String() string

String implements fmt.Stringer.

type LabelWidget added in v0.11.0

type LabelWidget struct {
	*Window
}

LabelWidget represents the Tcl/Tk label widget/window

func Label added in v0.2.0

func Label(options ...Opt) *LabelWidget

Label — Create and manipulate 'label' non-interactive text or image widgets

Description

The label command creates a new window (given by the pathName argument) and makes it into a label widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the label such as its colors, font, text, and initial relief. The label command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A label is a widget that displays a textual string, bitmap or image. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the -wraplength option) and one of the characters may optionally be underlined using the The label can be manipulated in a few simple ways, such as changing its relief or text, using the commands described below.

Use Window.Label to create a Label with a particular parent.

More information might be available at the Tcl/Tk label page.

Standard options

Widget specific options

Height

Specifies a desired height for the label. If an image or bitmap is being displayed in the label then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in lines of text. If this option is not specified, the label's desired height is computed from the size of the image or bitmap or text being displayed in it.

State

Specifies one of three states for the label: normal, active, or disabled. In normal state the button is displayed using the -foreground and -background options. In active state the label is displayed using the -activeforeground and -activebackground options. In the disabled state the -disabledforeground and -background options determine how the button is displayed.

Width

Specifies a desired width for the label. If an image or bitmap is being displayed in the label then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in characters. If this option is not specified, the label's desired width is computed from the size of the image or bitmap or text being displayed in it.

type LabelframeWidget added in v0.11.0

type LabelframeWidget struct {
	*Window
}

LabelframeWidget represents the Tcl/Tk labelframe widget/window

func Labelframe added in v0.2.0

func Labelframe(options ...Opt) *LabelframeWidget

Labelframe — Create and manipulate 'labelframe' labelled container widgets

Description

The labelframe command creates a new window (given by the pathName argument) and makes it into a labelframe widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the labelframe such as its background color and relief. The labelframe command returns the path name of the new window.

A labelframe is a simple widget. Its primary purpose is to act as a spacer or container for complex window layouts. It has the features of a frame plus the ability to display a label.

Use Window.Labelframe to create a Labelframe with a particular parent.

More information might be available at the Tcl/Tk labelframe page.

Standard options

Widget specific options

Background

This option is the same as the standard -background option except that its value may also be specified as an empty string. In this case, the widget will display no background or border, and no colors will be consumed from its colormap for its background and border.

Class

Specifies a class for the window. This class will be used when querying the option database for the window's other options, and it will also be used later for other purposes such as bindings. The -class option may not be changed with the configure widget command.

Colormap

Specifies a colormap to use for the window. The value may be either new, in which case a new colormap is created for the window and its children, or the name of another window (which must be on the same screen and have the same visual as pathName), in which case the new window will use the colormap from the specified window. If the -colormap option is not specified, the new window uses the same colormap as its parent. This option may not be changed with the configure widget command.

Height

Specifies the desired height for the window in any of the forms acceptable to Tk_GetPixels. If this option is negative or zero then the window will not request any size at all.

Labelanchor

Specifies where to place the label. A label is only displayed if the -text option is not the empty string. Valid values for this option are (listing them clockwise) nw, n, ne, en, e, es, se, s,sw, ws, w and wn. The default value is nw.

Labelwidget

Specifies a widget to use as label. This overrides any -text option. The widget must exist before being used as -labelwidget and if it is not a descendant of this window, it will be raised above it in the stacking order.

Visual

Specifies visual information for the new window in any of the forms accepted by Tk_GetVisual. If this option is not specified, the new window will use the same visual as its parent. The -visual option may not be modified with the configure widget command.

Width

Specifies the desired width for the window in any of the forms acceptable to Tk_GetPixels. If this option is negative or zero then the window will not request any size at all.

type ListboxWidget added in v0.11.0

type ListboxWidget struct {
	*Window
}

ListboxWidget represents the Tcl/Tk listbox widget/window

func Listbox added in v0.2.0

func Listbox(options ...Opt) *ListboxWidget

Listbox — Create and manipulate 'listbox' item list widgets

Description

The listbox command creates a new window (given by the pathName argument) and makes it into a listbox widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the listbox such as its colors, font, text, and relief. The listbox command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A listbox is a widget that displays a list of strings, one per line. When first created, a new listbox has no elements. Elements may be added or deleted using widget commands described below. In addition, one or more elements may be selected as described below. If a listbox is exporting its selection (see -exportselection option), then it will observe the standard X11 protocols for handling the selection. Listbox selections are available as type STRING; the value of the selection will be the text of the selected elements, with newlines separating the elements.

It is not necessary for all the elements to be displayed in the listbox window at once; commands described below may be used to change the view in the window. Listboxes allow scrolling in both directions using the standard -xscrollcommand and -yscrollcommand options. They also support scanning, as described below.

Use Window.Listbox to create a Listbox with a particular parent.

More information might be available at the Tcl/Tk listbox page.

Standard options

Widget specific options

Activestyle

Specifies the style in which to draw the active element. This must be one of dotbox (show a focus ring around the active element), none (no special indication of active element) or underline (underline the active element). The default is underline on Windows, and dotbox elsewhere.

Height

Specifies the desired height for the window, in lines. If zero or less, then the desired height for the window is made just large enough to hold all the elements in the listbox.

Listvariable

Specifies the name of a global variable. The value of the variable is a list to be displayed inside the widget; if the variable value changes then the widget will automatically update itself to reflect the new value. Attempts to assign a variable with an invalid list value to -listvariable will cause an error. Attempts to unset a variable in use as a -listvariable will fail but will not generate an error.

Selectmode

Specifies one of several styles for manipulating the selection. The value of the option may be arbitrary, but the default bindings expect it to be either single, browse, multiple, or extended; the default value is browse.

State

Specifies one of two states for the listbox: normal or disabled. If the listbox is disabled then items may not be inserted or deleted, items are drawn in the -disabledforeground color, and selection cannot be modified and is not shown (though selection information is retained).

Width

Specifies the desired width for the window in characters. If the font does not have a uniform width then the width of the character is used in translating from character units to screen units. If zero or less, then the desired width for the window is made just large enough to hold all the elements in the listbox.

func (*ListboxWidget) Get added in v0.60.0

func (w *ListboxWidget) Get(first any, last ...any) (r []string)

listbox — Create and manipulate 'listbox' item list widgets

Description

If last is omitted, returns the contents of the listbox element indicated by first, or an empty string if first refers to a non-existent element. If last is specified, the command returns a list whose elements are all of the listbox elements between first and last, inclusive. Both first and last may have any of the standard forms for indices.

More information might be available at the Tcl/Tk listbox page.

func (*ListboxWidget) Insert added in v0.60.0

func (w *ListboxWidget) Insert(index any, elements ...any)

listbox — Create and manipulate 'listbox' item list widgets

Description

Inserts zero or more new elements in the list just before the element given by index. If index is specified as end then the new elements are added to the end of the list.

More information might be available at the Tcl/Tk listbox page.

type MenuItem struct {
	// contains filtered or unexported fields
}

MenuItem represents an entry on a menu.

func (m *MenuItem) String() string

String implements fmt.Stringer.

type MenuWidget struct {
	*Window
}

MenuWidget represents the Tcl/Tk menu widget/window

func Menu(options ...Opt) *MenuWidget

Menu — Create and manipulate 'menu' widgets and menubars

Use Window.Menu to create a Menu with a particular parent.

More information might be available at the Tcl/Tk menu page.

Standard options

Widget specific options

Postcommand

If this option is specified then it provides a Tcl command to execute each time the menu is posted. The command is invoked by the post widget command before posting the menu. Note that in Tk 8.0 on Macintosh and Windows, all post-commands in a system of menus are executed before any of those menus are posted. This is due to the limitations in the individual platforms' menu managers.

Selectcolor

For menu entries that are check buttons or radio buttons, this option specifies the color to display in the indicator when the check button or radio button is selected.

Tearoff

This option must have a proper boolean value (default is false), which specifies whether or not the menu should include a tear-off entry at the top. If so, it will exist as entry 0 of the menu and the other entries will number starting at 1. The default menu bindings arrange for the menu to be torn off when the tear-off entry is invoked. This option is ignored under Aqua/MacOS, where menus cannot be torn off.

Tearoffcommand

If this option has a non-empty value, then it specifies a Tcl command to invoke whenever the menu is torn off. The actual command will consist of the value of this option, followed by a space, followed by the name of the menu window, followed by a space, followed by the name of the name of the torn off menu window. For example, if the option's value is and menu .x.y is torn off to create a new menu .x.tearoff1, then the command will be invoked. This option is ignored under Aqua/MacOS, where menus cannot be torn off.

Title

The string will be used to title the window created when this menu is torn off. If the title is NULL, then the window will have the title of the menubutton or the text of the cascade item from which this menu was invoked.

Type

This option can be one of menubar, tearoff, or normal, and is set when the menu is created. While the string returned by the configuration database will change if this option is changed, this does not affect the menu widget's behavior. This is used by the cloning mechanism and is not normally set outside of the Tk library.

func (w *MenuWidget) AddCascade(options ...Opt) *MenuItem

Menu — Create and manipulate 'menu' widgets and menubars

Description

Add a new cascade entry to the end of the menu.

Additional information might be available at the Tcl/Tk menu page.

func (w *MenuWidget) AddCheckbutton(options ...Opt) *MenuItem

Menu — Create and manipulate 'menu' widgets and menubars

Description

Add a new checkbutton entry to the bottom of the menu.

Additional information might be available at the Tcl/Tk menu page.

func (w *MenuWidget) AddCommand(options ...Opt) *MenuItem

Menu — Create and manipulate 'menu' widgets and menubars

Description

Add a new command entry to the bottom of the menu.

Additional information might be available at the Tcl/Tk menu page.

func (w *MenuWidget) AddRadiobutton(options ...Opt) *MenuItem

Menu — Create and manipulate 'menu' widgets and menubars

Description

Add a new radiobutton entry to the bottom of the menu.

Additional information might be available at the Tcl/Tk menu page.

func (w *MenuWidget) AddSeparator(options ...Opt) *MenuItem

Menu — Create and manipulate 'menu' widgets and menubars

Description

Add a new separator entry to the bottom of the menu.

Additional information might be available at the Tcl/Tk menu page.

func (w *MenuWidget) EntryConfigure(index uint, options ...Opt)

Menu — Create and manipulate 'menu' widgets and menubars

Description

This command is similar to the configure command, except that it applies to the options for an individual entry, whereas configure applies to the options for the menu as a whole. Options may have any of the values described in the MENU ENTRY OPTIONS section below. If options are specified, options are modified as indicated in the command and the command returns an empty string. If no options are specified, returns a list describing the current options for entry index (see Tk_ConfigureInfo for information on the format of this list).

Additional information might be available at the Tcl/Tk menu page.

func (w *MenuWidget) Invoke(index uint)

Menu — Create and manipulate 'menu' widgets and menubars

Description

Invoke the action of the menu entry. See the sections on the individual entries above for details on what happens. If the menu entry is disabled then nothing happens. If the entry has a command associated with it then the result of that command is returned as the result of the invoke widget command. Otherwise the result is an empty string. Note: invoking a menu entry does not automatically unpost the menu; the default bindings normally take care of this before invoking the invoke widget command.

Additional information might be available at the Tcl/Tk menu page.

type MenubuttonWidget struct {
	*Window
}

MenubuttonWidget represents the Tcl/Tk menubutton widget/window

func Menubutton(options ...Opt) *MenubuttonWidget

Menubutton — Create and manipulate 'menubutton' pop-up menu indicator widgets

Use Window.Menubutton to create a Menubutton with a particular parent.

More information might be available at the Tcl/Tk menubutton page.

Standard options

Widget specific options

Direction

Specifies where the menu is going to be popup up. above tries to pop the menu above the menubutton. below tries to pop the menu below the menubutton. left tries to pop the menu to the left of the menubutton. right tries to pop the menu to the right of the menu button. flush pops the menu directly over the menubutton. In the case of above or below, the direction will be reversed if the menu would show offscreen.

Height

Specifies a desired height for the menubutton. If an image or bitmap is being displayed in the menubutton then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in lines of text. If this option is not specified, the menubutton's desired height is computed from the size of the image or bitmap or text being displayed in it.

Indicatoron

The value must be a proper boolean value. If it is true then a small indicator rectangle will be displayed on the right side of the menubutton and the default menu bindings will treat this as an option menubutton. If false then no indicator will be displayed.

Mnu

Specifies the path name of the menu associated with this menubutton. The menu must be a child of the menubutton.

State

Specifies one of three states for the menubutton: normal, active, or disabled. In normal state the menubutton is displayed using the foreground and background options. The active state is typically used when the pointer is over the menubutton. In active state the menubutton is displayed using the -activeforeground and -activebackground options. Disabled state means that the menubutton should be insensitive: the default bindings will refuse to activate the widget and will ignore mouse button presses. In this state the -disabledforeground and -background options determine how the button is displayed.

Width

Specifies a desired width for the menubutton. If an image or bitmap is being displayed in the menubutton then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in characters. If this option is not specified, the menubutton's desired width is computed from the size of the image or bitmap or text being displayed in it.

type MessageWidget added in v0.11.0

type MessageWidget struct {
	*Window
}

MessageWidget represents the Tcl/Tk message widget/window

func Message added in v0.2.0

func Message(options ...Opt) *MessageWidget

Message — Create and manipulate 'message' non-interactive text widgets

Description

The message command creates a new window (given by the pathName argument) and makes it into a message widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the message such as its colors, font, text, and initial relief. The message command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A message is a widget that displays a textual string. A message widget has three special features that differentiate it from a label widget. First, it breaks up its string into lines in order to produce a given aspect ratio for the window. The line breaks are chosen at word boundaries wherever possible (if not even a single word would fit on a line, then the word will be split across lines). Newline characters in the string will force line breaks; they can be used, for example, to leave blank lines in the display.

The second feature of a message widget is justification. The text may be displayed left-justified (each line starts at the left side of the window), centered on a line-by-line basis, or right-justified (each line ends at the right side of the window).

The third feature of a message widget is that it handles control characters and non-printing characters specially. Tab characters are replaced with enough blank space to line up on the next 8-character boundary. Newlines cause line breaks. Other control characters (ASCII code less than 0x20) and characters not defined in the font are displayed as a four-character sequence \exhh where hh is the two-digit hexadecimal number corresponding to the character. In the unusual case where the font does not contain all of the characters in 0123456789abcdef\ex then control characters and undefined characters are not displayed at all.

Use Window.Message to create a Message with a particular parent.

More information might be available at the Tcl/Tk message page.

Standard options

Widget specific options

Aspect

Specifies a non-negative integer value indicating desired aspect ratio for the text. The aspect ratio is specified as 100*width/height. 100 means the text should be as wide as it is tall, 200 means the text should be twice as wide as it is tall, 50 means the text should be twice as tall as it is wide, and so on. Used to choose line length for text if -width option is not specified. Defaults to 150.

Justify

Specifies how to justify lines of text. Must be one of left, center, or right. Defaults to left. This option works together with the -anchor, -aspect, -padx, -pady, and -width options to provide a variety of arrangements of the text within the window. The -aspect and -width options determine the amount of screen space needed to display the text. The -anchor, -padx, and -pady options determine where this rectangular area is displayed within the widget's window, and the -justify option determines how each line is displayed within that rectangular region. For example, suppose -anchor is e and -justify is left, and that the message window is much larger than needed for the text. The text will be displayed so that the left edges of all the lines line up and the right edge of the longest line is -padx from the right side of the window; the entire text block will be centered in the vertical span of the window.

Width

Specifies the length of lines in the window. The value may have any of the forms acceptable to Tk_GetPixels. If this option has a value greater than zero then the -aspect option is ignored and the -width option determines the line length. If this option value is negative or zero, then the -aspect option determines the line length.

type Modifier added in v0.62.1

type Modifier int

Modifier is a bit field representing 0 or more modifiers.

const (
	ModifierNone  Modifier = 0
	ModifierShift Modifier = 1 << (iota - 1)
	ModifierLock
	ModifierControl
	ModifierMod1
	ModifierMod2
	ModifierMod3
	ModifierMod4
	ModifierMod5
	ModifierButton1
	ModifierButton2
	ModifierButton3
	ModifierButton4
	ModifierButton5

	ModifierAlt     = ModifierMod1
	ModifierNumlock = ModifierMod2
	ModifierWindows = ModifierMod4
	ModifierSuper   = ModifierMod4
)

func (Modifier) String added in v0.62.1

func (mods Modifier) String() string

type Opt added in v0.2.0

type Opt interface {
	// contains filtered or unexported methods
}

Opt represents an optional argument.

func Accelerator added in v0.4.10

func Accelerator(val any) Opt

Accelerator option.

Known uses:

func Activebackground added in v0.2.0

func Activebackground(val any) Opt

Activebackground option.

Specifies background color to use when drawing active elements. An element (a widget or portion of a widget) is active if the mouse cursor is positioned over the element and pressing a mouse button will cause some action to occur. If strict Motif compliance has been requested by setting the tk_strictMotif variable, this option will normally be ignored; the normal background color will be used instead. For some elements on Windows and Macintosh systems, the active color will only be used while mouse button 1 is pressed over the element.

Known uses:

func Activebitmap added in v0.4.12

func Activebitmap(bitmap any) Opt

Activebitmap option.

This option specify the bitmap to display in the item in its active state. Bitmap may have any of the forms accepted by Tk_GetBitmap.

Known uses:

func Activeborderwidth added in v0.2.0

func Activeborderwidth(val any) Opt

Activeborderwidth option.

Specifies a non-negative value indicating the width of the 3-D border drawn around active elements. See above for definition of active elements. The value may have any of the forms acceptable to Tk_GetPixels. This option is typically only available in widgets displaying more than one element at a time (e.g. menus but not buttons).

Known uses:

func Activedash added in v0.4.12

func Activedash(pattern ...int) Opt

Activedash option.

This option specifies the dash pattern for the active state of an item. If the dash option is omitted then the default is a solid outline.

Many items support the notion of a dash pattern for outlines. The syntax is a list of integers. Each element represents the number of pixels of a line segment. Only the odd segments are drawn using the “outline” color. The other segments are drawn transparent.

Known uses:

func Activefill added in v0.4.12

func Activefill(color any) Opt

Activefill option.

This option specifies the color to be used to fill item's area in its active state. The even-odd fill rule is used. Color may have any of the forms accepted by Tk_GetColor. For the line item, it specifies the color of the line drawn. For the text item, it specifies the foreground color of the text. If color is an empty string (the default for all canvas items except line and text), then the item will not be filled.

Known uses:

func Activeforeground added in v0.2.0

func Activeforeground(val any) Opt

Activeforeground option.

Specifies foreground color to use when drawing active elements. See above for definition of active elements.

Known uses:

func Activeimage added in v0.4.12

func Activeimage(val any) Opt

Activeimage option.

Specifies the name of the image to display in the item in its active state. This image must have been created previously with the image create command.

Known uses:

func Activeoutline added in v0.4.12

func Activeoutline(color any) Opt

Activeoutline option.

This option specifies the color that should be used to draw the outline of the item in its active state. Color may have any of the forms accepted by Tk_GetColor. If color is specified as an empty string then no outline is drawn for the item.

Known uses:

func Activeoutlinestipple added in v0.4.12

func Activeoutlinestipple(bitmap any) Opt

Activeoutlinestipple option.

This option specifies the stipple pattern that should be used to draw the outline of the item in its active state. Indicates that the outline for the item should be drawn with a stipple pattern; bitmap specifies the stipple pattern to use, in any of the forms accepted by Tk_GetBitmap. If the -outline option has not been specified then this option has no effect. If bitmap is an empty string (the default), then the outline is drawn in a solid fashion. Note that stipples are not well supported on platforms that do not use X11 as their drawing API.

Known uses:

func Activerelief added in v0.2.0

func Activerelief(val any) Opt

Activerelief option.

Specifies the 3-D effect desired for the active item of the widget. See the -relief option for details.

Known uses:

func Activestipple added in v0.4.12

func Activestipple(bitmap any) Opt

Activestipple option.

This option specifies the stipple patterns that should be used to fill the item in its active state. bitmap specifies the stipple pattern to use, in any of the forms accepted by Tk_GetBitmap. If the -fill option has not been specified then this option has no effect. If bitmap is an empty string (the default), then filling is done in a solid fashion. For the text item, it affects the actual text. Note that stipples are not well supported on platforms that do not use X11 as their drawing API.

Known uses:

func Activestyle added in v0.3.0

func Activestyle(val any) Opt

Activestyle option.

Known uses:

func Activewidth added in v0.4.12

func Activewidth(outlineWidth any) Opt

Activewidth option.

This option specifies the width of the outline to be drawn around the item's region, in its active state. outlineWidth may be in any of the forms described in the COORDINATES section above. If the -outline option has been specified as an empty string then this option has no effect. This option defaults to 1.0. For arcs, wide outlines will be drawn centered on the edges of the arc's region.

Known uses:

func After added in v0.4.10

func After(val any) Opt

After option.

Known uses:

  • Pack (command specific)

func Align added in v0.4.10

func Align(val any) Opt

Align option.

Known uses:

  • Text (widget specific, applies to embedded images)

func Anchor added in v0.2.0

func Anchor(val any) Opt

Anchor option.

Specifies how the information in a widget (e.g. text or a bitmap) is to be displayed in the widget. Must be one of the values n, ne, e, se, s, sw, w, nw, or center. For example, nw means display the information such that its top-left corner is at the top-left corner of the widget.

Known uses:

func Angle added in v0.4.10

func Angle(rotationDegrees any) Opt

Angle option.

RotationDegrees tells how many degrees to rotate the text anticlockwise about the positioning point for the text; it may have any floating-point value from 0.0 to 360.0. For example, if rotationDegrees is 90, then the text will be drawn vertically from bottom to top. This option defaults to 0.0.

Known uses:

func Arrowcolor added in v0.25.1

func Arrowcolor(val any) Opt

Arrowcolor — Styling widgets

Arrowcolor is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Arrowshape added in v0.4.10

func Arrowshape(a, b, c any) Opt

Arrowshape option.

This option indicates how to draw arrowheads. The shape argument must be a list with three elements, each specifying a distance in any of the forms described in the COORDINATES section above. The first element of the list gives the distance along the line from the neck of the arrowhead to its tip. The second element gives the distance along the line from the trailing points of the arrowhead to the tip, and the third element gives the distance from the outside edge of the line to the trailing points. If this option is not specified then Tk picks a “reasonable” shape.

Known uses:

func Arrowsize added in v0.25.1

func Arrowsize(val any) Opt

Arrowsize — Styling widgets

Arrowsize is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Aspect added in v0.3.0

func Aspect(val any) Opt

Aspect option.

Known uses:

func Autoseparators added in v0.3.0

func Autoseparators(val any) Opt

Autoseparators option.

Known uses:

  • Text (widget specific)

func Background added in v0.2.0

func Background(val any) Opt

Background option.

Specifies the normal background color to use when displaying the widget.

Known uses:

func Backgroundimage added in v0.3.0

func Backgroundimage(val any) Opt

Backgroundimage option.

Known uses:

func Backward added in v0.44.0

func Backward() Opt

Backward option.

Known uses:

  • Text (widget specific, applies to Search)

func Before added in v0.4.10

func Before(val any) Opt

Before option.

Known uses:

  • Pack (command specific)

func Bgstipple added in v0.4.10

func Bgstipple(val any) Opt

Bgstipple option.

Known uses:

func Bigincrement added in v0.3.0

func Bigincrement(val any) Opt

Bigincrement option.

Known uses:

  • Scale (widget specific)

func Bitmap added in v0.2.0

func Bitmap(val any) Opt

Bitmap option.

Specifies a bitmap to display in the widget, in any of the forms acceptable to Tk_GetBitmap. The exact way in which the bitmap is displayed may be affected by other options such as -anchor or -justify. Typically, if this option is specified then it overrides other options that specify a textual value to display in the widget but this is controlled by the -compound option; the -bitmap option may be reset to an empty string to re-enable a text display. In widgets that support both -bitmap and -image options, -image will usually override -bitmap.

Known uses:

func Blockcursor added in v0.3.0

func Blockcursor(val any) Opt

Blockcursor option.

Known uses:

  • Text (widget specific)

func Border added in v0.4.10

func Border(val any) Opt

Border option.

Known uses:

func Bordercolor added in v0.25.1

func Bordercolor(val any) Opt

Bordercolor — Styling widgets

Bordercolor is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Bordermode added in v0.4.10

func Bordermode(val any) Opt

Bordermode option.

Known uses:

  • Place (command specific)

func Borderwidth added in v0.2.0

func Borderwidth(val any) Opt

Borderwidth option.

Specifies a non-negative value indicating the width of the 3-D border to draw around the outside of the widget (if such a border is being drawn; the -relief option typically determines this). The value may also be used when drawing 3-D effects in the interior of the widget. The value may have any of the forms acceptable to Tk_GetPixels.

Known uses:

func Buttonbackground added in v0.3.0

func Buttonbackground(val any) Opt

Buttonbackground option.

Known uses:

func Buttoncursor added in v0.3.0

func Buttoncursor(val any) Opt

Buttoncursor option.

Known uses:

func Buttondownrelief added in v0.3.0

func Buttondownrelief(val any) Opt

Buttondownrelief option.

Known uses:

func Buttonuprelief added in v0.3.0

func Buttonuprelief(val any) Opt

Buttonuprelief option.

Known uses:

func Capstyle added in v0.4.10

func Capstyle(style any) Opt

Capstyle option.

Specifies the ways in which caps are to be drawn at the endpoints of the line. Style may have any of the forms accepted by Tk_GetCapStyle (butt, projecting, or round). If this option is not specified then it defaults to butt. Where arrowheads are drawn the cap style is ignored.

Known uses:

func Chars added in v0.48.0

func Chars() Opt

Chars option.

Known uses:

func Children added in v0.4.10

func Children(list ...any) Opt

Children option.

Known uses:

Children describes children of a style layout.

func Class added in v0.3.0

func Class(val any) Opt

Class option.

Specifies the window class. The class is used when querying the option database for the window's other options, to determine the default bindtags for the window, and to select the widget's default layout and style. This is a read-only option: it may only be specified when the window is created, and may not be changed with the configure widget command.

Known uses:

func Closeenough added in v0.3.0

func Closeenough(val any) Opt

Closeenough option.

Known uses:

func Colormap added in v0.3.0

func Colormap(val any) Opt

Colormap option.

Known uses:

func Column added in v0.4.10

func Column(val any) Opt

Column option.

Known uses:

  • Grid (command specific)

func Columnbreak added in v0.4.10

func Columnbreak(val any) Opt

Columnbreak option.

Known uses:

func Columns added in v0.3.0

func Columns(val any) Opt

Columns option.

Known uses:

func Columnseparatorwidth added in v0.25.1

func Columnseparatorwidth(val any) Opt

Columnseparatorwidth — Styling widgets

Columnseparatorwidth is a styling option of a ttk::treeview. More information might be available at the Tcl/Tk ttk_treeview page.

func Columnspan added in v0.4.10

func Columnspan(val any) Opt

Columnspan option.

Known uses:

  • Grid (command specific)

func Command added in v0.3.0

func Command(handler any) Opt

Command option.

See also Event handlers.

Known uses:

func Compound added in v0.2.0

func Compound(val any) Opt

Compound option.

Specifies if the widget should display text and bitmaps/images at the same time, and if so, where the bitmap/image should be placed relative to the text. Must be one of the values none, bottom, top, left, right, or center. For example, the (default) value none specifies that the bitmap or image should (if defined) be displayed instead of the text, the value left specifies that the bitmap or image should be displayed to the left of the text, and the value center specifies that the bitmap or image should be displayed on top of the text.

Known uses:

func Confine added in v0.3.0

func Confine(val any) Opt

Confine option.

Known uses:

func Confirmoverwrite added in v0.4.10

func Confirmoverwrite(val any) Opt

Confirmoverwrite option.

Known uses:

func Container added in v0.3.0

func Container(val any) Opt

Container option.

Known uses:

func Cursor added in v0.2.0

func Cursor(val any) Opt

Cursor option.

Specifies the mouse cursor to be used for the widget. The value may have any of the forms acceptable to Tk_GetCursor. In addition, if an empty string is specified, it indicates that the widget should defer to its parent for cursor specification.

Known uses:

func Darkcolor added in v0.25.1

func Darkcolor(val any) Opt

Darkcolor — Styling widgets

Darkcolor is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Dash added in v0.4.12

func Dash(pattern ...int) Opt

Dash option.

This option specifies the dash pattern for the normal state of an item. If the dash option is omitted then the default is a solid outline.

Many items support the notion of a dash pattern for outlines. The syntax is a list of integers. Each element represents the number of pixels of a line segment. Only the odd segments are drawn using the “outline” color. The other segments are drawn transparent.

Known uses:

func Dashoffset added in v0.4.10

func Dashoffset(offset any) Opt

Dashoffset option.

The starting offset in pixels into the pattern provided by the -dash option. -dashoffset is ignored if there is no -dash pattern.

Known uses:

func Data added in v0.4.10

func Data(val any) Opt

Data option.

Known uses:

func Default added in v0.3.0

func Default(val any) Opt

Default option.

Known uses:

func DefaultIcon added in v0.56.1

func DefaultIcon(val ...any) Opt

DefaultIcon option.

Known uses:

  • [IconPhoto] (command specific)

func Defaultextension added in v0.4.10

func Defaultextension(val any) Opt

Defaultextension option.

Known uses:

func Detail added in v0.4.10

func Detail(val any) Opt

Detail option.

Known uses:

func Digits added in v0.3.0

func Digits(val any) Opt

Digits option.

Known uses:

  • Scale (widget specific)

func Direction added in v0.3.0

func Direction(val any) Opt

Direction option.

Known uses:

func Disabledbackground added in v0.3.0

func Disabledbackground(val any) Opt

Disabledbackground option.

Known uses:

func Disabledbitmap added in v0.4.10

func Disabledbitmap(bitmap any) Opt

Disabledbitmap option.

This option specify the bitmap to display in the item in its disabled state. Bitmap may have any of the forms accepted by Tk_GetBitmap.

Known uses:

func Disableddash added in v0.4.10

func Disableddash(pattern ...int) Opt

Disableddash option.

This option specifies the dash pattern for the disabled state of an item. If the dash option is omitted then the default is a solid outline.

Many items support the notion of a dash pattern for outlines. The syntax is a list of integers. Each element represents the number of pixels of a line segment. Only the odd segments are drawn using the “outline” color. The other segments are drawn transparent.

Known uses:

func Disabledfill added in v0.4.10

func Disabledfill(color any) Opt

Disabledfill option.

This option specifies the color to be used to fill item's area in its disabled state. The even-odd fill rule is used. Color may have any of the forms accepted by Tk_GetColor. For the line item, it specifies the color of the line drawn. For the text item, it specifies the foreground color of the text. If color is an empty string (the default for all canvas items except line and text), then the item will not be filled.

Known uses:

func Disabledforeground added in v0.2.0

func Disabledforeground(val any) Opt

Disabledforeground option.

Specifies foreground color to use when drawing a disabled element. If the option is specified as an empty string (which is typically the case on monochrome displays), disabled elements are drawn with the normal foreground color but they are dimmed by drawing them with a stippled fill pattern.

Known uses:

func Disabledimage added in v0.4.10

func Disabledimage(val any) Opt

Disabledimage option.

Specifies the name of the image to display in the item in its disabled state. This image must have been created previously with the image create command.

Known uses:

func Disabledoutline added in v0.4.10

func Disabledoutline(color any) Opt

Disabledline option.

This option specifies the color that should be used to draw the outline of the item in its disabled state. Color may have any of the forms accepted by Tk_GetColor. If color is specified as an empty string then no outline is drawn for the item.

Known uses:

func Disabledoutlinestipple added in v0.4.10

func Disabledoutlinestipple(bitmap any) Opt

Disabledoutlinestipple option.

This option specifies the stipple pattern that should be used to draw the outline of the item in its disabled state. Indicates that the outline for the item should be drawn with a stipple pattern; bitmap specifies the stipple pattern to use, in any of the forms accepted by Tk_GetBitmap. If the -outline option has not been specified then this option has no effect. If bitmap is an empty string (the default), then the outline is drawn in a solid fashion. Note that stipples are not well supported on platforms that do not use X11 as their drawing API.

Known uses:

func Disabledstipple added in v0.4.10

func Disabledstipple(bitmap any) Opt

Disabledstipple option.

This option specifies the stipple patterns that should be used to fill the item in its disabled state. bitmap specifies the stipple pattern to use, in any of the forms accepted by Tk_GetBitmap. If the -fill option has not been specified then this option has no effect. If bitmap is an empty string (the default), then filling is done in a solid fashion. For the text item, it affects the actual text. Note that stipples are not well supported on platforms that do not use X11 as their drawing API.

Known uses:

func Disabledwidth added in v0.4.10

func Disabledwidth(outlineWidth any) Opt

Disabledwidth option.

This option specifies the width of the outline to be drawn around the item's region, in its disabled state. outlineWidth may be in any of the forms described in the COORDINATES section above. If the -outline option has been specified as an empty string then this option has no effect. This option defaults to 1.0. For arcs, wide outlines will be drawn centered on the edges of the arc's region.

Known uses:

func Displaychars added in v0.48.0

func Displaychars() Opt

Displaychars option.

Known uses:

func Displaycolumns added in v0.3.0

func Displaycolumns(val any) Opt

Displaycolumns option.

Known uses:

func Displayindices added in v0.48.0

func Displayindices() Opt

Displayindices option.

Known uses:

func Displaylines added in v0.48.0

func Displaylines() Opt

Displaylines option.

Known uses:

func Displayof added in v0.4.8

func Displayof(val any) Opt

Displayof option.

Known uses:

func Elementborderwidth added in v0.3.0

func Elementborderwidth(val any) Opt

Elementborderwidth option.

Known uses:

func Elide added in v0.4.10

func Elide(val any) Opt

Elide option.

Known uses:

func Endline added in v0.3.0

func Endline(val any) Opt

Endline option.

Known uses:

  • Text (widget specific)

func ExitHandler added in v0.5.18

func ExitHandler() Opt

ExitHandler returns a canned Command that destroys the App.

func Expand added in v0.4.10

func Expand(val any) Opt

Expand option.

Known uses:

  • Pack (command specific)

func Exportselection added in v0.2.0

func Exportselection(val any) Opt

Exportselection option.

Specifies whether or not a selection in the widget should also be the X selection. The value may have any of the forms accepted by Tcl_GetBoolean, such as true, false, 0, 1, yes, or no. If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection. The default is usually for widgets to export selections.

Known uses:

func Extent added in v0.4.10

func Extent(degrees any) Opt

Extent option.

Specifies the size of the angular range occupied by the arc. The arc's range extends for degrees degrees counter-clockwise from the starting angle given by the -start option. Degrees may be negative. If it is greater than 360 or less than -360, then degrees modulo 360 is used as the extent.

Known uses:

func Family added in v0.4.10

func Family(val any) Opt

Family option.

Known uses:

func Fgstipple added in v0.4.10

func Fgstipple(val any) Opt

Fgstipple option.

Known uses:

func Fieldbackground added in v0.25.1

func Fieldbackground(val any) Opt

Fieldbackground — Styling widgets

Fieldbackground is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func File added in v0.4.10

func File(val any) Opt

File option.

Known uses:

func Filetypes added in v0.4.10

func Filetypes(val any) Opt

Filetypes option.

Known uses:

func Fill added in v0.4.10

func Fill(val any) Opt

Fill option.

Known uses:

  • Pack (command specific)

func Focuscolor added in v0.29.0

func Focuscolor(val any) Opt

Focuscolor option.

Known uses:

func Focusfill added in v0.25.1

func Focusfill(val any) Opt

Focusfill — Styling widgets

Focusfill is a styling option of a ttk::combobox. More information might be available at the Tcl/Tk ttk_combobox page.

func Focussolid added in v0.29.0

func Focussolid(val any) Opt

Focussolid option.

Known uses:

func Focusthickness added in v0.29.0

func Focusthickness(val any) Opt

Focusthickness option.

Known uses:

func Font added in v0.2.0

func Font(list ...any) Opt

Font option.

Specifies the font to use when drawing text inside the widget. The value may have any of the forms described in the font manual page under FONT DESCRIPTION.

Known uses:

func Force added in v0.5.18

func Force(val any) Opt

Force option.

Known uses:

  • Focus (command specific)

func Foreground added in v0.2.0

func Foreground(val any) Opt

Foreground option.

Specifies the normal foreground color to use when displaying the widget.

Known uses:

func Format added in v0.3.0

func Format(val any) Opt

Format option.

Known uses:

func Forward added in v0.44.0

func Forward() Opt

Forward option.

Known uses:

  • Text (widget specific, applies to Search)

func From added in v0.3.0

func From(val ...any) Opt

From option.

Known uses:

func Gamma added in v0.4.10

func Gamma(val any) Opt

Gamma option.

Known uses:

func Global added in v0.56.1

func Global() Opt

Global option.

Known uses:

func Gripsize added in v0.25.1

func Gripsize(val any) Opt

Gripsize — Styling widgets

Gripsize is a styling option of a ttk::panedwindow and ttk::scrollbar. More information might be available at the Tcl/Tk ttk_panedwindow or Tcl/Tk ttk_scrollbar page.

func Groovewidth added in v0.25.1

func Groovewidth(val any) Opt

Groovewidth — Styling widgets

Groovewidth is a styling option of a ttk::scale. More information might be available at the Tcl/Tk ttk_scale page.

func Handlepad added in v0.3.0

func Handlepad(val any) Opt

Handlepad option.

Known uses:

func Handlesize added in v0.3.0

func Handlesize(val any) Opt

Handlesize option.

Known uses:

func Heading added in v0.49.0

func Heading(columnId string) Opt

Heading option.

Known uses:

func Height added in v0.3.0

func Height(val any) Opt

Height option.

Known uses:

func Hidemargin added in v0.4.10

func Hidemargin(val any) Opt

Hidemargin option.

Known uses:

func Highlightbackground added in v0.2.0

func Highlightbackground(val any) Opt

Highlightbackground option.

Specifies the color to display in the traversal highlight region when the widget does not have the input focus.

Known uses:

func Highlightcolor added in v0.2.0

func Highlightcolor(val any) Opt

Highlightcolor option.

Specifies the color to use for the traversal highlight rectangle that is drawn around the widget when it has the input focus.

Known uses:

func Highlightthickness added in v0.2.0

func Highlightthickness(val any) Opt

Highlightthickness option.

Specifies a non-negative value indicating the width of the highlight rectangle to draw around the outside of the widget when it has the input focus. The value may have any of the forms acceptable to Tk_GetPixels. If the value is zero, no focus highlight is drawn around the widget.

Known uses:

func Icon added in v0.4.10

func Icon(val any) Opt

Icon option.

Known uses:

func Id added in v0.4.10

func Id(val any) Opt

Id option.

Known uses:

More information might be available at the Tcl/Tk treeview page.

func Image added in v0.2.0

func Image(val any) Opt

Image option.

Specifies an image to display in the widget, which must have been created with the image create command. Typically, if the -image option is specified then it overrides other options that specify a bitmap or textual value to display in the widget, though this is controlled by the -compound option; the -image option may be reset to an empty string to re-enable a bitmap or text display.

Known uses:

func In added in v0.4.10

func In(val any) Opt

In option.

Known uses:

  • Grid (command specific)
  • Pack (command specific)
  • Place (command specific)

func Inactiveselectbackground added in v0.3.0

func Inactiveselectbackground(val any) Opt

Inactiveselectbackground option.

Known uses:

  • Text (widget specific)

func Increment added in v0.3.0

func Increment(val any) Opt

Increment option.

Known uses:

func Indent added in v0.25.1

func Indent(val any) Opt

Indent — Styling widgets

Indent is a styling option of a ttk::treeview. More information might be available at the Tcl/Tk ttk_treeview page.

func Index added in v0.49.0

func Index(index any) Opt

Index option.

Known uses:

func Indicatorbackground added in v0.25.1

func Indicatorbackground(val any) Opt

Indicatorbackground — Styling widgets

Indicatorbackground is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Indicatorcolor added in v0.25.1

func Indicatorcolor(val any) Opt

Indicatorcolor — Styling widgets

Indicatorcolor is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Indicatormargin added in v0.25.1

func Indicatormargin(val any) Opt

Indicatormargin — Styling widgets

Indicatormargin is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Indicatormargins added in v0.25.1

func Indicatormargins(val any) Opt

Indicatormargins — Styling widgets

Indicatormargins is a styling option of a ttk::treeview. More information might be available at the Tcl/Tk ttk_treeview page.

func Indicatoron added in v0.3.0

func Indicatoron(val any) Opt

Indicatoron option.

Known uses:

func Indicatorrelief added in v0.25.1

func Indicatorrelief(val any) Opt

Indicatorrelief — Styling widgets

Indicatorrelief is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Indicatorsize added in v0.25.1

func Indicatorsize(val any) Opt

Indicatorsize — Styling widgets

Indicatorsize is a styling option of a ttk::treeview. More information might be available at the Tcl/Tk ttk_treeview page.

func Indices added in v0.48.0

func Indices() Opt

Indices option.

Known uses:

func Info added in v0.49.0

func Info(info string) Opt

Info option.

Known uses:

func Initialcolor added in v0.4.10

func Initialcolor(val any) Opt

Initialcolor option.

Known uses:

func Initialdir added in v0.4.10

func Initialdir(val any) Opt

Initialdir option.

Known uses:

func Initialfile added in v0.4.10

func Initialfile(val any) Opt

Initialfile option.

Known uses:

func Insertbackground added in v0.2.0

func Insertbackground(val any) Opt

Insertbackground option.

Specifies the color to use as background in the area covered by the insertion cursor. This color will normally override either the normal background for the widget (or the selection background if the insertion cursor happens to fall in the selection).

Known uses:

func Insertborderwidth added in v0.2.0

func Insertborderwidth(val any) Opt

Insertborderwidth option.

Specifies a non-negative value indicating the width of the 3-D border to draw around the insertion cursor. The value may have any of the forms acceptable to Tk_GetPixels.

Known uses:

func Insertcolor added in v0.25.1

func Insertcolor(val any) Opt

Insertcolor — Styling widgets

Insertcolor is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Insertofftime added in v0.2.0

func Insertofftime(val any) Opt

Insertofftime option.

Specifies a non-negative integer value indicating the number of milliseconds the insertion cursor should remain in each blink cycle. If this option is zero then the cursor does not blink: it is on all the time.

Known uses:

func Insertontime added in v0.2.0

func Insertontime(val any) Opt

Insertontime option.

Specifies a non-negative integer value indicating the number of milliseconds the insertion cursor should remain in each blink cycle.

Known uses:

func Insertunfocussed added in v0.3.0

func Insertunfocussed(val any) Opt

Insertunfocussed option.

Known uses:

  • Text (widget specific)

func Insertwidth added in v0.2.0

func Insertwidth(val any) Opt

Insertwidth option.

Specifies a non-negative value indicating the total width of the insertion cursor. The value may have any of the forms acceptable to Tk_GetPixels. If a border has been specified for the insertion cursor (using the -insertborderwidth option), the border will be drawn inside the width specified by the -insertwidth option.

Known uses:

func Invalidcommand added in v0.3.0

func Invalidcommand(handler any) Opt

Invalidcommand option.

See also Event handlers.

Known uses:

func Ipadx added in v0.4.10

func Ipadx(val any) Opt

Ipadx option.

Known uses:

  • Grid (command specific)
  • Pack (command specific)

func Ipady added in v0.4.10

func Ipady(val any) Opt

Ipady option.

Known uses:

  • Grid (command specific)
  • Pack (command specific)

func ItemWindow added in v0.62.0

func ItemWindow(w *Window) Opt

ItemWindow option.

Specifies the window to associate with this item. The window specified by pathName must either be a child of the canvas widget or a child of some ancestor of the canvas widget. PathName may not refer to a top-level window.

Known uses:

func Items added in v0.49.0

func Items(items ...any) Opt

Items option.

Known uses:

func Joinstyle added in v0.4.10

func Joinstyle(style any) Opt

Joinstyle option.

Specifies the ways in which joints are to be drawn at the vertices of the line. Style may have any of the forms accepted by Tk_GetJoinStyle (bevel, miter, or round). If this option is not specified then it defaults to round. If the line only contains two points then this option is irrelevant.

Known uses:

func Jump added in v0.2.0

func Jump(val any) Opt

Jump option.

For widgets with a slider that can be dragged to adjust a value, such as scrollbars, this option determines when notifications are made about changes in the value. The option's value must be a boolean of the form accepted by Tcl_GetBoolean. If the value is false, updates are made continuously as the slider is dragged. If the value is true, updates are delayed until the mouse button is released to end the drag; at that point a single notification is made (the value rather than changing smoothly).

Known uses:

func Justify added in v0.2.0

func Justify(val any) Opt

Justify option.

When there are multiple lines of text displayed in a widget, this option determines how the lines line up with each other. Must be one of left, center, or right. Left means that the lines' left edges all line up, center means that the lines' centers are aligned, and right means that the lines' right edges line up.

Known uses:

func Labelanchor added in v0.3.0

func Labelanchor(val any) Opt

Labelanchor option.

Known uses:

func Labelmargins added in v0.25.1

func Labelmargins(val any) Opt

Labelmargins — Styling widgets

Labelmargins is a styling option of a ttk::labelframe. More information might be available at the Tcl/Tk ttk_labelframe page.

func Labeloutside added in v0.25.1

func Labeloutside(val any) Opt

Labeloutside — Styling widgets

Labeloutside is a styling option of a ttk::labelframe. More information might be available at the Tcl/Tk ttk_labelframe page.

func Labelwidget added in v0.3.0

func Labelwidget(val any) Opt

Labelwidget option.

Known uses:

func Lastfor added in v0.5.18

func Lastfor(val any) Opt

Lastfor option.

Known uses:

  • Focus (command specific)

func Lbl added in v0.3.0

func Lbl(val any) Opt

Lbl option.

Known uses:

func Length added in v0.3.0

func Length(val any) Opt

Length option.

Known uses:

func Lightcolor added in v0.25.1

func Lightcolor(val any) Opt

Lightcolor — Styling widgets

Lightcolor is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Linearrow added in v0.62.0

func Linearrow(where any) Opt

Linearrow option.

Indicates whether or not arrowheads are to be drawn at one or both ends of the line. Where must have one of the values none (for no arrowheads), first (for an arrowhead at the first point of the line), last (for an arrowhead at the last point of the line), or both (for arrowheads at both ends). This option defaults to none. When requested to draw an arrowhead, Tk internally adjusts the corresponding line end point so that the rendered line ends at the neck of the arrowhead rather than at its tip so that the line doesn't extend past the edge of the arrowhead. This may trigger a Leave event if the mouse is hovering this line end. Conversely, when removing an arrowhead Tk adjusts the corresponding line point the other way round, which may trigger an Enter event.

Known uses:

func Lines added in v0.48.0

func Lines() Opt

Lines option.

Known uses:

func Listvariable added in v0.3.0

func Listvariable(val any) Opt

Listvariable option.

Known uses:

func Lmargin1 added in v0.4.10

func Lmargin1(val any) Opt

Lmargin1 option.

Known uses:

func Lmargin2 added in v0.4.10

func Lmargin2(val any) Opt

Lmargin2 option.

Known uses:

func Lmargincolor added in v0.4.10

func Lmargincolor(val any) Opt

Lmargincolor option.

Known uses:

func Maskdata added in v0.4.10

func Maskdata(val any) Opt

Maskdata option.

Known uses:

func Maskfile added in v0.4.10

func Maskfile(val any) Opt

Maskfile option.

Known uses:

func Maximum added in v0.3.0

func Maximum(val any) Opt

Maximum option.

Known uses:

func Maxphase added in v0.25.1

func Maxphase(val any) Opt

Maxphase — Styling widgets

Maxphase is a styling option of a ttk::progressbar. More information might be available at the Tcl/Tk ttk_progressbar page.

func Maxundo added in v0.3.0

func Maxundo(val any) Opt

Maxundo option.

Known uses:

  • Text (widget specific)

func Metadata added in v0.4.10

func Metadata(val any) Opt

Metadata option.

Known uses:

func Minsize added in v0.4.10

func Minsize(val ...any) Opt

Minsize option.

Known uses:

func Mnu added in v0.3.0

func Mnu(val any) Opt

Mnu option.

Known uses:

func Mode added in v0.3.0

func Mode(val any) Opt

Mode option.

Known uses:

func Msg added in v0.4.10

func Msg(val any) Opt

Msg option.

Known uses:

func Multiple added in v0.4.10

func Multiple(val any) Opt

Multiple option.

Known uses:

func Mustexist added in v0.4.10

func Mustexist(val any) Opt

Mustexist option.

Known uses:

func Nice added in v0.4.8

func Nice(val any) Opt

Nice option.

Known uses:

  • Bell (command specific)

func Nocase added in v0.4.10

func Nocase() Opt

Nocase option.

Known uses:

  • Text (widget specific, applies to Search)

func Offrelief added in v0.3.0

func Offrelief(val any) Opt

Offrelief option.

Known uses:

func Offset added in v0.4.10

func Offset(val any) Opt

Offset option.

Known uses:

func Offvalue added in v0.3.0

func Offvalue(val any) Opt

Offvalue option.

Known uses:

func Onvalue added in v0.3.0

func Onvalue(val any) Opt

Onvalue option.

Known uses:

func Opaqueresize added in v0.3.0

func Opaqueresize(val any) Opt

Opaqueresize option.

Known uses:

func Open added in v0.53.0

func Open(val bool) Opt

Open option.

Known uses:

More information might be available at the Tcl/Tk treeview page.

func Orient added in v0.2.0

func Orient(val any) Opt

Orient option.

For widgets that can lay themselves out with either a horizontal or vertical orientation, such as scrollbars, this option specifies which orientation should be used. Must be either horizontal or vertical or an abbreviation of one of these.

Known uses:

func Outline added in v0.4.12

func Outline(color any) Opt

Outline option.

This option specifies the color that should be used to draw the outline of the item in its normal state. Color may have any of the forms accepted by Tk_GetColor. If color is specified as an empty string then no outline is drawn for the item.

Known uses:

func Outlineoffset added in v0.4.10

func Outlineoffset(offset any) Opt

Outlineoffset option.

Specifies the offset of the stipple pattern used for outlines, in the same way that the -outline option controls fill stipples. (See the -outline option for a description of the syntax of offset.)

Known uses:

func Outlinestipple added in v0.4.12

func Outlinestipple(bitmap any) Opt

Outlinestipple option.

This option specifies the stipple pattern that should be used to draw the outline of the item in its normal state. Indicates that the outline for the item should be drawn with a stipple pattern; bitmap specifies the stipple pattern to use, in any of the forms accepted by Tk_GetBitmap. If the -outline option has not been specified then this option has no effect. If bitmap is an empty string (the default), then the outline is drawn in a solid fashion. Note that stipples are not well supported on platforms that do not use X11 as their drawing API.

Known uses:

func Overrelief added in v0.3.0

func Overrelief(val any) Opt

Overrelief option.

Known uses:

func Overstrike added in v0.4.10

func Overstrike(val any) Opt

Overstrike option.

Known uses:

func Overstrikefg added in v0.4.10

func Overstrikefg(val any) Opt

Overstrikefg option.

Known uses:

func Pad added in v0.56.0

func Pad(val any) Opt

Pad option.

The -pad option specifies the number of screen units that will be added to the largest window contained completely in that column/row when the grid geometry manager requests a size from the containing window.

Known uses:

func Padding added in v0.3.0

func Padding(val any) Opt

Padding option.

Specifies the internal padding for the widget. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget.

Known uses:

func Padx added in v0.2.0

func Padx(val any) Opt

Padx option.

Specifies a non-negative value indicating how much extra space to request for the widget in the X-direction. The value may have any of the forms acceptable to Tk_GetPixels. When computing how large a window it needs, the widget will add this amount to the width it would normally need (as determined by the width of the things displayed in the widget); if the geometry manager can satisfy this request, the widget will end up with extra internal space to the left and/or right of what it displays inside. Most widgets only use this option for padding text: if they are displaying a bitmap or image, then they usually ignore padding options.

Known uses:

func Pady added in v0.2.0

func Pady(val any) Opt

Pady option.

Specifies a non-negative value indicating how much extra space to request for the widget in the Y-direction. The value may have any of the forms acceptable to Tk_GetPixels. When computing how large a window it needs, the widget will add this amount to the height it would normally need (as determined by the height of the things displayed in the widget); if the geometry manager can satisfy this request, the widget will end up with extra internal space above and/or below what it displays inside. Most widgets only use this option for padding text: if they are displaying a bitmap or image, then they usually ignore padding options.

Known uses:

func Palette added in v0.4.10

func Palette(val any) Opt

Palette option.

Known uses:

func Parent added in v0.4.10

func Parent(val any) Opt

Parent option.

Known uses:

func Period added in v0.25.1

func Period(val any) Opt

Period — Styling widgets

Period is a styling option of a ttk::progressbar. More information might be available at the Tcl/Tk ttk_progressbar page.

func Phase added in v0.3.0

func Phase(val any) Opt

Phase option.

Known uses:

func Placeholder added in v0.2.0

func Placeholder(val any) Opt

Placeholder option.

Specifies a help text string to display if no text is otherwise displayed, that is when the widget is empty. The placeholder text is displayed using the values of the -font and -justify options.

Known uses:

func Placeholderforeground added in v0.2.0

func Placeholderforeground(val any) Opt

Placeholderforeground option.

Specifies the foreground color to use when the placeholder text is displayed. The default color is platform-specific.

Known uses:

func Postcommand added in v0.3.0

func Postcommand(handler any) Opt

Postcommand option.

See also Event handlers.

Known uses:

func Postoffset added in v0.25.1

func Postoffset(val any) Opt

Postoffset — Styling widgets

Postoffset is a styling option of a ttk::combobox. More information might be available at the Tcl/Tk ttk_combobox page.

func Proxybackground added in v0.3.0

func Proxybackground(val any) Opt

Proxybackground option.

Known uses:

func Proxyborderwidth added in v0.3.0

func Proxyborderwidth(val any) Opt

Proxyborderwidth option.

Known uses:

func Proxyrelief added in v0.3.0

func Proxyrelief(val any) Opt

Proxyrelief option.

Known uses:

func Readonlybackground added in v0.3.0

func Readonlybackground(val any) Opt

Readonlybackground option.

Known uses:

func Regexp added in v0.4.10

func Regexp() Opt

Regexp option.

Known uses:

  • Text (widget specific, applies to Search)

func Relheight added in v0.4.10

func Relheight(val any) Opt

Relheight option.

Known uses:

  • Place (command specific)

func Relief added in v0.2.0

func Relief(val any) Opt

Relief option.

Specifies the 3-D effect desired for the widget. Acceptable values are raised, sunken, flat, ridge, solid, and groove. The value indicates how the interior of the widget should appear relative to its exterior; for example, raised means the interior of the widget should appear to protrude from the screen, relative to the exterior of the widget.

Known uses:

func Relwidth added in v0.4.10

func Relwidth(val any) Opt

Relwidth option.

Known uses:

  • Place (command specific)

func Relx added in v0.4.10

func Relx(val any) Opt

Relx option.

Known uses:

  • Place (command specific)

func Rely added in v0.4.10

func Rely(val any) Opt

Rely option.

Known uses:

  • Place (command specific)

func Repeatdelay added in v0.2.0

func Repeatdelay(val any) Opt

Repeatdelay option.

Specifies the number of milliseconds a button or key must be held down before it begins to auto-repeat. Used, for example, on the up- and down-arrows in scrollbars.

Known uses:

func Repeatinterval added in v0.2.0

func Repeatinterval(val any) Opt

Repeatinterval option.

Used in conjunction with -repeatdelay: once auto-repeat begins, this option determines the number of milliseconds between auto-repeats.

Known uses:

func Resolution added in v0.3.0

func Resolution(val any) Opt

Resolution option.

Known uses:

  • Scale (widget specific)

func Rmargin added in v0.4.10

func Rmargin(val any) Opt

Rmargin option.

Known uses:

func Rmargincolor added in v0.4.10

func Rmargincolor(val any) Opt

Rmargincolor option.

Known uses:

func Row added in v0.4.10

func Row(val any) Opt

Row option.

Known uses:

  • Grid (command specific)

func Rowheight added in v0.25.1

func Rowheight(val any) Opt

Rowheight — Styling widgets

Rowheight is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Rowspan added in v0.4.10

func Rowspan(val any) Opt

Rowspan option.

Known uses:

  • Grid (command specific)

func Sashcursor added in v0.3.0

func Sashcursor(val any) Opt

Sashcursor option.

Known uses:

func Sashpad added in v0.3.0

func Sashpad(val any) Opt

Sashpad option.

Known uses:

func Sashrelief added in v0.3.0

func Sashrelief(val any) Opt

Sashrelief option.

Known uses:

func Sashthickness added in v0.25.1

func Sashthickness(val any) Opt

Sashthickness — Styling widgets

Sashthickness is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Sashwidth added in v0.3.0

func Sashwidth(val any) Opt

Sashwidth option.

Known uses:

func Screen added in v0.3.0

func Screen(val any) Opt

Screen option.

Known uses:

func Scrollregion added in v0.3.0

func Scrollregion(val any) Opt

Scrollregion option.

Known uses:

func Selectbackground added in v0.2.0

func Selectbackground(val any) Opt

Selectbackground option.

Specifies the background color to use when displaying selected items.

Known uses:

func Selectborderwidth added in v0.2.0

func Selectborderwidth(val any) Opt

Selectborderwidth option.

Specifies a non-negative value indicating the width of the 3-D border to draw around selected items. The value may have any of the forms acceptable to Tk_GetPixels.

Known uses:

func Selectcolor added in v0.3.0

func Selectcolor(val any) Opt

Selectcolor option.

Known uses:

func Selectforeground added in v0.2.0

func Selectforeground(val any) Opt

Selectforeground option.

Specifies the foreground color to use when displaying selected items.

Known uses:

func Selectimage added in v0.3.0

func Selectimage(val any) Opt

Selectimage option.

Known uses:

func Selectmode added in v0.3.0

func Selectmode(val any) Opt

Selectmode option.

Known uses:

func Selecttype added in v0.3.0

func Selecttype(val any) Opt

Selecttype option.

Known uses:

func Setgrid added in v0.2.0

func Setgrid(val any) Opt

Setgrid option.

Specifies a boolean value that determines whether this widget controls the resizing grid for its top-level window. This option is typically used in text widgets, where the information in the widget has a natural size (the size of a character) and it makes sense for the window's dimensions to be integral numbers of these units. These natural window sizes form a grid. If the -setgrid option is set to true then the widget will communicate with the window manager so that when the user interactively resizes the top-level window that contains the widget, the dimensions of the window will be displayed to the user in grid units and the window size will be constrained to integral numbers of grid units. See the section GRIDDED GEOMETRY MANAGEMENT in the wm manual entry for more details.

Known uses:

func Shiftrelief added in v0.25.1

func Shiftrelief(val any) Opt

TButton — Widget that issues a command when pressed

Description

Shiftrelief specifies how far the button contents are shifted down and right in the pressed state. This action provides additional skeuomorphic feedback.

func Show added in v0.3.0

func Show(val any) Opt

Show option.

Known uses:

func Showhandle added in v0.3.0

func Showhandle(val any) Opt

Showhandle option.

Known uses:

func Showvalue added in v0.3.0

func Showvalue(val any) Opt

Showvalue option.

Known uses:

  • Scale (widget specific)

func Side added in v0.4.10

func Side(val any) Opt

Side option.

Known uses:

  • Pack (command specific)

func Size added in v0.4.10

func Size(val any) Opt

Size option.

Known uses:

func Slant added in v0.4.10

func Slant(val any) Opt

Slant option.

Known uses:

func Sliderlength added in v0.3.0

func Sliderlength(val any) Opt

Sliderlength option.

Known uses:

  • Scale (widget specific)

func Sliderrelief added in v0.3.0

func Sliderrelief(val any) Opt

Sliderrelief option.

Known uses:

  • Scale (widget specific)

func Sliderwidth added in v0.25.1

func Sliderwidth(val any) Opt

Sliderwidth — Styling widgets

Sliderwidth is a styling option of a ttk::scale. More information might be available at the Tcl/Tk ttk_scale page.

func Smooth added in v0.4.10

func Smooth(smoothMethod any) Opt

Smooth option.

smoothMethod must have one of the forms accepted by Tcl_GetBoolean or a line smoothing method. Only true and raw are supported in the core (with bezier being an alias for true), but more can be added at runtime. If a boolean false value or empty string is given, no smoothing is applied. A boolean truth value assumes true smoothing. If the smoothing method is true, this indicates that the line should be drawn as a curve, rendered as a set of quadratic splines: one spline is drawn for the first and second line segments, one for the second and third, and so on. Straight-line segments can be generated within a curve by duplicating the end-points of the desired line segment. If the smoothing method is raw, this indicates that the line should also be drawn as a curve but where the list of coordinates is such that the first coordinate pair (and every third coordinate pair thereafter) is a knot point on a cubic Bezier curve, and the other coordinates are control points on the cubic Bezier curve. Straight line segments can be generated within a curve by making control points equal to their neighbouring knot points. If the last point is a control point and not a knot point, the point is repeated (one or two times) so that it also becomes a knot point.

Known uses:

func Spacing1 added in v0.3.0

func Spacing1(val any) Opt

Spacing1 option.

Known uses:

func Spacing2 added in v0.3.0

func Spacing2(val any) Opt

Spacing2 option.

Known uses:

func Spacing3 added in v0.3.0

func Spacing3(val any) Opt

Spacing3 option.

Known uses:

func Splinesteps added in v0.4.10

func Splinesteps(number any) Opt

Splinesteps option.

Specifies the degree of smoothness desired for curves: each spline will be approximated with number line segments. This option is ignored unless the -smooth option is true or raw.

Known uses:

func Start added in v0.4.10

func Start(degrees any) Opt

Start option.

Specifies the beginning of the angular range occupied by the arc. Degrees is given in units of degrees measured counter-clockwise from the 3-o'clock position; it may be either positive or negative.

Known uses:

func Startline added in v0.3.0

func Startline(val any) Opt

Startline option.

Known uses:

  • Text (widget specific)

func State added in v0.3.0

func State(val any) Opt

State option.

May be set to normal or disabled to control the disabled state bit. This is a write-only option: setting it changes the widget state, but the state widget command does not affect the -state option.

Known uses:

func Sticky added in v0.3.0

func Sticky(val any) Opt

Sticky option.

Known uses:

  • Grid (command specific)

func Stipple added in v0.4.12

func Stipple(bitmap any) Opt

Stipple option.

This option specifies the stipple patterns that should be used to fill the item in its normal state. bitmap specifies the stipple pattern to use, in any of the forms accepted by Tk_GetBitmap. If the -fill option has not been specified then this option has no effect. If bitmap is an empty string (the default), then filling is done in a solid fashion. For the text item, it affects the actual text. Note that stipples are not well supported on platforms that do not use X11 as their drawing API.

Known uses:

func Stretch added in v0.4.10

func Stretch(when string) Opt

Stretch option.

Description

Controls how extra space is allocated to each of the panes. When is one of always, first, last, middle, and never. The panedwindow will calculate the required size of all its panes. Any remaining (or deficit) space will be distributed to those panes marked for stretching. The space will be distributed based on each panes current ratio of the whole. The when values have the following definition:

  • always: This pane will always stretch.
  • first: Only if this pane is the first pane (left-most or top-most) will it stretch.
  • last: Only if this pane is the last pane (right-most or bottom-most) will it stretch. This is the default value.
  • middle: Only if this pane is not the first or last pane will it stretch.
  • never: This pane will never stretch.

Known uses:

func Striped added in v0.3.0

func Striped(val any) Opt

Striped option.

Known uses:

func Stripedbackground added in v0.25.1

func Stripedbackground(val any) Opt

Stripedbackground — Styling widgets

Stripedbackground is a styling option of a ttk::treeview. More information might be available at the Tcl/Tk ttk_treeview page.

func Style added in v0.4.10

func Style(val any) Opt

Style option.

May be used to specify a custom widget style.

Known uses:

func Tab added in v0.49.0

func Tab(tabId any) Opt

Tab option.

Known uses:

func Tabmargins added in v0.25.1

func Tabmargins(val any) Opt

Tabmargins — Styling widgets

Tabmargins is a styling option of a ttk::notebook. More information might be available at the Tcl/Tk ttk_notebook page.

func Tabposition added in v0.25.1

func Tabposition(val any) Opt

Tabposition — Styling widgets

Tabposition is a styling option of a ttk::notebook.

More information might be available at the Tcl/Tk ttk_notebook page.

func Tabs added in v0.3.0

func Tabs(val any) Opt

Tabs option.

Known uses:

func Tabstyle added in v0.3.0

func Tabstyle(val any) Opt

Tabstyle option.

Known uses:

func Tag added in v0.4.10

func Tag(name string) Opt

Tag option.

Known uses:

func Tags added in v0.4.10

func Tags(tagList ...string) Opt

Tags option.

Specifies a set of tags to apply to the item. TagList consists of a list of tag names, which replace any existing tags for the item. TagList may be an empty list.

Known uses:

func Takefocus added in v0.2.0

func Takefocus(val any) Opt

Takefocus option.

Determines whether the window accepts the focus during keyboard traversal (e.g., Tab and Shift-Tab). Before setting the focus to a window, the traversal scripts consult the value of the -takefocus option. A value of 0 means that the window should be skipped entirely during keyboard traversal. 1 means that the window should receive the input focus as long as it is viewable (it and all of its ancestors are mapped). An empty value for the option means that the traversal scripts make the decision about whether or not to focus on the window: the current algorithm is to skip the window if it is disabled, if it has no key bindings, or if it is not viewable. If the value has any other form, then the traversal scripts take the value, append the name of the window to it (with a separator space), and evaluate the resulting string as a Tcl script. The script must return 0, 1, or an empty string: a 0 or 1 value specifies whether the window will receive the input focus, and an empty string results in the default decision described above. Note that this interpretation of the option is defined entirely by the Tcl scripts that implement traversal: the widget implementations ignore the option entirely, so you can change its meaning if you redefine the keyboard traversal scripts.

Known uses:

func Tearoff added in v0.3.0

func Tearoff(val any) Opt

Tearoff option.

Known uses:

  • Menu (widget specific)

func Tearoffcommand added in v0.3.0

func Tearoffcommand(handler any) Opt

Tearoffcommand option.

See also Event handlers.

Known uses:

  • Menu (widget specific)

func Textvariable added in v0.2.0

func Textvariable(s string) Opt

Textvariable option.

Specifies the value to be displayed inside the widget. The way in which the string is displayed in the widget depends on the particular widget and may be determined by other options, such as -anchor or -justify.

Known uses:

func Tickinterval added in v0.3.0

func Tickinterval(val any) Opt

Tickinterval option.

Known uses:

  • Scale (widget specific)

func Tile added in v0.3.0

func Tile(val any) Opt

Tile option.

Known uses:

func Title added in v0.3.0

func Title(val any) Opt

Title option.

Known uses:

func Titlecolumns added in v0.3.0

func Titlecolumns(val any) Opt

Titlecolumns option.

Known uses:

func Titleitems added in v0.3.0

func Titleitems(val any) Opt

Titleitems option.

Known uses:

func To added in v0.3.0

func To(val ...any) Opt

To option.

Known uses:

func Topmost added in v0.4.10

func Topmost(v bool) Opt

Topmost option.

Known uses:

func Tristateimage added in v0.3.0

func Tristateimage(val any) Opt

Tristateimage option.

Known uses:

func Tristatevalue added in v0.3.0

func Tristatevalue(val any) Opt

Tristatevalue option.

Known uses:

func Troughcolor added in v0.2.0

func Troughcolor(val any) Opt

Troughcolor option.

Specifies the color to use for the rectangular trough areas in widgets such as scrollbars and scales. This option is ignored for scrollbars on Windows (native widget does not recognize this option).

Known uses:

func Troughrelief added in v0.25.1

func Troughrelief(val any) Opt

Troughrelief — Styling widgets

Troughrelief is a styling option of one or more widgets. Please see Changing Widget Colors for details.

func Txt added in v0.2.0

func Txt(val any) Opt

Txt option.

Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as -anchor or -justify.

Known uses:

func Type added in v0.3.0

func Type(val any) Opt

Type option.

Known uses:

func Underline added in v0.2.0

func Underline(val any) Opt

Underline option.

Specifies the integer index of a character to underline in the widget. This option is used by the default bindings to implement keyboard traversal for menu buttons and menu entries. 0 corresponds to the first character of the text displayed in the widget, 1 to the next character, and so on. end corresponds to the last character, end-1 to the before last character, and so on.

Known uses:

func Underlinefg added in v0.4.10

func Underlinefg(val any) Opt

Underlinefg option.

Known uses:

func Undo added in v0.3.0

func Undo(val any) Opt

Undo option.

Known uses:

  • Text (widget specific)

func Use added in v0.3.0

func Use(val any) Opt

Use option.

Known uses:

func Validate added in v0.3.0

func Validate(val any) Opt

Validate option.

Known uses:

func Validatecommand added in v0.3.0

func Validatecommand(handler any) Opt

Validatecommand option.

See also Event handlers.

Known uses:

func Value added in v0.3.0

func Value(val any) Opt

Value option.

Known uses:

func Values added in v0.3.0

func Values(val any) Opt

Values option.

Known uses:

func Visual added in v0.3.0

func Visual(val any) Opt

Visual option.

Known uses:

func Weight added in v0.3.0

func Weight(val any) Opt

Weight option.

Known uses:

func Width added in v0.3.0

func Width(val any) Opt

Width option.

If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. Note that some themes may specify a non-zero -width in the style.

Known uses:

func Win added in v0.36.0

func Win(val any) Opt

Win option.

Known uses:

  • Text (widget specific, applies to embedded windows)

func Wrap added in v0.3.0

func Wrap(val any) Opt

Wrap option.

Known uses:

func Wraplength added in v0.2.0

func Wraplength(val any) Opt

Wraplength option.

For widgets that can perform word-wrapping, this option specifies the maximum line length. Lines that would exceed this length are wrapped onto the next line, so that no line is longer than the specified length. The value may be specified in any of the standard forms for screen distances. If this value is negative or zero then no wrapping is done: lines will break only at newline characters in the text.

Known uses:

func X added in v0.4.10

func X(val any) Opt

X option.

Known uses:

  • Place (command specific)

func Xpixels added in v0.48.0

func Xpixels() Opt

Xpixels option.

Known uses:

func Xscrollcommand added in v0.2.0

func Xscrollcommand(handler any) Opt

Xscrollcommand option.

See also Event handlers.

Specifies the prefix for a command used to communicate with horizontal scrollbars. When the view in the widget's window changes (or whenever anything else occurs that could change the display in a scrollbar, such as a change in the total size of the widget's contents), the widget will generate a Tcl command by concatenating the scroll command and two numbers. Each of the numbers is a fraction between 0 and 1, which indicates a position in the document. 0 indicates the beginning of the document, 1 indicates the end, .333 indicates a position one third the way through the document, and so on. The first fraction indicates the first information in the document that is visible in the window, and the second fraction indicates the information just after the last portion that is visible. The command is then passed to the Tcl interpreter for execution. Typically the -xscrollcommand option consists of the path name of a scrollbar widget followed by e.g. this will cause the scrollbar to be updated whenever the view in the window changes. If this option is not specified, then no command will be executed.

Known uses:

func Xscrollincrement added in v0.3.0

func Xscrollincrement(val any) Opt

Xscrollincrement option.

Known uses:

func Y added in v0.4.10

func Y(val any) Opt

Y option.

Known uses:

  • Place (command specific)

func Ypixels added in v0.48.0

func Ypixels() Opt

Ypixels option.

Known uses:

func Yscrollcommand added in v0.2.0

func Yscrollcommand(handler any) Opt

Yscrollcommand option.

See also Event handlers.

Specifies the prefix for a command used to communicate with vertical scrollbars. This option is treated in the same way as the -xscrollcommand option, except that it is used for vertical scrollbars and is provided by widgets that support vertical scrolling. See the description of -xscrollcommand for details on how this option is used.

Known uses:

func Yscrollincrement added in v0.3.0

func Yscrollincrement(val any) Opt

Yscrollincrement option.

Known uses:

type OptionMenuWidget added in v0.53.0

type OptionMenuWidget struct {
	*Window
	// contains filtered or unexported fields
}

OptionMenuWidget represents the Tcl/Tk option menu.

More information might be available at the Tcl/Tk option menu page.

func OptionMenu added in v0.2.0

func OptionMenu(varName *VariableOpt, options ...any) (r *OptionMenuWidget)

tk_optionMenu — Create an option menubutton and its menu

Description

This procedure creates an option menubutton whose name is pathName, plus an associated menu. Together they allow the user to select one of the values given by the value arguments. The current value will be stored in the global variable whose name is given by varName and it will also be displayed as the label in the option menubutton. The user can click on the menubutton to display a menu containing all of the values and thereby select a new value. Once a new value is selected, it will be stored in the variable and appear in the option menubutton. The current value can also be changed by setting the variable.

The return value from tk_optionMenu is the name of the menu associated with pathName, so that the caller can change its configuration options or manipulate it in other ways.

More information might be available at the Tcl/Tk option menu page.

func (*OptionMenuWidget) Name added in v0.53.0

func (w *OptionMenuWidget) Name() string

Name returns the menu name of 'w'.

type Opts added in v0.5.18

type Opts []Opt

Opts is a list of options. It implements Opt.

type PanedwindowWidget added in v0.11.0

type PanedwindowWidget struct {
	*Window
}

PanedwindowWidget represents the Tcl/Tk panedwindow widget/window

func Panedwindow added in v0.2.0

func Panedwindow(options ...Opt) *PanedwindowWidget

Panedwindow — Create and manipulate 'panedwindow' split container widgets

Description

The panedwindow command creates a new window (given by the pathName argument) and makes it into a panedwindow widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the panedwindow such as its default background color and relief. The panedwindow command returns the path name of the new window.

A panedwindow widget contains any number of panes, arranged horizontally or vertically, according to the value of the panes is separated by a moveable (via mouse movements) sash. Moving a sash causes the widgets on either side of the sash to be resized.

Use Window.Panedwindow to create a Panedwindow with a particular parent.

More information might be available at the Tcl/Tk panedwindow page.

Standard options

Widget specific options

Handlepad

When sash handles are drawn, specifies the distance from the top or left end of the sash (depending on the orientation of the widget) at which to draw the handle. May be any value accepted by Tk_GetPixels.

Handlesize

Specifies the side length of a sash handle. Handles are always drawn as squares. May be any value accepted by Tk_GetPixels.

Height

Specifies a desired height for the overall panedwindow widget. May be any value accepted by Tk_GetPixels. If an empty string, the widget will be made high enough to allow all contained widgets to have their natural height.

Opaqueresize

Specifies whether panes should be resized as a sash is moved (true), or if resizing should be deferred until the sash is placed (false). In the latter case, a version of the sash is displayed during the resizing to show where the panes will be resized to when releasing the mouse button. This version of the sash is the proxy. It's rendering can be configured using the -proxybackground, -proxyborderwidth and -proxyrelief options.

Proxybackground

Background color to use when drawing the proxy. If an empty string, the value of the -background option will be used.

Proxyborderwidth

Specifies the borderwidth of the proxy. May be any value accepted by Tk_GetPixels.

Proxyrelief

Relief to use when drawing the proxy. May be any of the standard Tk relief values. If an empty string, the value of the -sashrelief option will be used.

Sashcursor

Mouse cursor to use when over a sash. If null, sb_h_double_arrow will be used for horizontal panedwindows, and sb_v_double_arrow will be used for vertical panedwindows.

Sashpad

Specifies the amount of padding to leave of each side of a sash. May be any value accepted by Tk_GetPixels.

Sashrelief

Relief to use when drawing a sash. May be any of the standard Tk relief values.

Sashwidth

Specifies the width of each sash. May be any value accepted by Tk_GetPixels.

Showhandle

Specifies whether sash handles should be shown. May be any valid Tcl boolean value.

Width

Specifies a desired width for the overall panedwindow widget. May be any value accepted by Tk_GetPixels. If an empty string, the widget will be made wide enough to allow all contained widgets to have their natural width.

func (*PanedwindowWidget) Add added in v0.41.0

func (w *PanedwindowWidget) Add(subwindow *Window, options ...Opt)

panedwindow — Create and manipulate 'panedwindow' split container widgets

Description

Add one or more windows to the panedwindow, each in a separate pane. The arguments consist of the names of one or more windows followed by pairs of arguments that specify how to manage the windows. Option may have any of the values accepted by the configure subcommand.

More information might be available at the Tcl/Tk panedwindow page.

func (*PanedwindowWidget) Panecget added in v0.41.0

func (w *PanedwindowWidget) Panecget(subwindow *Window, opt any) string

panedwindow — Create and manipulate 'panedwindow' split container widgets

Description

Query a management option for window. Option may be any value allowed by the paneconfigure subcommand.

More information might be available at the Tcl/Tk panedwindow page.

func (*PanedwindowWidget) Paneconfigure added in v0.41.0

func (w *PanedwindowWidget) Paneconfigure(subwindow *Window, options ...Opt) string

panedwindow — Create and manipulate 'panedwindow' split container widgets

Description

Query or modify the management options for window. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string.

More information might be available at the Tcl/Tk panedwindow page.

type RadiobuttonWidget added in v0.11.0

type RadiobuttonWidget struct {
	*Window
}

RadiobuttonWidget represents the Tcl/Tk radiobutton widget/window

func Radiobutton added in v0.2.0

func Radiobutton(options ...Opt) *RadiobuttonWidget

Radiobutton — Create and manipulate 'radiobutton' pick-one widgets

Description

The radiobutton command creates a new window (given by the pathName argument) and makes it into a radiobutton widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the radiobutton such as its colors, font, text, and initial relief. The radiobutton command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A radiobutton is a widget that displays a textual string, bitmap or image and a diamond or circle called an indicator. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the -wraplength option) and one of the characters may optionally be underlined using the all of the behavior of a simple button: it can display itself in either of three different ways, according to the -state option; it can be made to appear raised, sunken, or flat; it can be made to flash; and it invokes a Tcl command whenever mouse button 1 is clicked over the check button.

In addition, radiobuttons can be selected. If a radiobutton is selected, the indicator is normally drawn with a selected appearance, and a Tcl variable associated with the radiobutton is set to a particular value (normally 1). Under Unix, the indicator is drawn with a sunken relief and a special color. Under Windows, the indicator is drawn with a round mark inside. If the radiobutton is not selected, then the indicator is drawn with a deselected appearance, and the associated variable is set to a different value (typically 0). The indicator is drawn without a round mark inside. Typically, several radiobuttons share a single variable and the value of the variable indicates which radiobutton is to be selected. When a radiobutton is selected it sets the value of the variable to indicate that fact; each radiobutton also monitors the value of the variable and automatically selects and deselects itself when the variable's value changes. If the variable's value matches the -tristatevalue, then the radiobutton is drawn using the tri-state mode. This mode is used to indicate mixed or multiple values. (This is used when the radiobutton represents the state of multiple items.) By default the variable selectedButton is used; its contents give the name of the button that is selected, or the empty string if no button associated with that variable is selected. The name of the variable for a radiobutton, plus the variable to be stored into it, may be modified with options on the command line or in the option database. Configuration options may also be used to modify the way the indicator is displayed (or whether it is displayed at all). By default a radiobutton is configured to select itself on button clicks.

Use Window.Radiobutton to create a Radiobutton with a particular parent.

More information might be available at the Tcl/Tk radiobutton page.

Standard options

Widget specific options

Command

Specifies a Tcl command to associate with the button. This command is typically invoked when mouse button 1 is released over the button window. The button's global variable (-variable option) will be updated before the command is invoked.

Height

Specifies a desired height for the button. If an image or bitmap is being displayed in the button then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in lines of text. If this option is not specified, the button's desired height is computed from the size of the image or bitmap or text being displayed in it.

Indicatoron

Specifies whether or not the indicator should be drawn. Must be a proper boolean value. If false, the -relief option is ignored and the widget's relief is always sunken if the widget is selected and raised otherwise.

Offrelief

Specifies the relief for the checkbutton when the indicator is not drawn and the checkbutton is off. The default value is By setting this option to and setting -indicatoron to false and -overrelief to the effect is achieved of having a flat button that raises on mouse-over and which is depressed when activated. This is the behavior typically exhibited by the Align-Left, Align-Right, and Center radiobuttons on the toolbar of a word-processor, for example.

Overrelief

Specifies an alternative relief for the radiobutton, to be used when the mouse cursor is over the widget. This option can be used to make toolbar buttons, by configuring -relief flat -overrelief raised. If the value of this option is the empty string, then no alternative relief is used when the mouse cursor is over the radiobutton. The empty string is the default value.

Selectcolor

Specifies a background color to use when the button is selected. If indicatorOn is true then the color is used as the background for the indicator regardless of the select state. If -indicatoron is false, this color is used as the background for the entire widget, in place of -background or -activeBackground, whenever the widget is selected. If specified as an empty string then no special color is used for displaying when the widget is selected.

Selectimage

Specifies an image to display (in place of the -image option) when the radiobutton is selected. This option is ignored unless the -image option has been specified.

State

Specifies one of three states for the radiobutton: normal, active, or disabled. In normal state the radiobutton is displayed using the -foreground and -background options. The active state is typically used when the pointer is over the radiobutton. In active state the radiobutton is displayed using the -activeforeground and -activebackground options. Disabled state means that the radiobutton should be insensitive: the default bindings will refuse to activate the widget and will ignore mouse button presses. In this state the -disabledforeground and -background options determine how the radiobutton is displayed.

Tristateimage

Specifies an image to display (in place of the -image option) when the radiobutton is selected. This option is ignored unless the -image option has been specified.

Tristatevalue

Specifies the value that causes the radiobutton to display the multi-value selection, also known as the tri-state mode. Defaults to

Value

Specifies value to store in the button's associated variable whenever this button is selected.

Variable

Specifies the name of a global variable to set whenever this button is selected. Changes in this variable also cause the button to select or deselect itself. Defaults to the value selectedButton.

Width

Specifies a desired width for the button. If an image or bitmap is being displayed in the button, the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in characters. If this option is not specified, the button's desired width is computed from the size of the image or bitmap or text being displayed in it.

type ScaleWidget added in v0.11.0

type ScaleWidget struct {
	*Window
}

ScaleWidget represents the Tcl/Tk scale widget/window

func Scale added in v0.2.0

func Scale(options ...Opt) *ScaleWidget

Scale — Create and manipulate 'scale' value-controlled slider widgets

Description

The scale command creates a new window (given by the pathName argument) and makes it into a scale widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the scale such as its colors, orientation, and relief. The scale command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A scale is a widget that displays a rectangular trough and a small slider. The trough corresponds to a range of real values (determined by the -from, -to, and and the position of the slider selects a particular real value. The slider's position (and hence the scale's value) may be adjusted with the mouse or keyboard as described in the BINDINGS section below. Whenever the scale's value is changed, a Tcl command is invoked (using the -command option) to notify other interested widgets of the change. In addition, the value of the scale can be linked to a Tcl variable (using the -variable option), so that changes in either are reflected in the other.

Three annotations may be displayed in a scale widget: a label appearing at the top right of the widget (top left for horizontal scales), a number displayed just to the left of the slider (just above the slider for horizontal scales), and a collection of numerical tick marks just to the left of the current value (just below the trough for horizontal scales). Each of these three annotations may be enabled or disabled using the configuration options.

Use Window.Scale to create a Scale with a particular parent.

More information might be available at the Tcl/Tk scale page.

Standard options

Widget specific options

Bigincrement

Some interactions with the scale cause its value to change by increments; this option specifies the size of the large increments. If specified as 0, the large increments default to 1/10 the range of the scale.

Command

Specifies the prefix of a Tcl command to invoke whenever the scale's value is changed via a widget command. The actual command consists of this option followed by a space and a real number indicating the new value of the scale.

Digits

An integer specifying how many significant digits should be retained when converting the value of the scale to a string. If the number is negative or zero, then the scale picks the smallest value that guarantees that every possible slider position prints as a different string.

From

A real value corresponding to the left or top end of the scale.

Lbl

A string to display as a label for the scale. For vertical scales the label is displayed just to the right of the top end of the scale. For horizontal scales the label is displayed just above the left end of the scale. If the option is specified as an empty string, no label is displayed.

Length

Specifies the desired long dimension of the scale in screen units (i.e. any of the forms acceptable to Tk_GetPixels). For vertical scales this is the scale's height; for horizontal scales it is the scale's width.

Resolution

A real value specifying the resolution for the scale. If this value is greater than zero then the scale's value will always be rounded to an even multiple of this value, as will the endpoints of the scale. If the value is negative then no rounding occurs. Defaults to 1 (i.e., the value will be integral).

Showvalue

Specifies a boolean value indicating whether or not the current value of the scale is to be displayed.

Sliderlength

Specifies the size of the slider, measured in screen units along the slider's long dimension. The value may be specified in any of the forms acceptable to Tk_GetPixels.

Sliderrelief

Specifies the relief to use when drawing the slider, such as raised or sunken.

State

Specifies one of three states for the scale: normal, active, or disabled. If the scale is disabled then the value may not be changed and the scale will not activate. If the scale is active, the slider is displayed using the color specified by the -activebackground option.

Tickinterval

Must be a real value. Determines the spacing between numerical tick marks displayed below or to the left of the slider. The values will all be displayed with the same number of decimal places, which will be enough to ensure they are all accurate to within 20% of a tick interval. If 0, no tick marks will be displayed.

To

Specifies a real value corresponding to the right or bottom end of the scale. This value may be either less than or greater than the -from option.

Variable

Specifies the name of a global variable to link to the scale. Whenever the value of the variable changes, the scale will update to reflect this value. Whenever the scale is manipulated interactively, the variable will be modified to reflect the scale's new value.

Width

Specifies the desired narrow dimension of the scale in screen units (i.e. any of the forms acceptable to Tk_GetPixels). For vertical scales this is the scale's width; for horizontal scales this is the scale's height.

type ScrollbarWidget added in v0.11.0

type ScrollbarWidget struct {
	*Window
}

ScrollbarWidget represents the Tcl/Tk scrollbar widget/window

func Scrollbar added in v0.2.0

func Scrollbar(options ...Opt) *ScrollbarWidget

Scrollbar — Create and manipulate 'scrollbar' scrolling control and indicator widgets

Description

The scrollbar command creates a new window (given by the pathName argument) and makes it into a scrollbar widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the scrollbar such as its colors, orientation, and relief. The scrollbar command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A scrollbar is a widget that displays two arrows, one at each end of the scrollbar, and a slider in the middle portion of the scrollbar. It provides information about what is visible in an associated window that displays a document of some sort (such as a file being edited or a drawing). The position and size of the slider indicate which portion of the document is visible in the associated window. For example, if the slider in a vertical scrollbar covers the top third of the area between the two arrows, it means that the associated window displays the top third of its document.

Scrollbars can be used to adjust the view in the associated window by clicking or dragging with the mouse. See the BINDINGS section below for details.

Use Window.Scrollbar to create a Scrollbar with a particular parent.

More information might be available at the Tcl/Tk scrollbar page.

Standard options

Widget specific options

Activerelief

Specifies the relief to use when displaying the element that is active, if any. Elements other than the active element are always displayed with a raised relief.

Command

Specifies the prefix of a Tcl command to invoke to change the view in the widget associated with the scrollbar. When a user requests a view change by manipulating the scrollbar, a Tcl command is invoked. The actual command consists of this option followed by additional information as described later. This option almost always has a value such as .t xview or .t yview, consisting of the name of a widget and either xview (if the scrollbar is for horizontal scrolling) or yview (for vertical scrolling). All scrollable widgets have xview and yview commands that take exactly the additional arguments appended by the scrollbar as described in SCROLLING COMMANDS below.

Elementborderwidth

Specifies the width of borders drawn around the internal elements of the scrollbar (the two arrows and the slider). The value may have any of the forms acceptable to Tk_GetPixels. If this value is the empty string (the default), the value of the -borderwidth option is used in its place.

Width

Specifies the desired narrow dimension of the scrollbar window, not including 3-D border, if any. For vertical scrollbars this will be the width and for horizontal scrollbars this will be the height. The value may have any of the forms acceptable to Tk_GetPixels.

type SpinboxWidget added in v0.11.0

type SpinboxWidget struct {
	*Window
}

SpinboxWidget represents the Tcl/Tk spinbox widget/window

func Spinbox added in v0.2.0

func Spinbox(options ...Opt) *SpinboxWidget

Spinbox — Create and manipulate 'spinbox' value spinner widgets

Description

The spinbox command creates a new window (given by the pathName argument) and makes it into a spinbox widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the spinbox such as its colors, font, and relief. The spinbox command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A spinbox is an extended entry widget that allows he user to move, or spin, through a fixed set of ascending or descending values such as times or dates in addition to editing the value as in an entry. When first created, a spinbox's string is empty. A portion of the spinbox may be selected as described below. If a spinbox is exporting its selection (see the -exportselection option), then it will observe the standard protocols for handling the selection; spinbox selections are available as type STRING. Spinboxes also observe the standard Tk rules for dealing with the input focus. When a spinbox has the input focus it displays an insertion cursor to indicate where new characters will be inserted.

Spinboxes are capable of displaying strings that are too long to fit entirely within the widget's window. In this case, only a portion of the string will be displayed; commands described below may be used to change the view in the window. Spinboxes use the standard -xscrollcommand mechanism for interacting with scrollbars (see the description of the -xscrollcommand option for details). They also support scanning, as described below.

Use Window.Spinbox to create a Spinbox with a particular parent.

More information might be available at the Tcl/Tk spinbox page.

Standard options

Widget specific options

Buttonbackground

The background color to be used for the spin buttons.

Buttoncursor

The cursor to be used when over the spin buttons. If this is empty (the default), a default cursor will be used.

Buttondownrelief

The relief to be used for the upper spin button.

Buttonuprelief

The relief to be used for the lower spin button.

Command

Specifies a Tcl command to invoke whenever a spinbutton is invoked. The command recognizes several percent substitutions: %W for the widget path, %s for the current value of the widget, and %d for the direction of the button pressed (up or down).

Disabledbackground

Specifies the background color to use when the spinbox is disabled. If this option is the empty string, the normal background color is used.

Disabledforeground

Specifies the foreground color to use when the spinbox is disabled. If this option is the empty string, the normal foreground color is used.

Format

Specifies an alternate format to use when setting the string value when using the -from and -to range. This must be a format specifier of the form %<pad>.<pad>f, as it will format a floating-point number.

From

A floating-point value corresponding to the lowest value for a spinbox, to be used in conjunction with -to and -increment. When all are specified correctly, the spinbox will use these values to control its contents. If this value is greater than the -to option, then -from and -to values are automatically swapped. If -values is specified, it supersedes this option.

Invalidcommand

Specifies a script to eval when -validatecommand returns 0. Setting it to an empty string disables this feature (the default). The best use of this option is to set it to bell. See VALIDATION below for more information.

Increment

A floating-point value specifying the increment. When used with -from and -to, the value in the widget will be adjusted by -increment when a spin button is pressed (up adds the value, down subtracts the value).

Readonlybackground

Specifies the background color to use when the spinbox is readonly. If this option is the empty string, the normal background color is used.

State

Specifies one of three states for the spinbox: normal, disabled, or readonly. If the spinbox is readonly, then the value may not be changed using widget commands and no insertion cursor will be displayed, even if the input focus is in the widget; the contents of the widget may still be selected. If the spinbox is disabled, the value may not be changed, no insertion cursor will be displayed, the contents will not be selectable, and the spinbox may be displayed in a different color, depending on the values of the -disabledforeground and -disabledbackground options.

To

A floating-point value corresponding to the highest value for the spinbox, to be used in conjunction with -from and -increment. When all are specified correctly, the spinbox will use these values to control its contents. If this value is less than the -from option, then -from and -to values are automatically swapped. If -values is specified, it supersedes this option.

Validate

Specifies the mode in which validation should operate: none, focus, focusin, focusout, key, or all. It defaults to none. When you want validation, you must explicitly state which mode you wish to use. See VALIDATION below for more.

Validatecommand

Specifies a script to evaluate when you want to validate the input in the widget. Setting it to an empty string disables this feature (the default). Validation occurs according to the value of -validate. This command must return a valid Tcl boolean value. If it returns 0 (or the valid Tcl boolean equivalent) then the value of the widget will not change and the -invalidcommand will be evaluated if it is set. If it returns 1, then value will be changed. See VALIDATION below for more information.

Values

Must be a proper list value. If specified, the spinbox will use these values as to control its contents, starting with the first value. This option has precedence over the -from and -to range.

Width

Specifies an integer value indicating the desired width of the spinbox window, in average-size characters of the widget's font. If the value is negative or zero, the widget picks a size just large enough to hold its current text.

Wrap

Must be a proper boolean value. If on, the spinbox will wrap around the values of data in the widget.

type TButtonWidget added in v0.11.0

type TButtonWidget struct {
	*Window
}

TButtonWidget represents the Tcl/Tk ttk_button widget/window

func TButton added in v0.2.0

func TButton(options ...Opt) *TButtonWidget

TButton — Widget that issues a command when pressed

Description

A ttk::button widget displays a textual label and/or image, and evaluates a command when pressed.

Use Window.TButton to create a TButton with a particular parent.

More information might be available at the Tcl/Tk ttk_button page.

Standard options

Widget specific options

Command

A script to evaluate when the widget is invoked.

Default

May be set to one of normal, active, or disabled. In a dialog box, one button may be designated the button (meaning, roughly, active indicates that this is currently the default button; normal means that it may become the default button, and disabled means that it is not defaultable. The default is normal.

Standard styles

Ttk::button widgets support the Toolbutton style in all standard themes, which is useful for creating widgets for toolbars.

In the Aqua theme there are several other styles which can be used to produce replicas of many of the different button types that are discussed in Apple's Human Interface Guidelines. These include DisclosureButton, DisclosureTriangle, HelpButton, ImageButton, InlineButton, GradientButton, RoundedRectButton, and RecessedButton.

Styling options

The class name for a ttk::button is TButton.

Dynamic states: active, disabled, pressed, readonly.

TButton styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func TExit added in v0.5.18

func TExit(options ...Opt) *TButtonWidget

TExit provides a canned TButton with default Txt "Exit", bound to the ExitHandler.

Use Window.TExit to create a TExit with a particular parent.

func (*TButtonWidget) Invoke added in v0.44.0

func (w *TButtonWidget) Invoke() string

TButton — Widget that issues a command when pressed

Description

Invokes the command associated with the button.

Additional information might be available at the Tcl/Tk ttk::button page.

type TCheckbuttonWidget added in v0.11.0

type TCheckbuttonWidget struct {
	*Window
}

TCheckbuttonWidget represents the Tcl/Tk ttk_checkbutton widget/window

func TCheckbutton added in v0.2.0

func TCheckbutton(options ...Opt) *TCheckbuttonWidget

TCheckbutton — On/off widget

Description

A ttk::checkbutton widget is used to show or change a setting. It has two states, selected and deselected. The state of the checkbutton may be linked to a Tcl variable.

Use Window.TCheckbutton to create a TCheckbutton with a particular parent.

More information might be available at the Tcl/Tk ttk_checkbutton page.

Standard options

Widget specific options

Command

A Tcl script to execute whenever the widget is invoked.

Offvalue

The value to store in the associated -variable when the widget is deselected. Defaults to 0.

Onvalue

The value to store in the associated -variable when the widget is selected. Defaults to 1.

Variable

The name of a global variable whose value is linked to the widget. Defaults to the widget pathname if not specified.

Standard styles

Ttk::checkbutton widgets support the Toolbutton style in all standard themes, which is useful for creating widgets for toolbars.

Styling options

The class name for a ttk::checkbutton is TCheckbutton.

Dynamic states: active, alternate, disabled, pressed, selected, readonly.

TCheckbutton styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func (*TCheckbuttonWidget) Invoke added in v0.32.0

func (w *TCheckbuttonWidget) Invoke() string

ttk::checkbutton — On/off widget

Description

Toggles between the selected and deselected states and evaluates the associated -command. If the widget is currently selected, sets the -variable to the -offvalue and deselects the widget; otherwise, sets the -variable to the -onvalue. Returns the result of the -command.

More information might be available at the Tcl/Tk TCheckbutton page.

type TComboboxWidget added in v0.11.0

type TComboboxWidget struct {
	*Window
}

TComboboxWidget represents the Tcl/Tk ttk_combobox widget/window

func TCombobox added in v0.2.0

func TCombobox(options ...Opt) *TComboboxWidget

TCombobox — Text field with popdown selection list

Description

A ttk::combobox combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list.

Use Window.TCombobox to create a TCombobox with a particular parent.

More information might be available at the Tcl/Tk ttk_combobox page.

Standard options

Widget specific options

Exportselection

Boolean value. If set, the widget selection is linked to the X selection.

Justify

Specifies how the text is aligned within the widget. Must be one of left, center, or right.

Height

Specifies the height of the pop-down listbox, in rows.

Postcommand

A Tcl script to evaluate immediately before displaying the listbox. The -postcommand script may specify the -values to display.

State

One of normal, readonly, or disabled. In the readonly state, the value may not be edited directly, and the user can only select one of the -values from the dropdown list. In the normal state, the text field is directly editable. In the disabled state, no interaction is possible.

Textvariable

Specifies the name of a global variable whose value is linked to the widget value. Whenever the variable changes value the widget value is updated, and vice versa.

Values

Specifies the list of values to display in the drop-down listbox.

Width

Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font.

Styling options

The class name for a ttk::combobox is TCombobox. The ttk::combobox uses the entry and listbox widgets internally. The listbox frame has a class name of ComboboxPopdownFrame.

Dynamic states: disabled, focus, pressed, readonly.

TCombobox styling options configurable with ttk::style are:

The ttk::combobox popdown listbox cannot be configured using ttk::style nor via the widget configure command. The listbox can be configured using the option database.

option add *TCombobox*Listbox.background color option add *TCombobox*Listbox.font font option add *TCombobox*Listbox.foreground color option add *TCombobox*Listbox.selectBackground color option add *TCombobox*Listbox.selectForeground color

To configure a specific listbox (subject to future change):

ComboboxPopdownFrame styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func (*TComboboxWidget) Current added in v0.53.0

func (w *TComboboxWidget) Current(newIndex any) (r string)

ttk::combobox — text field with popdown selection list

Description

If newIndex is supplied, sets the combobox value to the element at position newIndex in the list of -values (in addition to integers, the end index is supported and indicates the last element of the list, moreover the same simple interpretation as for the command string index is supported, with simple integer index arithmetic and indexing relative to end). Otherwise, returns the index of the current value in the list of -values or {} if the current value does not appear in the list.

More information might be available at the Tcl/Tk combobox page.

type TEntryWidget added in v0.11.0

type TEntryWidget struct {
	*Window
}

TEntryWidget represents the Tcl/Tk ttk_entry widget/window

func TEntry added in v0.2.0

func TEntry(options ...Opt) *TEntryWidget

TEntry — Editable text field widget

Description

An ttk::entry widget displays a one-line text string and allows that string to be edited by the user. The value of the string may be linked to a Tcl variable with the -textvariable option. Entry widgets support horizontal scrolling with the standard -xscrollcommand option and xview widget command.

Use Window.TEntry to create a TEntry with a particular parent.

More information might be available at the Tcl/Tk ttk_entry page.

Standard options

Widget specific options

Exportselection

A boolean value specifying whether or not a selection in the widget should be linked to the X selection. If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection.

Invalidcommand

A script template to evaluate whenever the -validatecommand returns 0. See VALIDATION below for more information.

Justify

Specifies how the text is aligned within the entry widget. One of left, center, or right.

Show

If this option is specified, then the true contents of the entry are not displayed in the window. Instead, each character in the entry's value will be displayed as the first character in the value of this option, such as or a bullet. This is useful, for example, if the entry is to be used to enter a password. If characters in the entry are selected and copied elsewhere, the information copied will be what is displayed, not the true contents of the entry.

State

Compatibility option; see ttk::widget(n) for details. Specifies one of three states for the entry, normal, disabled, or readonly. See WIDGET STATES, below.

Textvariable

Specifies the name of a global variable whose value is linked to the entry widget's contents. Whenever the variable changes value, the widget's contents are updated, and vice versa.

Validate

Specifies the mode in which validation should operate: none, focus, focusin, focusout, key, or all. Default is none, meaning that validation is disabled. See VALIDATION below.

Validatecommand

A script template to evaluate whenever validation is triggered. If set to the empty string (the default), validation is disabled. The script must return a boolean value. See VALIDATION below.

Width

Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font.

Styling options

The class name for a ttk::entry is TEntry.

Dynamic states: disabled, focus, readonly.

TEntry styling options configurable with ttk::style are:

See the ttk::style manual page for information on how to configure ttk styles.

func (*TEntryWidget) Icursor added in v0.58.0

func (w *TEntryWidget) Icursor(index any) (r string)

TEntry — Editable text field widget

Description

Arrange for the insertion cursor to be displayed just before the character given by index. Returns an empty string.

More information might be available at the Tcl/Tk ttk_entry page.

type TFrameWidget added in v0.11.0

type TFrameWidget struct {
	*Window
}

TFrameWidget represents the Tcl/Tk ttk_frame widget/window

func TFrame added in v0.2.0

func TFrame(options ...Opt) *TFrameWidget

TFrame — Simple container widget

Description

A ttk::frame widget is a container, used to group other widgets together.

Use Window.TFrame to create a TFrame with a particular parent.

More information might be available at the Tcl/Tk ttk_frame page.

Standard options

Widget specific options

Borderwidth

The desired width of the widget border. Defaults to 0. May be ignored depending on the theme used.

Relief

One of the standard Tk border styles: flat, groove, raised, ridge, solid, or sunken. Defaults to flat.

Width

If specified, the widget's requested width in pixels.

Height

If specified, the widget's requested height in pixels.

Styling options

The class name for a ttk::frame is TFrame.

TFrame styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

type TLabelWidget added in v0.11.0

type TLabelWidget struct {
	*Window
}

TLabelWidget represents the Tcl/Tk ttk_label widget/window

func TLabel added in v0.2.0

func TLabel(options ...Opt) *TLabelWidget

TLabel — Display a text string and/or image

Description

A ttk::label widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text.

Use Window.TLabel to create a TLabel with a particular parent.

More information might be available at the Tcl/Tk ttk_label page.

Standard options

Widget specific options

Background

The widget's background color. If unspecified, the theme default is used.

Relief

Specifies the 3-D effect desired for the widget border. Valid values are flat, groove, raised, ridge, solid, and sunken.

Wraplength

Specifies the maximum line length (in pixels). If this option is negative or zero, then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the specified value.

Styling options

The class name for a ttk::label is TLabel.

Dynamic states: disabled, readonly.

TLabel styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

type TLabelframeWidget added in v0.11.0

type TLabelframeWidget struct {
	*Window
}

TLabelframeWidget represents the Tcl/Tk ttk_labelframe widget/window

func TLabelframe added in v0.2.0

func TLabelframe(options ...Opt) *TLabelframeWidget

TLabelframe — Container widget with optional label

Description

A ttk::labelframe widget is a container used to group other widgets together. It has an optional label, which may be a plain text string or another widget.

Use Window.TLabelframe to create a TLabelframe with a particular parent.

More information might be available at the Tcl/Tk ttk_labelframe page.

Standard options

Widget specific options

Height

If specified, the widget's requested height in pixels. (See ttk::frame(n) for further notes on -width and -height).

Labelanchor

Specifies where to place the label. Allowed values are (clockwise from the top upper left corner): nw, n, ne, en, e, es, se, s,sw, ws, w and wn. The default value is theme-dependent.

Labelwidget

The name of a widget to use for the label. If set, overrides the -text option. The -labelwidget must be a child of the labelframe widget or one of the labelframe's ancestors, and must belong to the same top-level widget as the labelframe.

Txt

Specifies the text of the label.

Underline

If set, specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation. Mnemonic activation for a ttk::labelframe sets the keyboard focus to the first child of the ttk::labelframe widget.

Width

If specified, the widget's requested width in pixels.

Styling options

The class name for a ttk::labelframe is TLabelframe. The text label has a class of TLabelframe.Label.

Dynamic states: disabled, readonly.

TLabelframe styling options configurable with ttk::style are:

TLabelframe.Label styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

type TMenubuttonWidget added in v0.11.0

type TMenubuttonWidget struct {
	*Window
}

TMenubuttonWidget represents the Tcl/Tk ttk_menubutton widget/window

func TMenubutton added in v0.2.0

func TMenubutton(options ...Opt) *TMenubuttonWidget

TMenubutton — Widget that pops down a menu when pressed

Description

A ttk::menubutton widget displays a textual label and/or image, and displays a menu when pressed.

Use Window.TMenubutton to create a TMenubutton with a particular parent.

More information might be available at the Tcl/Tk ttk_menubutton page.

Standard options

Widget specific options

Direction

Specifies where the menu is to be popped up relative to the menubutton. One of: above, below, left, right, or flush. The default is below. flush pops the menu up directly over the menubutton.

Mnu

Specifies the path name of the menu associated with the menubutton. To be on the safe side, the menu ought to be a direct child of the menubutton.

Standard styles

Ttk::menubutton widgets support the Toolbutton style in all standard themes, which is useful for creating widgets for toolbars.

Styling options

The class name for a ttk::menubutton is TMenubutton.

Dynamic states: active, disabled, readonly.

TMenubutton styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

type TNotebookWidget added in v0.11.0

type TNotebookWidget struct {
	*Window
}

TNotebookWidget represents the Tcl/Tk ttk_notebook widget/window

func TNotebook added in v0.2.0

func TNotebook(options ...Opt) *TNotebookWidget

TNotebook — Multi-paned container widget

Description

A ttk::notebook widget manages a collection of windows and displays a single one at a time. Each content window is associated with a tab, which the user may select to change the currently-displayed window.

Use Window.TNotebook to create a TNotebook with a particular parent.

More information might be available at the Tcl/Tk ttk_notebook page.

Standard options

Widget specific options

Height

If present and greater than zero, specifies the desired height of the pane area (not including internal padding or tabs). Otherwise, the maximum height of all panes is used.

Padding

Specifies the amount of extra space to add around the outside of the notebook. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget.

Width

If present and greater than zero, specifies the desired width of the pane area (not including internal padding). Otherwise, the maximum width of all panes is used.

Styling options

The class name for a ttk::notebook is TNotebook. The tab has a class name of TNotebook.Tab

Dynamic states: active, disabled, selected.

TNotebook styling options configurable with ttk::style are:

TNotebook.Tab styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func (*TNotebookWidget) Add added in v0.30.0

func (w *TNotebookWidget) Add(options ...Opt)

ttk::notebook — Multi-paned container widget

Description

Adds a new tab to the notebook. See TAB OPTIONS for the list of available options. If window is currently managed by the notebook but hidden, it is restored to its previous position.

More information might be available at the Tcl/Tk TNotebook page.

func (*TNotebookWidget) Select added in v0.31.0

func (w *TNotebookWidget) Select(tabid any) string

TNotebook — Multi-paned container widget

Description

Selects the specified tab. The associated content window will be displayed, and the previously-selected window (if different) is unmapped. If tabid is omitted, returns the widget name of the currently selected pane.

More information might be available at the Tcl/Tk TNotebook page.

func (*TNotebookWidget) Tabs added in v0.32.0

func (w *TNotebookWidget) Tabs() (r []*Window)

TNotebook — Multi-paned container widget

Description

Returns the list of windows managed by the notebook, in the index order of their associated tabs.

More information might be available at the Tcl/Tk TNotebook page.

type TPanedwindowWidget added in v0.11.0

type TPanedwindowWidget struct {
	*Window
}

TPanedwindowWidget represents the Tcl/Tk ttk_panedwindow widget/window

func TPanedwindow added in v0.2.0

func TPanedwindow(options ...Opt) *TPanedwindowWidget

TPanedwindow — Multi-pane container window

Description

A ttk::panedwindow widget displays a number of subwindows, stacked either vertically or horizontally. The user may adjust the relative sizes of the subwindows by dragging the sash between panes.

Use Window.TPanedwindow to create a TPanedwindow with a particular parent.

More information might be available at the Tcl/Tk ttk_panedwindow page.

Standard options

Widget specific options

Orient

Specifies the orientation of the window. If vertical, subpanes are stacked top-to-bottom; if horizontal, subpanes are stacked left-to-right.

Width

If present and greater than zero, specifies the desired width of the widget in pixels. Otherwise, the requested width is determined by the width of the managed windows.

Height

If present and greater than zero, specifies the desired height of the widget in pixels. Otherwise, the requested height is determined by the height of the managed windows.

Styling options

The class name for a ttk::panedwindow is TPanedwindow. The sash has a class name of Sash.

TPanedwindow styling options configurable with ttk::style are:

Sash styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func (*TPanedwindowWidget) Add added in v0.41.0

func (w *TPanedwindowWidget) Add(subwindow *Window, options ...Opt)

ttk::panedwindow — Multi-pane container window

Description

Adds a new pane to the window. See PANE OPTIONS for the list of available options.

More information might be available at the Tcl/Tk ttk_panedwindow page.

type TProgressbarWidget added in v0.11.0

type TProgressbarWidget struct {
	*Window
}

TProgressbarWidget represents the Tcl/Tk ttk_progressbar widget/window

func TProgressbar added in v0.2.0

func TProgressbar(options ...Opt) *TProgressbarWidget

TProgressbar — Provide progress feedback

Description

A ttk::progressbar widget shows the status of a long-running operation. They can operate in two modes: determinate mode shows the amount completed relative to the total amount of work to be done, and indeterminate mode provides an animated display to let the user know that something is happening.

If the value of -orient is horizontal a text string can be displayed inside the progressbar. This string can be configured using the -anchor, -font, -foreground, -justify, is vertical then these options are ignored.

Use Window.TProgressbar to create a TProgressbar with a particular parent.

More information might be available at the Tcl/Tk ttk_progressbar page.

Standard options

Widget specific options

Length

Specifies the length of the long axis of the progress bar (width if horizontal, height if vertical). The value may have any of the forms acceptable to Tk_GetPixels.

Maximum

A floating point number specifying the maximum -value. Defaults to 100.

Mode

One of determinate or indeterminate.

Orient

One of horizontal or vertical. Specifies the orientation of the progress bar.

Phase

Read-only option. The widget periodically increments the value of this option whenever the -value is greater than 0 and, in determinate mode, less than -maximum. This option may be used by the current theme to provide additional animation effects.

Value

The current value of the progress bar. In determinate mode, this represents the amount of work completed. In indeterminate mode, it is interpreted modulo -maximum; that is, the progress bar completes one when the -value increases by -maximum. If -variable is set to an existing variable, specifying -value has no effect (the variable value takes precedence).

Variable

The name of a global Tcl variable which is linked to the -value. If specified to an existing variable, the -value of the progress bar is automatically set to the value of the variable whenever the latter is modified.

Styling options

The class name for a ttk::progressbar is TProgressbar.

TProgressbar styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func (*TProgressbarWidget) Start added in v0.61.0

func (w *TProgressbarWidget) Start(interval ...time.Duration)

ttk::progressbar — Provide progress feedback

Description

Begin autoincrement mode: schedules a recurring timer event that calls step every interval milliseconds. If omitted, interval defaults to 50 milliseconds (20 steps/second).

More information might be available at the Tcl/Tk progressbar page.

func (*TProgressbarWidget) Step added in v0.61.0

func (w *TProgressbarWidget) Step(amount ...float64)

ttk::progressbar — Provide progress feedback

Description

Increments the -value by amount. amount defaults to 1.0 if omitted.

More information might be available at the Tcl/Tk progressbar page.

func (*TProgressbarWidget) Stop added in v0.61.0

func (w *TProgressbarWidget) Stop()

ttk::progressbar — Provide progress feedback

Description

Stop autoincrement mode: cancels any recurring timer event initiated by pathName start.

More information might be available at the Tcl/Tk progressbar page.

type TRadiobuttonWidget added in v0.11.0

type TRadiobuttonWidget struct {
	*Window
}

TRadiobuttonWidget represents the Tcl/Tk ttk_radiobutton widget/window

func TRadiobutton added in v0.2.0

func TRadiobutton(options ...Opt) *TRadiobuttonWidget

TRadiobutton — Mutually exclusive option widget

Description

ttk::radiobutton widgets are used in groups to show or change a set of mutually-exclusive options. Radiobuttons are linked to a Tcl variable, and have an associated value; when a radiobutton is clicked, it sets the variable to its associated value.

Use Window.TRadiobutton to create a TRadiobutton with a particular parent.

More information might be available at the Tcl/Tk ttk_radiobutton page.

Standard options

Widget specific options

Command

A Tcl script to evaluate whenever the widget is invoked.

Value

The value to store in the associated -variable when the widget is selected.

Variable

The name of a global variable whose value is linked to the widget. Default value is ::selectedButton.

Standard styles

Ttk::radiobutton widgets support the Toolbutton style in all standard themes, which is useful for creating widgets for toolbars.

Styling options

The class name for a ttk::radiobutton is TRadiobutton.

Dynamic states: active, alternate, disabled, pressed, readonly, selected.

TRadiobutton styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

type TScaleWidget added in v0.11.0

type TScaleWidget struct {
	*Window
}

TScaleWidget represents the Tcl/Tk ttk_scale widget/window

func TScale added in v0.2.0

func TScale(options ...Opt) *TScaleWidget

TScale — Create and manipulate a scale widget

Description

A ttk::scale widget is typically used to control the numeric value of a linked variable that varies uniformly over some range. A scale displays a slider that can be moved along over a trough, with the relative position of the slider over the trough indicating the value of the variable.

Use Window.TScale to create a TScale with a particular parent.

More information might be available at the Tcl/Tk ttk_scale page.

Standard options

Widget specific options

Command

Specifies the prefix of a Tcl command to invoke whenever the scale's value is changed via a widget command. The actual command consists of this option followed by a space and a real number indicating the new value of the scale.

From

A real value corresponding to the left or top end of the scale.

Length

Specifies the desired long dimension of the scale in screen units (i.e. any of the forms acceptable to Tk_GetPixels). For vertical scales this is the scale's height; for horizontal scales it is the scale's width.

Orient

Specifies which orientation whether the widget should be laid out horizontally or vertically. Must be either horizontal or vertical or an abbreviation of one of these.

To

Specifies a real value corresponding to the right or bottom end of the scale. This value may be either less than or greater than the -from option.

Value

Specifies the current floating-point value of the variable. If -variable is set to an existing variable, specifying -value has no effect (the variable value takes precedence).

Variable

Specifies the name of a global variable to link to the scale. Whenever the value of the variable changes, the scale will update to reflect this value. Whenever the scale is manipulated interactively, the variable will be modified to reflect the scale's new value.

Styling options

The class name for a ttk::scale is TScale.

Dynamic states: active.

TScale styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func (*TScaleWidget) Get added in v0.53.0

func (w *TScaleWidget) Get(xy ...any) (r string)

ttk::scale — Create and manipulate a scale widget

Description

Get the current value of the -value option, or the value corresponding to the coordinates x,y if they are specified. X and y are pixel coordinates relative to the scale widget origin.

More information might be available at the Tcl/Tk scale page.

type TScrollbarWidget added in v0.11.0

type TScrollbarWidget struct {
	*Window
}

TScrollbarWidget represents the Tcl/Tk ttk_scrollbar widget/window

func TScrollbar added in v0.2.0

func TScrollbar(options ...Opt) *TScrollbarWidget

TScrollbar — Control the viewport of a scrollable widget

Description

ttk::scrollbar widgets are typically linked to an associated window that displays a document of some sort, such as a file being edited or a drawing. A scrollbar displays a thumb in the middle portion of the scrollbar, whose position and size provides information about the portion of the document visible in the associated window. The thumb may be dragged by the user to control the visible region. Depending on the theme, two or more arrow buttons may also be present; these are used to scroll the visible region in discrete units.

Use Window.TScrollbar to create a TScrollbar with a particular parent.

More information might be available at the Tcl/Tk ttk_scrollbar page.

Standard options

Widget specific options

Command

A Tcl script prefix to evaluate to change the view in the widget associated with the scrollbar. Additional arguments are appended to the value of this option, as described in SCROLLING COMMANDS below, whenever the user requests a view change by manipulating the scrollbar.

Orient

One of horizontal or vertical. Specifies the orientation of the scrollbar.

Styling options

The class name for a ttk::scrollbar is TScrollbar.

Dynamic states: active, disabled.

TScrollbar (or more specifically Vertical.TScrollbar and Horizontal.TScrollbar) styling options that are configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func (*TScrollbarWidget) Set added in v0.16.2

func (w *TScrollbarWidget) Set(firstLast string)

TScrollbar — Control the viewport of a scrollable widget

Description

This command is normally invoked by the scrollbar's associated widget from an -xscrollcommand or -yscrollcommand callback. Specifies the visible range to be displayed. first and last are real fractions between 0 and 1.

More information might be available at the Tcl/Tk ttk_scrollbar page.

type TSeparatorWidget added in v0.11.0

type TSeparatorWidget struct {
	*Window
}

TSeparatorWidget represents the Tcl/Tk ttk_separator widget/window

func TSeparator added in v0.2.0

func TSeparator(options ...Opt) *TSeparatorWidget

TSeparator — Separator bar

Description

A ttk::separator widget displays a horizontal or vertical separator bar.

Use Window.TSeparator to create a TSeparator with a particular parent.

More information might be available at the Tcl/Tk ttk_separator page.

Standard options

Widget specific options

Orient

One of horizontal or vertical. Specifies the orientation of the separator.

Styling options

The class name for a ttk::separator is TSeparator.

TSeparator styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

type TSizegripWidget added in v0.11.0

type TSizegripWidget struct {
	*Window
}

TSizegripWidget represents the Tcl/Tk ttk_sizegrip widget/window

func TSizegrip added in v0.2.0

func TSizegrip(options ...Opt) *TSizegripWidget

TSizegrip — Bottom-right corner resize widget

Description

A ttk::sizegrip widget (also known as a grow box) allows the user to resize the containing toplevel window by pressing and dragging the grip.

Use Window.TSizegrip to create a TSizegrip with a particular parent.

More information might be available at the Tcl/Tk ttk_sizegrip page.

Standard options

Styling options

The class name for a ttk::sizegrip is TSizegrip.

TSizegrip styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

type TSpinboxWidget added in v0.11.0

type TSpinboxWidget struct {
	*Window
}

TSpinboxWidget represents the Tcl/Tk ttk_spinbox widget/window

func TSpinbox added in v0.2.0

func TSpinbox(options ...Opt) *TSpinboxWidget

TSpinbox — Selecting text field widget

Description

A ttk::spinbox widget is a ttk::entry widget with built-in up and down buttons that are used to either modify a numeric value or to select among a set of values. The widget implements all the features of the ttk::entry widget including support of the to a Tcl variable.

Use Window.TSpinbox to create a TSpinbox with a particular parent.

More information might be available at the Tcl/Tk ttk_spinbox page.

Standard options

Widget specific options

Command

Specifies a Tcl command to be invoked whenever a spinbutton is invoked.

Format

Specifies an alternate format to use when setting the string value when using the -from and -to range. This must be a format specifier of the form %<pad>.<pad>f, as it will format a floating-point number.

From

A floating-point value specifying the lowest value for the spinbox. This is used in conjunction with -to and -increment to set a numerical range.

Increment

A floating-point value specifying the change in value to be applied each time one of the widget spin buttons is pressed. The up button applies a positive increment, the down button applies a negative increment.

To

A floating-point value specifying the highest permissible value for the widget. See also -from and -increment. range.

Values

This must be a Tcl list of values. If this option is set then this will override any range set using the -from, -to and -increment options. The widget will instead use the values specified beginning with the first value.

Wrap

Must be a proper boolean value. If on, the spinbox will wrap around the values of data in the widget.

Styling options

The class name for a ttk::spinbox is TSpinbox.

Dynamic states: active, disabled, focus, readonly.

TSpinbox styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

type TTreeviewWidget added in v0.11.0

type TTreeviewWidget struct {
	*Window
}

TTreeviewWidget represents the Tcl/Tk ttk_treeview widget/window

func TTreeview added in v0.2.0

func TTreeview(options ...Opt) *TTreeviewWidget

TTreeview — Hierarchical multicolumn data display widget

Description

The ttk::treeview widget displays a hierarchical collection of items. Each item has a textual label, an optional image, and an optional list of data values. The data values are displayed in successive columns after the tree label.

The order in which data values are displayed may be controlled by setting the -displaycolumns widget option. The tree widget can also display column headings. Columns may be accessed by number or by symbolic names listed in the -columns widget option; see COLUMN IDENTIFIERS.

Each item is identified by a unique name. The widget will generate item IDs if they are not supplied by the caller. There is a distinguished root item, named {}. The root item itself is not displayed; its children appear at the top level of the hierarchy.

Each item also has a list of tags, which can be used to associate event bindings with individual items and control the appearance of the item.

Treeview widgets support horizontal and vertical scrolling with the standard -[xy]scrollcommand options and [xy]view widget commands.

Use Window.TTreeview to create a TTreeview with a particular parent.

More information might be available at the Tcl/Tk ttk_treeview page.

Standard options

Widget specific options

Columns

A list of column identifiers, specifying the number of columns and their names.

Displaycolumns

A list of column identifiers (either symbolic names or integer indices) specifying which data columns are displayed and the order in which they appear, or the string #all. If set to #all (the default), all columns are shown in the order given.

Height

Specifies the number of rows which should be visible. Note that the requested width is determined from the sum of the column widths.

Selectmode

Controls how the built-in class bindings manage the selection. One of extended, browse, or none.

Selecttype

Controls how the built-in class bindings manage the selection. One of item or cell.

Show

A list containing zero or more of the following values, specifying which elements of the tree to display.

Striped

Boolean specifying zebra striped item coloring. Note that striped items uses the -stripedbackground option if set by the theme or a tag. If not supported by the current theme, it will not show.

Titlecolumns

Number of display columns at the left that should not be scrolled. The tree column counts, even if -show tree is not specified. Thus for value N of this option, column #N is the first one that is scrollable. Default is 0.

Titleitems

Number of items at the top that should not be vertically scrolled. Default is 0.

Styling options

The class name for a ttk::treeview is Treeview. The treeview header class name is Heading. The treeview item class name is Item. The treeview cell class name is Cell.

Dynamic states: disabled, selected.

Treeview styling options configurable with ttk::style are:

Heading styling options configurable with ttk::style are:

Item styling options configurable with ttk::style are:

Cell styling options configurable with ttk::style are:

Some options are only available for specific themes.

See the ttk::style manual page for information on how to configure ttk styles.

func (*TTreeviewWidget) Children added in v0.58.0

func (w *TTreeviewWidget) Children(item any, newChildren ...any) (r []string)

ttk::treeview — hierarchical multicolumn data display widget

Description

If newchildren is not specified, returns the list of children belonging to item.

If newchildren is specified, replaces item's child list with newchildren. Items in the old child list not present in the new child list are detached from the tree. None of the items in newchildren may be an ancestor of item.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Column added in v0.53.0

func (w *TTreeviewWidget) Column(column any, options ...Opt) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Query or modify the options for the specified column. If no -option is specified, returns a dictionary of option/value pairs. If a single -option is specified, returns the value of that option. Otherwise, the options are updated with the specified values. The following options may be set on each column:

  • id name: The column name. This is a read-only option. For example, [$pathname column #n -id] returns the data column associated with display column n. The tree column has -id #0.
  • anchor anchor: Specifies how the text in this column should be aligned with respect to the cell. Anchor is one of n, ne, e, se, s, sw, w, nw, or center.
  • minwidth minwidth: The minimum width of the column in pixels. The treeview widget will not make the column any smaller than -minwidth when the widget is resized or the user drags a heading column separator. Default is 20 pixels.
  • separator boolean: Specifies whether or not a column separator should be drawn to the right of the column. Default is false.
  • stretch boolean: Specifies whether or not the column width should be adjusted when the widget is resized or the user drags a heading column separator. Boolean may have any of the forms accepted by Tcl_GetBoolean. By default columns are stretchable. -width width: The width of the column in pixels. Default is 200 pixels. The specified column width may be changed by Tk in order to honor -stretch and/or -minwidth, or when the widget is resized or the user drags a heading column separator.

Use pathname "#0" to configure the tree column.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Delete added in v0.57.0

func (w *TTreeviewWidget) Delete(itemList ...any)

ttk::treeview — hierarchical multicolumn data display widget

Description

Deletes each of the items in itemList and all of their descendants. The root item may not be deleted. See also: detach.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Focus added in v0.59.0

func (w *TTreeviewWidget) Focus(item ...any) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

If item is specified, sets the focus item to item. Otherwise, returns the current focus item, or {} if there is none.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Heading added in v0.53.0

func (w *TTreeviewWidget) Heading(column any, options ...Opt) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Query or modify the heading options for the specified column. Valid options are:

  • text text: The text to display in the column heading.
  • image imageName: Specifies an image to display to the right of the column heading.
  • anchor anchor: Specifies how the heading text should be aligned. One of the standard Tk anchor values.
  • command script: A script to evaluate when the heading label is pressed.

Use pathname heading "#0" to configure the tree column heading.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) IdentifyCell added in v0.57.0

func (w *TTreeviewWidget) IdentifyCell(x, y int) (r []string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Returns the cell identifier of the cell at position x, y. A cell identifier is a list of item ID and column ID.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) IdentifyColumn added in v0.57.0

func (w *TTreeviewWidget) IdentifyColumn(x, y int) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Returns the display column identifier of the cell at position x. The tree column has ID #0.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) IdentifyElement added in v0.57.0

func (w *TTreeviewWidget) IdentifyElement(x, y int) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Returns the element at position x, y.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) IdentifyItem added in v0.57.0

func (w *TTreeviewWidget) IdentifyItem(x, y int) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Returns the item ID of the item at position x y.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) IdentifyRegion added in v0.57.0

func (w *TTreeviewWidget) IdentifyRegion(x, y int) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Returns one of:

  • heading

    Tree heading area; use [pathname identify column x y] to determine the heading number.

  • separator

    Space between two column headings; [pathname identify column x y] will return the display column identifier of the heading to left of the separator.

  • tree

    The tree area.

  • cell

    A data cell.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Index added in v0.57.0

func (w *TTreeviewWidget) Index(item any) (r int)

ttk::treeview — hierarchical multicolumn data display widget

Description

Returns the integer index of item within its parent's list of children or -1 otherwise.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Insert added in v0.53.0

func (w *TTreeviewWidget) Insert(parent, index any, options ...Opt) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Creates a new item. parent is the item ID of the parent item, or the empty string {} to create a new top-level item. index is an integer, or the value end, specifying where in the list of parent's children to insert the new item. If index is negative or zero, the new node is inserted at the beginning; if index is greater than or equal to the current number of children, it is inserted at the end. If -id is specified, it is used as the item identifier; id must not already exist in the tree. Otherwise, a new unique identifier is generated.

Insert returns the item identifier of the newly created item. See ITEM OPTIONS for the list of available options.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Item added in v0.53.0

func (w *TTreeviewWidget) Item(item any, options ...any) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Query or modify the options for the specified item. If no -option is specified, returns a dictionary of option/value pairs. If a single -option is specified, returns the value of that option. Otherwise, the item's options are updated with the specified values. See ITEM OPTIONS for the list of available options. pathname move item parent index

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Parent added in v0.57.0

func (w *TTreeviewWidget) Parent(item any) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Returns the ID of the parent of item, or "" if item is at the top level of the hierarchy.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) See added in v0.53.0

func (w *TTreeviewWidget) See(item any)

ttk::treeview — hierarchical multicolumn data display widget

Description

Ensure that item is visible: sets all of item's ancestors to -open true, and scrolls the widget if necessary so that item is within the visible portion of the tree.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) Selection added in v0.53.0

func (w *TTreeviewWidget) Selection(selop string, itemList ...any) (r []string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Manages item selection. Item selection is independent from cell selection handled by the cellselection command. If selop is not specified, returns the list of selected items. Otherwise, selop is one of the following:

  • set itemList: itemList becomes the new selection.
  • add itemList: Add itemList to the selection.
  • remove itemList: Remove itemList from the selection.
  • toggle itemList: Toggle the selection state of each item in itemList.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) TagAdd added in v0.59.0

func (w *TTreeviewWidget) TagAdd(tag string, items ...any)

ttk::treeview — hierarchical multicolumn data display widget

Description

Adds the specified tag to each of the listed items. If tag is already present for a particular item, then the -tags for that item are unchanged.

More information might be available at the Tcl/Tk treeview page.

func (*TTreeviewWidget) TagConfigure added in v0.59.0

func (w *TTreeviewWidget) TagConfigure(tag string, options ...any) (r string)

ttk::treeview — hierarchical multicolumn data display widget

Description

Query or modify the options for the specified tagName. If one or more option/value pairs are specified, sets the value of those options for the specified tag. If a single option is specified, returns the value of that option (or the empty string if the option has not been specified for tagName). With no additional arguments, returns a dictionary of the option settings for tagName. See TAG OPTIONS for the list of available options.

More information might be available at the Tcl/Tk treeview page.

type TextWidget added in v0.11.0

type TextWidget struct {
	*Window
}

TextWidget represents the Tcl/Tk text widget/window

func Text added in v0.2.0

func Text(options ...Opt) *TextWidget

Text — Create and manipulate 'text' hypertext editing widgets

Description

The text command creates a new window (given by the pathName argument) and makes it into a text widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the text such as its default background color and relief. The text command returns the path name of the new window.

A text widget displays one or more lines of text and allows that text to be edited. Text widgets support four different kinds of annotations on the text, called tags, marks, embedded windows or embedded images. Tags allow different portions of the text to be displayed with different fonts and colors. In addition, Tcl commands can be associated with tags so that scripts are invoked when particular actions such as keystrokes and mouse button presses occur in particular ranges of the text. See TAGS below for more details.

The second form of annotation consists of floating markers in the text called marks . Marks are used to keep track of various interesting positions in the text as it is edited. See MARKS below for more details.

The third form of annotation allows arbitrary windows to be embedded in a text widget. See EMBEDDED WINDOWS below for more details.

The fourth form of annotation allows Tk images to be embedded in a text widget. See EMBEDDED IMAGES below for more details.

The text widget also has a built-in undo/redo mechanism. See THE UNDO MECHANISM below for more details.

The text widget allows for the creation of peer widgets. These are other text widgets which share the same underlying data (text, marks, tags, images, etc). See PEER WIDGETS below for more details.

Use Window.Text to create a Text with a particular parent.

More information might be available at the Tcl/Tk text page.

Standard options

Widget specific options

Autoseparators

Specifies a boolean that says whether separators are automatically inserted in the undo stack. Only meaningful when the -undo option is true.

Blockcursor

Specifies a boolean that says whether the blinking insertion cursor should be drawn as a character-sized rectangular block. If false (the default) a thin vertical line is used for the insertion cursor.

Endline

Specifies an integer line index representing the line of the underlying textual data store that should be just after the last line contained in the widget. This allows a text widget to reflect only a portion of a larger piece of text. Instead of an integer, the empty string can be provided to this configuration option, which will configure the widget to end at the very last line in the textual data store.

Height

Specifies the desired height for the window, in units of characters in the font given by the -font option. Must be at least one.

Inactiveselectbackground

Specifies the colour to use for the selection (the sel tag) when the window does not have the input focus. If empty, {}, then no selection is shown when the window does not have the focus.

Insertunfocussed

Specifies how to display the insertion cursor when the widget does not have the focus. Must be none (the default) which means to not display the cursor, hollow which means to display a hollow box, or solid which means to display a solid box. Note that hollow and solid will appear very similar when the -blockcursor option is false.

Maxundo

Specifies the maximum number of compound undo actions on the undo stack. A zero or a negative value imply an unlimited undo stack.

Spacing1

Requests additional space above each text line in the widget, using any of the standard forms for screen distances. If a line wraps, this option only applies to the first line on the display. This option may be overridden with -spacing1 options in tags.

Spacing2

For lines that wrap (so that they cover more than one line on the display) this option specifies additional space to provide between the display lines that represent a single line of text. The value may have any of the standard forms for screen distances. This option may be overridden with -spacing2 options in tags.

Spacing3

Requests additional space below each text line in the widget, using any of the standard forms for screen distances. If a line wraps, this option only applies to the last line on the display. This option may be overridden with -spacing3 options in tags.

Startline

Specifies an integer line index representing the first line of the underlying textual data store that should be contained in the widget. This allows a text widget to reflect only a portion of a larger piece of text. Instead of an integer, the empty string can be provided to this configuration option, which will configure the widget to start at the very first line in the textual data store.

State

Specifies one of two states for the text: normal or disabled. If the text is disabled then characters may not be inserted or deleted and no insertion cursor will be displayed, even if the input focus is in the widget.

Tabs

Specifies a set of tab stops for the window. The option's value consists of a list of screen distances giving the positions of the tab stops, each of which is a distance relative to the left edge of the widget (excluding borders, padding, etc). Each position may optionally be followed in the next list element by one of the keywords left, right, center, or numeric, which specifies how to justify text relative to the tab stop. Left is the default; it causes the text following the tab character to be positioned with its left edge at the tab position. Right means that the right edge of the text following the tab character is positioned at the tab position, and center means that the text is centered at the tab position. Numeric means that the decimal point in the text is positioned at the tab position; if there is no decimal point then the least significant digit of the number is positioned just to the left of the tab position; if there is no number in the text then the text is right-justified at the tab position. For example, creates three tab stops at two-centimeter intervals; the first two use left justification and the third uses center justification.

Tabstyle

Specifies how to interpret the relationship between tab stops on a line and tabs in the text of that line. The value must be tabular (the default) or wordprocessor. Note that tabs are interpreted as they are encountered in the text. If the tab style is tabular then the n'th tab character in the line's text will be associated with the n'th tab stop defined for that line. If the tab character's x coordinate falls to the right of the n'th tab stop, then a gap of a single space will be inserted as a fallback. If the tab style is wordprocessor then any tab character being laid out will use (and be defined by) the first tab stop to the right of the preceding characters already laid out on that line. The value of the -tabstyle option may be overridden by -tabstyle options in tags.

Undo

Specifies a boolean that says whether the undo mechanism is active or not.

Width

Specifies the desired width for the window in units of characters in the font given by the -font option. If the font does not have a uniform width then the width of the character is used in translating from character units to screen units.

Wrap

Specifies how to handle lines in the text that are too long to be displayed in a single line of the text's window. The value must be none or char or word. A wrap mode of none means that each line of text appears as exactly one line on the screen; extra characters that do not fit on the screen are not displayed. In the other modes each line of text will be broken up into several screen lines if necessary to keep all the characters visible. In char mode a screen line break may occur after any character; in word mode a line break will only be made at word boundaries.

func (*TextWidget) Clear added in v0.38.0

func (w *TextWidget) Clear()

Text — Create and manipulate 'text' hypertext editing widgets

Description

Clear makes 'w' empty.

func (*TextWidget) Copy added in v0.32.0

func (w *TextWidget) Copy()

Text — Create and manipulate 'text' hypertext editing widgets

Description

Copies the selection in the widget to the clipboard, if there is a selection.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Count added in v0.48.0

func (w *TextWidget) Count(options ...any) []string

Text — Create and manipulate 'text' hypertext editing widgets

Description

Counts the number of relevant things between the two indices. If index1 is after index2, the result will be a negative number (and this holds for each of the possible options). The actual items which are counted depend on the options given. The result is a list of integers, one for the result of each counting option given. Valid counting options are -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -xpixels and -ypixels. The default value, if no option is specified, is -indices. There is an additional possible option -update which is a modifier. If given (and if the text widget is managed by a geometry manager), then all subsequent options ensure that any possible out of date information is recalculated. This currently only has any effect for the -ypixels count (which, if -update is not given, will use the text widget's current cached value for each line). This -update option is obsoleted by pathName sync, pathName pendingsync and <<WidgetViewSync>>. The count options are interpreted as follows:

  • Chars Count all characters, whether elided or not. Do not count embedded windows or images.
  • Displaychars Count all non-elided characters.
  • Displayindices Count all non-elided characters, windows and images.
  • Displaylines Count all display lines (i.e. counting one for each time a line wraps) from the line of the first index up to, but not including the display line of the second index. Therefore if they are both on the same display line, zero will be returned. By definition displaylines are visible and therefore this only counts portions of actual visible lines.
  • Indices Count all characters and embedded windows or images (i.e. everything which counts in text-widget index space), whether they are elided or not.
  • Lines Count all logical lines (irrespective of wrapping) from the line of the first index up to, but not including the line of the second index. Therefore if they are both on the same line, zero will be returned. Logical lines are counted whether they are currently visible (non-elided) or not.
  • Xpixels Count the number of horizontal pixels from the first pixel of the first index to (but not including) the first pixel of the second index. To count the total desired width of the text widget (assuming wrapping is not enabled), first find the longest line and then use “.text count -xpixels "${line}.0" "${line}.0 lineend"”.
  • Ypixels Count the number of vertical pixels from the first pixel of the first index to (but not including) the first pixel of the second index. If both indices are on the same display line, zero will be returned. To count the total number of vertical pixels in the text widget, use “.text count -ypixels 1.0 end”, and to ensure this is up to date, use “.text count -update -ypixels 1.0 end”.

The command returns a positive or negative integer corresponding to the number of items counted between the two indices. One such integer is returned for each counting option given, so a list is returned if more than one option was supplied. For example “.text count -xpixels -ypixels 1.3 4.5” is perfectly valid and will return a list of two elements.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Cut added in v0.32.0

func (w *TextWidget) Cut()

Text — Create and manipulate 'text' hypertext editing widgets

Description

Copies the selection in the widget to the clipboard and deletes the selection. If there is no selection in the widget then these keys have no effect.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Delete added in v0.37.0

func (w *TextWidget) Delete(options ...any)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Delete a range of characters from the text. If both index1 and index2 are specified, then delete all the characters starting with the one given by index1 and stopping just before index2 (i.e. the character at index2 is not deleted). If index2 does not specify a position later in the text than index1 then no characters are deleted. If index2 is not specified then the single character at index1 is deleted. Attempts to delete characters in a way that would leave the text without a newline as the last character will be tweaked by the text widget to avoid this. In particular, deletion of complete lines of text up to the end of the text will also delete the newline character just before the deleted block so that it is replaced by the new final newline of the text widget. The command returns an empty string. If more indices are given, multiple ranges of text will be deleted. All indices are first checked for validity before any deletions are made. They are sorted and the text is removed from the last range to the first range so deleted text does not cause an undesired index shifting side-effects. If multiple ranges with the same start index are given, then the longest range is used. If overlapping ranges are given, then they will be merged into spans that do not cause deletion of text outside the given ranges due to text shifted during deletion.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) EditReset added in v0.47.0

func (w *TextWidget) EditReset()

Text — Create and manipulate 'text' hypertext editing widgets

Description

Clears the undo and redo stacks.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Get added in v0.30.3

func (w *TextWidget) Get(options ...any) (r []string)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Return a range of characters from the text. The return value will be all the characters in the text starting with the one whose index is index1 and ending just before the one whose index is index2 (the character at index2 will not be returned). If index2 is omitted then the single character at index1 is returned. If there are no characters in the specified range (e.g. index1 is past the end of the file or index2 is less than or equal to index1) then an empty string is returned. If the specified range contains embedded windows, no information about them is included in the returned string. If multiple index pairs are given, multiple ranges of text will be returned in a list. Invalid ranges will not be represented with empty strings in the list. The ranges are returned in the order passed to pathName get. If the -displaychars option is given, then, within each range, only those characters which are not elided will be returned. This may have the effect that some of the returned ranges are empty strings.

BUG(jnml) TextWidget.Get currently supports only one range.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) ImageCreate added in v0.36.0

func (w *TextWidget) ImageCreate(index any, options ...Opt)

Text — Create and manipulate 'text' hypertext editing widgets

Description

This command creates a new image annotation, which will appear in the text at the position given by index. Any number of option-value pairs may be specified to configure the annotation. Returns a unique identifier that may be used as an index to refer to this image. See EMBEDDED IMAGES for information on the options that are supported, and a description of the identifier returned.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Index added in v0.43.0

func (w *TextWidget) Index(index any) (r string)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Returns the position corresponding to index in the form line.char where line is the line number and char is the character number. Index may have any of the forms described under INDICES above.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Insert added in v0.11.0

func (w *TextWidget) Insert(index any, chars string, options ...string) any

Text — Create and manipulate 'text' hypertext editing widgets

Description

Inserts all of the chars arguments just before the character at index. If index refers to the end of the text (the character after the last newline) then the new text is inserted just before the last newline instead. If there is a single chars argument and no tagList, then the new text will receive any tags that are present on both the character before and the character after the insertion point; if a tag is present on only one of these characters then it will not be applied to the new text. If tagList is specified then it consists of a list of tag names; the new characters will receive all of the tags in this list and no others, regardless of the tags present around the insertion point. If multiple chars-tagList argument pairs are present, they produce the same effect as if a separate pathName insert widget command had been issued for each pair, in order. The last tagList argument may be omitted.

The value that is passed to Tcl/Tk for the 'index' argument is obtained by fmt.Sprint(index), enabling any custom index encoding via implementing fmt.Stringer.

Indices

Many of the widget commands for texts take one or more indices as arguments. An index is a string used to indicate a particular place within a text, such as a place to insert characters or one endpoint of a range of characters to delete. Indices have the syntax

base modifier modifier modifier ...

Where base gives a starting point and the modifiers adjust the index from the starting point (e.g. move forward or backward one character). Every index must contain a base, but the modifiers are optional. Most modifiers (as documented below) allow an optional submodifier. Valid submodifiers are any and display. If the submodifier is abbreviated, then it must be followed by whitespace, but otherwise there need be no space between the submodifier and the following modifier. Typically the display submodifier adjusts the meaning of the following modifier to make it refer to visual or non-elided units rather than logical units, but this is explained for each relevant case below. Lastly, where count is used as part of a modifier, it can be positive or negative, so “base - -3 lines” is perfectly valid (and equivalent to “base +3lines”).

The base for an index must have one of the following forms:

"line.char"

Indicates char'th character on line line. Lines are numbered from 1 for consistency with other UNIX programs that use this numbering scheme. Within a line, characters are numbered from 0. If char is end then it refers to the newline character that ends the line.

This form of index can be passed as LC{line, char}.

"@x,y"

Indicates the character that covers the pixel whose x and y coordinates within the text's window are x and y.

"end"

Indicates the end of the text (the character just after the last newline).

"mark"

Indicates the character just after the mark whose name is mark (see MARKS for details).

"tag.first"

Indicates the first character in the text that has been tagged with tag. This form generates an error if no characters are currently tagged with tag.

"tag.last"

Indicates the character just after the last one in the text that has been tagged with tag. This form generates an error if no characters are currently tagged with tag.

"pathName"

Indicates the position of the embedded window whose name is pathName. This form generates an error if there is no embedded window by the given name.

"imageName"

Indicates the position of the embedded image whose name is imageName. This form generates an error if there is no embedded image by the given name.

If the base could match more than one of the above forms, such as a mark and imageName both having the same value, then the form earlier in the above list takes precedence. If modifiers follow the base index, each one of them must have one of the forms listed below. Keywords such as chars and wordend may be abbreviated as long as the abbreviation is unambiguous.

"+ count ?submodifier? chars"

Adjust the index forward by count characters, moving to later lines in the text if necessary. If there are fewer than count characters in the text after the current index, then set the index to the last index in the text. Spaces on either side of count are optional. If the display submodifier is given, elided characters are skipped over without being counted. If any is given, then all characters are counted. For historical reasons, if neither modifier is given then the count actually takes place in units of index positions (see INDICES for details). This behaviour may be changed in a future major release, so if you need an index count, you are encouraged to use indices instead wherever possible.

"- count ?submodifier? chars"

Adjust the index backward by count characters, moving to earlier lines in the text if necessary. If there are fewer than count characters in the text before the current index, then set the index to the first index in the text (1.0). Spaces on either side of count are optional. If the display submodifier is given, elided characters are skipped over without being counted. If any is given, then all characters are counted. For historical reasons, if neither modifier is given then the count actually takes place in units of index positions (see INDICES for details). This behavior may be changed in a future major release, so if you need an index count, you are encouraged to use indices instead wherever possible.

"+ count ?submodifier? indices"

Adjust the index forward by count index positions, moving to later lines in the text if necessary. If there are fewer than count index positions in the text after the current index, then set the index to the last index position in the text. Spaces on either side of count are optional. Note that an index position is either a single character or a single embedded image or embedded window. If the display submodifier is given, elided indices are skipped over without being counted. If any is given, then all indices are counted; this is also the default behaviour if no modifier is given.

"- count ?submodifier? indices"

Adjust the index backward by count index positions, moving to earlier lines in the text if necessary. If there are fewer than count index positions in the text before the current index, then set the index to the first index position (1.0) in the text. Spaces on either side of count are optional. If the display submodifier is given, elided indices are skipped over without being counted. If any is given, then all indices are counted; this is also the default behaviour if no modifier is given.

"+ count ?submodifier? lines"

Adjust the index forward by count lines, retaining the same character position within the line. If there are fewer than count lines after the line containing the current index, then set the index to refer to the same character position on the last line of the text. Then, if the line is not long enough to contain a character at the indicated character position, adjust the character position to refer to the last character of the line (the newline). Spaces on either side of count are optional. If the display submodifier is given, then each visual display line is counted separately. Otherwise, if any (or no modifier) is given, then each logical line (no matter how many times it is visually wrapped) counts just once. If the relevant lines are not wrapped, then these two methods of counting are equivalent.

"- count ?submodifier? lines"

Adjust the index backward by count logical lines, retaining the same character position within the line. If there are fewer than count lines before the line containing the current index, then set the index to refer to the same character position on the first line of the text. Then, if the line is not long enough to contain a character at the indicated character position, adjust the character position to refer to the last character of the line (the newline). Spaces on either side of count are optional. If the display submodifier is given, then each visual display line is counted separately. Otherwise, if any (or no modifier) is given, then each logical line (no matter how many times it is visually wrapped) counts just once. If the relevant lines are not wrapped, then these two methods of counting are equivalent.

"?submodifier? linestart"

Adjust the index to refer to the first index on the line. If the display submodifier is given, this is the first index on the display line, otherwise on the logical line.

"?submodifier? lineend"

Adjust the index to refer to the last index on the line (the newline). If the display submodifier is given, this is the last index on the display line, otherwise on the logical line.

"?submodifier? wordstart"

Adjust the index to refer to the first character of the word containing the current index. A word consists of any number of adjacent characters that are letters, digits, or underscores, or a single character that is not one of these. If the display submodifier is given, this only examines non-elided characters, otherwise all characters (elided or not) are examined.

"?submodifier? wordend"

Adjust the index to refer to the character just after the last one of the word containing the current index. If the current index refers to the last character of the text then it is not modified. If the display submodifier is given, this only examines non-elided characters, otherwise all characters (elided or not) are examined.

If more than one modifier is present then they are applied in left-to-right order. For example, the index “end - 1 chars” refers to the next-to-last character in the text and “insert wordstart - 1 c” refers to the character just before the first one in the word containing the insertion cursor. Modifiers are applied one by one in this left to right order, and after each step the resulting index is constrained to be a valid index in the text widget. So, for example, the index “1.0 -1c +1c” refers to the index “2.0”.

Where modifiers result in index changes by display lines, display chars or display indices, and the base refers to an index inside an elided tag, that base index is considered to be equivalent to the first following non-elided index.

Insert returns its index argument.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) InsertML added in v0.17.0

func (w *TextWidget) InsertML(list ...any)

Text — Create and manipulate 'text' hypertext editing widgets

Description

InsertML inserts 'ml' at the end of 'w', interpreting it as a HTML-like markup language.

It recognizes and treats accordingly the <br> tag.

The <img> tag is reserved for embedded images. You can inline the image directly:

InsertML("Hello", NewPhoto(...), Align("top"), "world!")

The <embed> tag is reserved for embedded widgets. You can inline a widget directly:

InsertML("Hello", Button(Txt("Foo")), Align("center"), "world!")

The <pre> tag works similarly to HTML, ie. white space and line breaks are kept. To make the content of a <pre> rendered in monospace, configure the tag, for example:

t.TagConfigure("pre", Font(CourierFont(), 10)

Other ML-tags are used as names of configured 'w' tags, if configured, ignored otherwise.

Example usage in _examples/embed.go.

func (*TextWidget) MarkGravity added in v0.45.0

func (w *TextWidget) MarkGravity(markName, direction string)

Text — Create and manipulate 'text' hypertext editing widgets

Description

If direction is not specified, returns left or right to indicate which of its adjacent characters markName is attached to. If direction is specified, it must be left or right; the gravity of markName is set to the given value.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) MarkNames added in v0.45.0

func (w *TextWidget) MarkNames() []string

Text — Create and manipulate 'text' hypertext editing widgets

Description

Returns a list whose elements are the names of all the marks that are currently set.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) MarkSet added in v0.44.0

func (w *TextWidget) MarkSet(markName string, index any)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Sets the mark named markName to a position just before the character at index. If markName already exists, it is moved from its old position; if it does not exist, a new mark is created. This command returns an empty string.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) MarkUnset added in v0.45.0

func (w *TextWidget) MarkUnset(markName ...string)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Remove the mark corresponding to each of the markName arguments. The removed marks will not be usable in indices and will not be returned by future calls to “pathName mark names”. This command returns an empty string.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Modified added in v0.41.0

func (w *TextWidget) Modified() bool

Text — Create and manipulate 'text' hypertext editing widgets

Description

Returns the modified flag of the widget. The insert, delete, edit undo and edit redo commands or the user can set or clear the modified flag.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Paste added in v0.32.0

func (w *TextWidget) Paste()

Text — Create and manipulate 'text' hypertext editing widgets

Description

Inserts the contents of the clipboard at the position of the insertion cursor.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Redo added in v0.31.0

func (w *TextWidget) Redo()

Text — Create and manipulate 'text' hypertext editing widgets

Description

When the -undo option is true, reapplies the last undone edits provided no other edits were done since then, and returns a list of indices indicating what ranges were changed by the redo operation. Generates an error when the redo stack is empty. Does nothing when the -undo option is false.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Search added in v0.44.0

func (w *TextWidget) Search(options ...any) string

Text — Create and manipulate 'text' hypertext editing widgets

Searches the text in pathName starting at index for a range of characters that matches pattern. If a match is found, the index of the first character in the match is returned as result; otherwise an empty string is returned. One or more of the following switches (or abbreviations thereof) may be specified to control the search:

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) See added in v0.43.0

func (w *TextWidget) See(index any)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Adjusts the view in the window so that the character given by index is completely visible. If index is already visible then the command does nothing. If index is a short distance out of view, the command adjusts the view just enough to make index visible at the edge of the window. If index is far out of view, then the command centers index in the window.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) SelectAll added in v0.41.0

func (w *TextWidget) SelectAll()

Text — Create and manipulate 'text' hypertext editing widgets

Description

Select all text in 'w'.

func (*TextWidget) SetModified added in v0.41.0

func (w *TextWidget) SetModified(v bool)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Sets the modified flag of the widget to 'v'.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) TagAdd added in v0.11.0

func (w *TextWidget) TagAdd(tagName string, indexes ...any) string

Text — Create and manipulate 'text' hypertext editing widgets

Description

Associate the tag name with all of the characters starting with index1 and ending just before index2 (the character at index2 is not tagged). A single command may contain any number of index1-index2 pairs. If the last index2 is omitted then the single character at index1 is tagged. If there are no characters in the specified range (e.g. index1 is past the end of the file or index2 is less than or equal to index1) then the command has no effect.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) TagBind added in v0.40.0

func (w *TextWidget) TagBind(tag, sequence string, handler any) string

Text — Create and manipulate 'text' hypertext editing widgets

Description

This command associates a script with the tag given by tagName. Whenever the event sequence given by sequence occurs for a character that has been tagged with tagName, the script will be invoked. This widget command is similar to the bind command except that it operates on characters in a text rather than entire widgets. See the bind manual entry for complete details on the syntax of sequence and the substitutions performed on script before invoking it. A new binding is created, replacing any existing binding for the same sequence and tagName. The only events for which bindings may be specified are those related to the mouse and keyboard (such as Enter, Leave, Button, Motion, and Key) or virtual events. Mouse and keyboard event bindings for a text widget respectively use the current and insert marks described under MARKS above. An Enter event triggers for a tag when the tag first becomes present on the current character, and a Leave event triggers for a tag when it ceases to be present on the current character. Enter and Leave events can happen either because the current mark moved or because the character at that position changed. Note that these events are different than Enter and Leave events for windows. Mouse events are directed to the current character, while keyboard events are directed to the insert character. If a virtual event is used in a binding, that binding can trigger only if the virtual event is defined by an underlying mouse-related or keyboard-related event.

It is possible for the current character to have multiple tags, and for each of them to have a binding for a particular event sequence. When this occurs, one binding is invoked for each tag, in order from lowest-priority to highest priority. If there are multiple matching bindings for a single tag, then the most specific binding is chosen (see the manual entry for the bind command for details). continue and break commands within binding scripts are processed in the same way as for bindings created with the bind command.

If bindings are created for the widget as a whole using the bind command, then those bindings will supplement the tag bindings. The tag bindings will be invoked first, followed by bindings for the window as a whole.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) TagConfigure added in v0.11.0

func (w *TextWidget) TagConfigure(tagName string, options ...Opt)

Text — Create and manipulate 'text' hypertext editing widgets

Description

This command is similar to the pathName configure widget command except that it modifies options associated with the tag given by tagName instead of modifying options for the overall text widget. If no option is specified, the command returns a list describing all of the available options for tagName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given option(s) to have the given value(s) in tagName; in this case the command returns an empty string. See TAGS above for details on the options available for tags.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) TagDelete added in v0.38.0

func (w *TextWidget) TagDelete(tags ...string)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Deletes all tag information for each of the tagName arguments. The command removes the tags from all characters in the file and also deletes any other information associated with the tags, such as bindings and display information. The command returns an empty string.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) TagNames added in v0.38.0

func (w *TextWidget) TagNames(index string) []string

Text — Create and manipulate 'text' hypertext editing widgets

Description

Returns a list whose elements are the names of all the tags that are active at the character position given by index. If index is omitted, then the return value will describe all of the tags that exist for the text (this includes all tags that have been named in a “pathName tag” widget command but have not been deleted by a “pathName tag delete” widget command, even if no characters are currently marked with the tag). The list will be sorted in order from lowest priority to highest priority.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) TagRanges added in v0.51.0

func (w *TextWidget) TagRanges(tagName string) (r []string)

Text — Create and manipulate 'text' hypertext editing widgets

Description

Returns a list describing all of the ranges of text that have been tagged with tagName. The first two elements of the list describe the first tagged range in the text, the next two elements describe the second range, and so on. The first element of each pair contains the index of the first character of the range, and the second element of the pair contains the index of the character just after the last one in the range. If there are no characters tagged with tag then an empty string is returned.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) TagRemove added in v0.62.0

func (w *TextWidget) TagRemove(tagName string, indexes ...any) string

Text — Create and manipulate 'text' hypertext editing widgets

Description

Remove the tag tagName from all of the characters starting at index1 and ending just before index2 (the character at index2 is not affected). A single command may contain any number of index1-index2 pairs. If the last index2 is omitted then the tag is removed from the single character at index1. If there are no characters in the specified range (e.g. index1 is past the end of the file or index2 is less than or equal to index1) then the command has no effect. This command returns an empty string.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Text added in v0.31.0

func (w *TextWidget) Text() string

Text is a shortcut for w.Get("1.0", "end-1c")[0].

func (*TextWidget) Undo added in v0.31.0

func (w *TextWidget) Undo()

Text — Create and manipulate 'text' hypertext editing widgets

Description

Undoes the last edit action when the -undo option is true, and returns a list of indices indicating what ranges were changed by the undo operation. An edit action is defined as all the insert and delete commands that are recorded on the undo stack in between two separators. Generates an error when the undo stack is empty. Does nothing when the -undo option is false.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) WindowCreate added in v0.36.0

func (w *TextWidget) WindowCreate(index any, options ...Opt)

Text — Create and manipulate 'text' hypertext editing widgets

Description

This command creates a new window annotation, which will appear in the text at the position given by index. Any number of option-value pairs may be specified to configure the annotation. See EMBEDDED WINDOWS for information on the options that are supported. Returns an empty string.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Xview added in v0.17.0

func (w *TextWidget) Xview() string

Text — Create and manipulate 'text' hypertext editing widgets

Description

Returns a list containing two elements, both of which are real fractions between 0 and 1. The first element gives the position of the first visible pixel of the first character (or image, etc) in the top line in the window, relative to the text as a whole (0.5 means it is halfway through the text, for example). The second element gives the position of the first pixel just after the last visible one in the bottom line of the window, relative to the text as a whole. These are the same values passed to scrollbars via the -xscrollcommand option.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Yview added in v0.16.2

func (w *TextWidget) Yview() string

Text — Create and manipulate 'text' hypertext editing widgets

Description

Returns a list containing two elements, both of which are real fractions between 0 and 1. The first element gives the position of the first visible pixel of the first character (or image, etc) in the top line in the window, relative to the text as a whole (0.5 means it is halfway through the text, for example). The second element gives the position of the first pixel just after the last visible one in the bottom line of the window, relative to the text as a whole. These are the same values passed to scrollbars via the -yscrollcommand option.

Additional information might be available at the Tcl/Tk text page.

func (*TextWidget) Yviewmoveto added in v0.43.0

func (w *TextWidget) Yviewmoveto(fraction any) string

Text — Create and manipulate 'text' hypertext editing widgets

Description

Adjusts the view in the window so that the pixel given by fraction appears at the top of the top line of the window. Fraction is a fraction between 0 and 1; 0 indicates the first pixel of the first character in the text, 0.33 indicates the pixel that is one-third the way through the text; and so on. Values close to 1 will indicate values close to the last pixel in the text (1 actually refers to one pixel beyond the last pixel), but in such cases the widget will never scroll beyond the last pixel, and so a value of 1 will effectively be rounded back to whatever fraction ensures the last pixel is at the bottom of the window, and some other pixel is at the top.

Additional information might be available at the Tcl/Tk text page.

type Theme added in v0.53.0

type Theme interface {
	// Activate makes the theme active/in use. The Activate method of themes in
	// Themes automatically call Initialize if it was not called before.
	Activate(context ThemeContext) error
	// Deactivate makes the theme not active. Deactivate cannot be called before
	// Activate().
	Deactivate(context ThemeContext) error
	// Finalize is called to perform any cleanup. After Finalize returns, the theme
	// cannot be used. The Finalize method of themes in Themes automatically remove
	// the theme from Themes after Finalize completes.
	Finalize(context ThemeContext) error
	// Initialize is called to perform any one-time initialization of a theme. The
	// Initialize method of themes in Themes can be called multiple times but only
	// the first successful call to Initialize will have any effect.
	Initialize(context ThemeContext) error
}

Theme provides handling of a Tk theme. When calling Theme methods registered in Theme, the context argument is ignored and an instance is created automatically.

func CurrentTheme added in v0.53.0

func CurrentTheme() Theme

CurrentTheme returns the currently activated theme, if any.

type ThemeContext added in v0.53.0

type ThemeContext interface {
	Eval(tcl string) (r string, err error)
}

ThemeContext provides context to Theme methods.

type ThemeKey added in v0.53.0

type ThemeKey struct {
	Type string
	Name string
}

ThemeKey indexes Themes

func RegisterTheme added in v0.53.0

func RegisterTheme(name string, t Theme) (r ThemeKey, err error)

RegisterTheme registers t.

type Ticker added in v0.30.2

type Ticker struct {
	// contains filtered or unexported fields
}

func NewTicker added in v0.30.2

func NewTicker(d time.Duration, handler func()) (r *Ticker, err error)

type ToplevelWidget added in v0.11.0

type ToplevelWidget struct {
	*Window
}

ToplevelWidget represents the Tcl/Tk toplevel widget/window

func Toplevel added in v0.2.0

func Toplevel(options ...Opt) *ToplevelWidget

Toplevel — Create and manipulate 'toplevel' main and popup window widgets

Description

The toplevel command creates a new toplevel widget (given by the pathName argument). Additional options, described above, may be specified on the command line or in the option database to configure aspects of the toplevel such as its background color and relief. The toplevel command returns the path name of the new window.

A toplevel is similar to a frame except that it is created as a top-level window: its X parent is the root window of a screen rather than the logical parent from its Tk path name. The primary purpose of a toplevel is to serve as a container for dialog boxes and other collections of widgets. The only visible features of a toplevel are its background and an optional 3-D border to make the toplevel appear raised or sunken.

Use Window.Toplevel to create a Toplevel with a particular parent.

More information might be available at the Tcl/Tk toplevel page.

Standard options

Widget specific options

Background

This option is the same as the standard -background option except that its value may also be specified as an empty string. In this case, the widget will display no background or border, and no colors will be consumed from its colormap for its background and border. An empty background will disable drawing the background image.

Backgroundimage

This specifies an image to display on the toplevel's background within the border of the toplevel (i.e., the image will be clipped by the toplevel's highlight ring and border, if either are present) on top of the background; subwidgets of the toplevel will be drawn on top. The image must have been created with the image create command. If specified as the empty string, no image will be displayed.

Class

Specifies a class for the window. This class will be used when querying the option database for the window's other options, and it will also be used later for other purposes such as bindings. Some window managers display the class name for windows in their dock while some others display the window title. The -class option may not be changed with the configure widget command.

Colormap

Specifies a colormap to use for the window. The value may be either new, in which case a new colormap is created for the window and its children, or the name of another window (which must be on the same screen and have the same visual as pathName), in which case the new window will use the colormap from the specified window. If the -colormap option is not specified, the new window uses the default colormap of its screen. This option may not be changed with the configure widget command.

Container

The value must be a boolean. If true, it means that this window will be used as a container in which some other application will be embedded (for example, a Tk toplevel can be embedded using the -use option). The window will support the appropriate window manager protocols for things like geometry requests. The window should not have any children of its own in this application. This option may not be changed with the configure widget command.

Height

Specifies the desired height for the window in any of the forms acceptable to Tk_GetPixels. If this option is negative or zero then the window will not request any size at all.

Mnu

Specifies a menu widget to be used as a menubar. On the Macintosh, the menubar will be displayed across the top of the main monitor. On Microsoft Windows and all UNIX platforms, the menu will appear across the toplevel window as part of the window dressing maintained by the window manager.

Screen

Specifies the screen on which to place the new window. Any valid screen name may be used, even one associated with a different display. Defaults to the same screen as its parent. This option is special in that it may not be specified via the option database, and it may not be modified with the configure widget command.

Tile

This specifies how to draw the background image (see -backgroundimage) on the toplevel. If true (according to Tcl_GetBoolean), the image will be tiled to fill the whole toplevel, with the origin of the first copy of the image being the top left of the interior of the toplevel. If false (the default), the image will be centered within the toplevel.

Use

This option is used for embedding. If the value is not an empty string, it must be the window identifier of a container window, specified as a hexadecimal string like the ones returned by the winfo id command. The toplevel widget will be created as a child of the given container instead of the root window for the screen. If the container window is in a Tk application, it must be a frame or toplevel widget for which the -container option was specified. This option may not be changed with the configure widget command.

Visual

Specifies visual information for the new window in any of the forms accepted by Tk_GetVisual. If this option is not specified, the new window will use the default visual for its screen. The -visual option may not be modified with the configure widget command.

Width

Specifies the desired width for the window in any of the forms acceptable to Tk_GetPixels. If this option is negative or zero then the window will not request any size at all.

type VariableOpt added in v0.53.0

type VariableOpt struct {
	// contains filtered or unexported fields
}

VariableOpt is an Opt linking Go and Tcl variables.

func Variable added in v0.3.0

func Variable(val any) *VariableOpt

Variable option.

Known uses:

func (*VariableOpt) Get added in v0.53.0

func (v *VariableOpt) Get() (r string)

Get return the value of the linked Tcl variable.

func (*VariableOpt) Set added in v0.53.0

func (v *VariableOpt) Set(val any)

Set sets the value of the linked Tcl variable.

type Widget added in v0.11.0

type Widget interface {
	// contains filtered or unexported methods
}

Widget is implemented by every *Window

Widget implements Opt. When a Widget instance is used as an Opt, it provides its path name.

func Tooltip added in v0.49.0

func Tooltip(w Widget, options ...any) (r Widget)

tooltip — Tooltip management

Description

This command arranges for widget 'w' to display a tooltip with a message.

If the specified widget is a menu, canvas, listbox, ttk::treeview, ttk::notebook or text widget then additional options are used to tie the tooltip to specific menu, canvas or listbox items, ttk::treeview items or column headings, ttk::notebook tabs, or text widget tags.

  • Heading columnId: This option is used to set a tooltip for a ttk::treeview column heading. The column does not need to already exist. You should not use the same identifiers for columns and items in a widget for which you are using tooltips as their tooltips will be mixed. The widget must be a ttk::treeview widget.

  • Image image: The specified (photo) image will be displayed to the left of the primary tooltip message.

  • Index index: This option is used to set a tooltip on a menu item. The index may be either the entry index or the entry label. The widget must be a menu widget but the entries do not have to exist when the tooltip is set.

  • Info info: The specified info text will be displayed as additional information below the primary tooltip message.

  • Items items: This option is used to set a tooltip for canvas, listbox or ttk::treview items. For the canvas widget, the item must already be present in the canvas and will be found with a find withtag lookup. For listbox and ttk::treview widgets the item(s) may be created later but the programmer is responsible for managing the link between the listbox or ttk::treview item index and the corresponding tooltip. If the listbox or ttk::treview items are re-ordered, the tooltips will need amending.

    If the widget is not a canvas, listbox or ttk::treview then an error is raised.

  • Tab tabId: The -tab option can be used to set a tooltip for a ttk::notebook tab. The tab should already be present when this command is called, or an error will be returned. The widget must be a ttk::notebook widget.

  • Tag name: The -tag option can be used to set a tooltip for a text widget tag. The tag should already be present when this command is called, or an error will be returned. The widget must be a text widget.

  • "--": The -- option marks the end of options. The argument following this one will be treated as message even if it starts with a -.

Tooltip returns 'w'.

More information might be available at the Tklib tooltip page.

type Window added in v0.2.0

type Window struct {
	// contains filtered or unexported fields
}

Window represents a Tk window/widget. It implements common widget methods.

Window implements Opt. When a Window instance is used as an Opt, it provides its path name.

func WinfoChildren added in v0.56.4

func WinfoChildren(w *Window) (r []*Window)

winfo — Return window-related information

Description

Returns a slice of all the children of window. Top-level windows are returned as children of their logical parents. The list is in stacking order, with the lowest window first, except for Top-level windows which are not returned in stacking order. Use the wm stackorder command to query the stacking order of Top-level windows.

More information might be available at the Tcl/Tk winfo page.

func (*Window) Activebackground added in v0.5.18

func (w *Window) Activebackground() string

Activebackground — Get the configured option value.

Known uses:

func (*Window) Activeborderwidth added in v0.5.18

func (w *Window) Activeborderwidth() string

Activeborderwidth — Get the configured option value.

Known uses:

func (*Window) Activeforeground added in v0.5.18

func (w *Window) Activeforeground() string

Activeforeground — Get the configured option value.

Known uses:

func (*Window) Activerelief added in v0.5.18

func (w *Window) Activerelief() string

Activerelief — Get the configured option value.

Known uses:

func (*Window) Activestyle added in v0.5.18

func (w *Window) Activestyle() string

Activestyle — Get the configured option value.

Known uses:

func (*Window) Anchor added in v0.5.18

func (w *Window) Anchor() string

Anchor — Get the configured option value.

Known uses:

func (*Window) Aspect added in v0.5.18

func (w *Window) Aspect() string

Aspect — Get the configured option value.

Known uses:

func (*Window) Autoseparators added in v0.5.18

func (w *Window) Autoseparators() string

Autoseparators — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Background added in v0.5.18

func (w *Window) Background() string

Background — Get the configured option value.

Known uses:

func (*Window) Backgroundimage added in v0.5.18

func (w *Window) Backgroundimage() string

Backgroundimage — Get the configured option value.

Known uses:

func (*Window) Bigincrement added in v0.5.18

func (w *Window) Bigincrement() string

Bigincrement — Get the configured option value.

Known uses:

  • Scale (widget specific)

func (*Window) Bitmap added in v0.5.18

func (w *Window) Bitmap() string

Bitmap — Get the configured option value.

Known uses:

func (*Window) Blockcursor added in v0.5.18

func (w *Window) Blockcursor() string

Blockcursor — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Borderwidth added in v0.5.18

func (w *Window) Borderwidth() string

Borderwidth — Get the configured option value.

Known uses:

func (*Window) Busy added in v0.5.18

func (w *Window) Busy(options ...Opt)

Busy — confine pointer events to a window sub-tree

Description

The Busy command provides a simple means to block pointer events from Tk widgets, while overriding the widget's cursor with a configurable busy cursor. Note this command does not prevent keyboard events from being sent to the widgets made busy.

Specifies the cursor to be displayed when the widget is made busy. CursorName can be in any form accepted by Tk_GetCursor. The default cursor is wait on Windows and watch on other platforms.

More information might be available at the [Tcl/Tk busy] page.

func (*Window) BusyForget added in v0.5.18

func (w *Window) BusyForget(options ...Opt)

BusyForget — undo Busy

Description

Releases resources allocated by the Window.Busy command for window, including the transparent window. User events will again be received by window. Resources are also released when window is destroyed. Window must be the name of a widget specified in the hold operation, otherwise an error is reported.

More information might be available at the [Tcl/Tk busy] page.

func (*Window) Button added in v0.2.0

func (w *Window) Button(options ...Opt) *ButtonWidget

Button — Create and manipulate 'button' action widgets

The resulting Window is a child of 'w'

For details please see Button

func (*Window) Buttonbackground added in v0.5.18

func (w *Window) Buttonbackground() string

Buttonbackground — Get the configured option value.

Known uses:

func (*Window) Buttoncursor added in v0.5.18

func (w *Window) Buttoncursor() string

Buttoncursor — Get the configured option value.

Known uses:

func (*Window) Buttondownrelief added in v0.5.18

func (w *Window) Buttondownrelief() string

Buttondownrelief — Get the configured option value.

Known uses:

func (*Window) Buttonuprelief added in v0.5.18

func (w *Window) Buttonuprelief() string

Buttonuprelief — Get the configured option value.

Known uses:

func (*Window) Canvas added in v0.2.0

func (w *Window) Canvas(options ...Opt) *CanvasWidget

Canvas — Create and manipulate 'canvas' hypergraphics drawing surface widgets

The resulting Window is a child of 'w'

For details please see Canvas

func (*Window) Center added in v0.5.18

func (w *Window) Center() *Window

Center centers 'w' and returns 'w'.

func (*Window) Checkbutton added in v0.2.0

func (w *Window) Checkbutton(options ...Opt) *CheckbuttonWidget

Checkbutton — Create and manipulate 'checkbutton' boolean selection widgets

The resulting Window is a child of 'w'

For details please see Checkbutton

func (*Window) Class added in v0.5.18

func (w *Window) Class() string

Class — Get the configured option value.

Known uses:

func (*Window) Closeenough added in v0.5.18

func (w *Window) Closeenough() string

Closeenough — Get the configured option value.

Known uses:

func (*Window) Colormap added in v0.5.18

func (w *Window) Colormap() string

Colormap — Get the configured option value.

Known uses:

func (*Window) Columns added in v0.5.18

func (w *Window) Columns() string

Columns — Get the configured option value.

Known uses:

func (*Window) Compound added in v0.5.18

func (w *Window) Compound() string

Compound — Get the configured option value.

Known uses:

func (*Window) Configure added in v0.4.12

func (w *Window) Configure(options ...Opt) *Window

Configure alters the configuration of 'w' and returns 'w'.

func (*Window) Confine added in v0.5.18

func (w *Window) Confine() string

Confine — Get the configured option value.

Known uses:

func (*Window) Container added in v0.5.18

func (w *Window) Container() string

Container — Get the configured option value.

Known uses:

func (*Window) Default added in v0.5.18

func (w *Window) Default() string

Default — Get the configured option value.

Known uses:

func (*Window) Digits added in v0.5.18

func (w *Window) Digits() string

Digits — Get the configured option value.

Known uses:

  • Scale (widget specific)

func (*Window) Direction added in v0.5.18

func (w *Window) Direction() string

Direction — Get the configured option value.

Known uses:

func (*Window) Disabledbackground added in v0.5.18

func (w *Window) Disabledbackground() string

Disabledbackground — Get the configured option value.

Known uses:

func (*Window) Disabledforeground added in v0.5.18

func (w *Window) Disabledforeground() string

Disabledforeground — Get the configured option value.

Known uses:

func (*Window) Displaycolumns added in v0.5.18

func (w *Window) Displaycolumns() string

Displaycolumns — Get the configured option value.

Known uses:

func (*Window) Elementborderwidth added in v0.5.18

func (w *Window) Elementborderwidth() string

Elementborderwidth — Get the configured option value.

Known uses:

func (*Window) Endline added in v0.5.18

func (w *Window) Endline() string

Endline — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Entry added in v0.2.0

func (w *Window) Entry(options ...Opt) *EntryWidget

Entry — Create and manipulate 'entry' one-line text entry widgets

The resulting Window is a child of 'w'

For details please see Entry

func (*Window) Exit added in v0.5.18

func (w *Window) Exit(options ...Opt) *ButtonWidget

Exit provides a canned Button with default Txt "Exit", bound to the ExitHandler.

The resulting Window is a child of 'w'

func (*Window) Exportselection added in v0.5.18

func (w *Window) Exportselection() string

Exportselection — Get the configured option value.

Known uses:

func (*Window) Font added in v0.19.3

func (w *Window) Font() string

Font — Get the configured option value.

Known uses:

func (*Window) Foreground added in v0.5.18

func (w *Window) Foreground() string

Foreground — Get the configured option value.

Known uses:

func (*Window) Format added in v0.5.18

func (w *Window) Format() string

Format — Get the configured option value.

Known uses:

func (*Window) Frame added in v0.2.0

func (w *Window) Frame(options ...Opt) *FrameWidget

Frame — Create and manipulate 'frame' simple container widgets

The resulting Window is a child of 'w'

For details please see Frame

func (*Window) Handlepad added in v0.5.18

func (w *Window) Handlepad() string

Handlepad — Get the configured option value.

Known uses:

func (*Window) Handlesize added in v0.5.18

func (w *Window) Handlesize() string

Handlesize — Get the configured option value.

Known uses:

func (*Window) Height added in v0.5.18

func (w *Window) Height() string

Height — Get the configured option value.

Known uses:

func (*Window) Highlightbackground added in v0.5.18

func (w *Window) Highlightbackground() string

Highlightbackground — Get the configured option value.

Known uses:

func (*Window) Highlightcolor added in v0.5.18

func (w *Window) Highlightcolor() string

Highlightcolor — Get the configured option value.

Known uses:

func (*Window) Highlightthickness added in v0.5.18

func (w *Window) Highlightthickness() string

Highlightthickness — Get the configured option value.

Known uses:

func (*Window) IconPhoto added in v0.5.18

func (w *Window) IconPhoto(options ...Opt)

IconPhoto — change window icon

Description

IconPhoto sets the titlebar icon for window based on the named photo images. If -default is specified, this is applied to all future created toplevels as well. The data in the images is taken as a snapshot at the time of invocation. If the images are later changed, this is not reflected to the titlebar icons. Multiple images are accepted to allow different images sizes (e.g., 16x16 and 32x32) to be provided. The window manager may scale provided icons to an appropriate size.

On Windows, the images are packed into a Windows icon structure. This will override an ico specified to wm iconbitmap, and vice versa. This command sets the taskbar icon for the window.

On X, the images are arranged into the _NET_WM_ICON X property, which most modern window managers support. A wm iconbitmap may exist simultaneously. It is recommended to use not more than 2 icons, placing the larger icon first. This command also sets the panel icon for the application if the window manager or desktop environment supports it.

On Macintosh, the first image called is loaded into an OSX-native icon format, and becomes the application icon in dialogs, the Dock, and other contexts. At the script level the command will accept only the first image passed in the parameters as support for multiple sizes/resolutions on macOS is outside Tk's scope. Developers should use the largest icon they can support (preferably 512 pixels) to ensure smooth rendering on the Mac.

More information might be available at the Tcl/Tk wm page.

func (*Window) Image added in v0.5.18

func (w *Window) Image() string

Image — Get the configured option value.

Known uses:

func (*Window) Inactiveselectbackground added in v0.5.18

func (w *Window) Inactiveselectbackground() string

Inactiveselectbackground — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Increment added in v0.5.18

func (w *Window) Increment() string

Increment — Get the configured option value.

Known uses:

func (*Window) Indicatoron added in v0.5.18

func (w *Window) Indicatoron() string

Indicatoron — Get the configured option value.

Known uses:

func (*Window) Insertbackground added in v0.5.18

func (w *Window) Insertbackground() string

Insertbackground — Get the configured option value.

Known uses:

func (*Window) Insertborderwidth added in v0.5.18

func (w *Window) Insertborderwidth() string

Insertborderwidth — Get the configured option value.

Known uses:

func (*Window) Insertofftime added in v0.5.18

func (w *Window) Insertofftime() string

Insertofftime — Get the configured option value.

Known uses:

func (*Window) Insertontime added in v0.5.18

func (w *Window) Insertontime() string

Insertontime — Get the configured option value.

Known uses:

func (*Window) Insertunfocussed added in v0.5.18

func (w *Window) Insertunfocussed() string

Insertunfocussed — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Insertwidth added in v0.5.18

func (w *Window) Insertwidth() string

Insertwidth — Get the configured option value.

Known uses:

func (*Window) Jump added in v0.5.18

func (w *Window) Jump() string

Jump — Get the configured option value.

Known uses:

func (*Window) Justify added in v0.5.18

func (w *Window) Justify() string

Justify — Get the configured option value.

Known uses:

func (*Window) Label added in v0.2.0

func (w *Window) Label(options ...Opt) *LabelWidget

Label — Create and manipulate 'label' non-interactive text or image widgets

The resulting Window is a child of 'w'

For details please see Label

func (*Window) Labelanchor added in v0.5.18

func (w *Window) Labelanchor() string

Labelanchor — Get the configured option value.

Known uses:

func (*Window) Labelframe added in v0.2.0

func (w *Window) Labelframe(options ...Opt) *LabelframeWidget

Labelframe — Create and manipulate 'labelframe' labelled container widgets

The resulting Window is a child of 'w'

For details please see Labelframe

func (*Window) Labelwidget added in v0.5.18

func (w *Window) Labelwidget() string

Labelwidget — Get the configured option value.

Known uses:

func (*Window) Lbl added in v0.5.18

func (w *Window) Lbl() string

Lbl — Get the configured option value.

Known uses:

  • Scale (widget specific)

func (*Window) Length added in v0.5.18

func (w *Window) Length() string

Length — Get the configured option value.

Known uses:

func (*Window) Listbox added in v0.2.0

func (w *Window) Listbox(options ...Opt) *ListboxWidget

Listbox — Create and manipulate 'listbox' item list widgets

The resulting Window is a child of 'w'

For details please see Listbox

func (*Window) Listvariable added in v0.5.18

func (w *Window) Listvariable() string

Listvariable — Get the configured option value.

Known uses:

func (*Window) Lower added in v0.5.18

func (w *Window) Lower(belowThis Widget)

Lower — Change a window's position in the stacking order

Description

If the belowThis argument is nil then the command lowers window so that it is below all of its siblings in the stacking order (it will be obscured by any siblings that overlap it and will not obscure any siblings). If belowThis is specified then it must be the path name of a window that is either a sibling of window or the descendant of a sibling of window. In this case the lower command will insert window into the stacking order just below belowThis (or the ancestor of belowThis that is a sibling of window); this could end up either raising or lowering window.

All toplevel windows may be restacked with respect to each other, whatever their relative path names, but the window manager is not obligated to strictly honor requests to restack.

Additional information might be available at the Tcl/Tk lower page.

func (*Window) Maximum added in v0.5.18

func (w *Window) Maximum() string

Maximum — Get the configured option value.

Known uses:

func (*Window) Maxundo added in v0.5.18

func (w *Window) Maxundo() string

Maxundo — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Menu added in v0.2.0

func (w *Window) Menu(options ...Opt) *MenuWidget

Menu — Create and manipulate 'menu' widgets and menubars

The resulting Window is a child of 'w'

For details please see Menu

func (*Window) Menubutton added in v0.2.0

func (w *Window) Menubutton(options ...Opt) *MenubuttonWidget

Menubutton — Create and manipulate 'menubutton' pop-up menu indicator widgets

The resulting Window is a child of 'w'

For details please see Menubutton

func (*Window) Message added in v0.2.0

func (w *Window) Message(options ...Opt) *MessageWidget

Message — Create and manipulate 'message' non-interactive text widgets

The resulting Window is a child of 'w'

For details please see Message

func (*Window) Mnu added in v0.5.18

func (w *Window) Mnu() string

Mnu — Get the configured option value.

Known uses:

func (*Window) Mode added in v0.5.18

func (w *Window) Mode() string

Mode — Get the configured option value.

Known uses:

func (*Window) Offrelief added in v0.5.18

func (w *Window) Offrelief() string

Offrelief — Get the configured option value.

Known uses:

func (*Window) Offvalue added in v0.5.18

func (w *Window) Offvalue() string

Offvalue — Get the configured option value.

Known uses:

func (*Window) Onvalue added in v0.5.18

func (w *Window) Onvalue() string

Onvalue — Get the configured option value.

Known uses:

func (*Window) Opaqueresize added in v0.5.18

func (w *Window) Opaqueresize() string

Opaqueresize — Get the configured option value.

Known uses:

func (*Window) OptionMenu added in v0.2.0

func (w *Window) OptionMenu(varName *VariableOpt, options ...any) (r *OptionMenuWidget)

tk_optionMenu — Create an option menubutton and its menu

The resulting Widget is a child of 'w'

For details please see Button

func (*Window) Orient added in v0.5.18

func (w *Window) Orient() string

Orient — Get the configured option value.

Known uses:

func (*Window) Overrelief added in v0.5.18

func (w *Window) Overrelief() string

Overrelief — Get the configured option value.

Known uses:

func (*Window) Padding added in v0.5.18

func (w *Window) Padding() string

Padding — Get the configured option value.

Known uses:

func (*Window) Padx added in v0.5.18

func (w *Window) Padx() string

Padx — Get the configured option value.

Known uses:

func (*Window) Pady added in v0.5.18

func (w *Window) Pady() string

Pady — Get the configured option value.

Known uses:

func (*Window) Panedwindow added in v0.2.0

func (w *Window) Panedwindow(options ...Opt) *PanedwindowWidget

Panedwindow — Create and manipulate 'panedwindow' split container widgets

The resulting Window is a child of 'w'

For details please see Panedwindow

func (*Window) Phase added in v0.5.18

func (w *Window) Phase() string

Phase — Get the configured option value.

Known uses:

func (*Window) Placeholder added in v0.5.18

func (w *Window) Placeholder() string

Placeholder — Get the configured option value.

Known uses:

func (*Window) Placeholderforeground added in v0.5.18

func (w *Window) Placeholderforeground() string

Placeholderforeground — Get the configured option value.

Known uses:

func (*Window) Proxybackground added in v0.5.18

func (w *Window) Proxybackground() string

Proxybackground — Get the configured option value.

Known uses:

func (*Window) Proxyborderwidth added in v0.5.18

func (w *Window) Proxyborderwidth() string

Proxyborderwidth — Get the configured option value.

Known uses:

func (*Window) Proxyrelief added in v0.5.18

func (w *Window) Proxyrelief() string

Proxyrelief — Get the configured option value.

Known uses:

func (*Window) Radiobutton added in v0.2.0

func (w *Window) Radiobutton(options ...Opt) *RadiobuttonWidget

Radiobutton — Create and manipulate 'radiobutton' pick-one widgets

The resulting Window is a child of 'w'

For details please see Radiobutton

func (*Window) Raise added in v0.5.18

func (w *Window) Raise(aboveThis Widget)

Raise — Change a window's position in the stacking order

Description

If the aboveThis argument is nil then the command raises window so that it is above all of its siblings in the stacking order (it will not be obscured by any siblings and will obscure any siblings that overlap it). If aboveThis is specified then it must be the path name of a window that is either a sibling of window or the descendant of a sibling of window. In this case the raise command will insert window into the stacking order just above aboveThis (or the ancestor of aboveThis that is a sibling of window); this could end up either raising or lowering window.

All toplevel windows may be restacked with respect to each other, whatever their relative path names, but the window manager is not obligated to strictly honor requests to restack.

On macOS raising an iconified toplevel window causes it to be deiconified.

Additional information might be available at the Tcl/Tk raise page.

func (*Window) Readonlybackground added in v0.5.18

func (w *Window) Readonlybackground() string

Readonlybackground — Get the configured option value.

Known uses:

func (*Window) Relief added in v0.5.18

func (w *Window) Relief() string

Relief — Get the configured option value.

Known uses:

func (*Window) Repeatdelay added in v0.5.18

func (w *Window) Repeatdelay() string

Repeatdelay — Get the configured option value.

Known uses:

func (*Window) Repeatinterval added in v0.5.18

func (w *Window) Repeatinterval() string

Repeatinterval — Get the configured option value.

Known uses:

func (*Window) Resolution added in v0.5.18

func (w *Window) Resolution() string

Resolution — Get the configured option value.

Known uses:

  • Scale (widget specific)

func (*Window) Sashcursor added in v0.5.18

func (w *Window) Sashcursor() string

Sashcursor — Get the configured option value.

Known uses:

func (*Window) Sashpad added in v0.5.18

func (w *Window) Sashpad() string

Sashpad — Get the configured option value.

Known uses:

func (*Window) Sashrelief added in v0.5.18

func (w *Window) Sashrelief() string

Sashrelief — Get the configured option value.

Known uses:

func (*Window) Sashwidth added in v0.5.18

func (w *Window) Sashwidth() string

Sashwidth — Get the configured option value.

Known uses:

func (*Window) Scale added in v0.2.0

func (w *Window) Scale(options ...Opt) *ScaleWidget

Scale — Create and manipulate 'scale' value-controlled slider widgets

The resulting Window is a child of 'w'

For details please see Scale

func (*Window) Screen added in v0.5.18

func (w *Window) Screen() string

Screen — Get the configured option value.

Known uses:

func (*Window) Scrollbar added in v0.2.0

func (w *Window) Scrollbar(options ...Opt) *ScrollbarWidget

Scrollbar — Create and manipulate 'scrollbar' scrolling control and indicator widgets

The resulting Window is a child of 'w'

For details please see Scrollbar

func (*Window) Scrollregion added in v0.5.18

func (w *Window) Scrollregion() string

Scrollregion — Get the configured option value.

Known uses:

func (*Window) Selectbackground added in v0.5.18

func (w *Window) Selectbackground() string

Selectbackground — Get the configured option value.

Known uses:

func (*Window) Selectborderwidth added in v0.5.18

func (w *Window) Selectborderwidth() string

Selectborderwidth — Get the configured option value.

Known uses:

func (*Window) Selectcolor added in v0.5.18

func (w *Window) Selectcolor() string

Selectcolor — Get the configured option value.

Known uses:

func (*Window) Selectforeground added in v0.5.18

func (w *Window) Selectforeground() string

Selectforeground — Get the configured option value.

Known uses:

func (*Window) Selectimage added in v0.5.18

func (w *Window) Selectimage() string

Selectimage — Get the configured option value.

Known uses:

func (*Window) Selectmode added in v0.5.18

func (w *Window) Selectmode() string

Selectmode — Get the configured option value.

Known uses:

func (*Window) Selecttype added in v0.5.18

func (w *Window) Selecttype() string

Selecttype — Get the configured option value.

Known uses:

func (*Window) SetResizable added in v0.39.0

func (w *Window) SetResizable(width, height bool)

SetResizable — Enable/disable window resizing

Description

This command controls whether or not the user may interactively resize a top-level window. If resizing is disabled, then the window's size will be the size from the most recent interactive resize or wm geometry command. If there has been no such operation then the window's natural size will be used.

More information might be available at the Tcl/Tk wm page.

func (*Window) Setgrid added in v0.5.18

func (w *Window) Setgrid() string

Setgrid — Get the configured option value.

Known uses:

func (*Window) Show added in v0.5.18

func (w *Window) Show() string

Show — Get the configured option value.

Known uses:

func (*Window) Showhandle added in v0.5.18

func (w *Window) Showhandle() string

Showhandle — Get the configured option value.

Known uses:

func (*Window) Showvalue added in v0.5.18

func (w *Window) Showvalue() string

Showvalue — Get the configured option value.

Known uses:

  • Scale (widget specific)

func (*Window) Sliderlength added in v0.5.18

func (w *Window) Sliderlength() string

Sliderlength — Get the configured option value.

Known uses:

  • Scale (widget specific)

func (*Window) Sliderrelief added in v0.5.18

func (w *Window) Sliderrelief() string

Sliderrelief — Get the configured option value.

Known uses:

  • Scale (widget specific)

func (*Window) Spacing1 added in v0.5.18

func (w *Window) Spacing1() string

Spacing1 — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Spacing2 added in v0.5.18

func (w *Window) Spacing2() string

Spacing2 — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Spacing3 added in v0.5.18

func (w *Window) Spacing3() string

Spacing3 — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Spinbox added in v0.2.0

func (w *Window) Spinbox(options ...Opt) *SpinboxWidget

Spinbox — Create and manipulate 'spinbox' value spinner widgets

The resulting Window is a child of 'w'

For details please see Spinbox

func (*Window) Startline added in v0.5.18

func (w *Window) Startline() string

Startline — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) State added in v0.5.18

func (w *Window) State() string

State — Get the configured option value.

Known uses:

func (*Window) String added in v0.5.18

func (w *Window) String() (r string)

String implements fmt.Stringer.

func (*Window) Striped added in v0.5.18

func (w *Window) Striped() string

Striped — Get the configured option value.

Known uses:

func (*Window) Style added in v0.5.18

func (w *Window) Style() string

Style — Get the configured option value.

Known uses:

func (*Window) TButton added in v0.2.0

func (w *Window) TButton(options ...Opt) *TButtonWidget

TButton — Widget that issues a command when pressed

The resulting Window is a child of 'w'

For details please see TButton

func (*Window) TCheckbutton added in v0.2.0

func (w *Window) TCheckbutton(options ...Opt) *TCheckbuttonWidget

TCheckbutton — On/off widget

The resulting Window is a child of 'w'

For details please see TCheckbutton

func (*Window) TCombobox added in v0.2.0

func (w *Window) TCombobox(options ...Opt) *TComboboxWidget

TCombobox — Text field with popdown selection list

The resulting Window is a child of 'w'

For details please see TCombobox

func (*Window) TEntry added in v0.2.0

func (w *Window) TEntry(options ...Opt) *TEntryWidget

TEntry — Editable text field widget

The resulting Window is a child of 'w'

For details please see TEntry

func (*Window) TExit added in v0.5.18

func (w *Window) TExit(options ...Opt) *TButtonWidget

TExit provides a canned TButton with default Txt "Exit", bound to the ExitHandler.

The resulting Window is a child of 'w'

func (*Window) TFrame added in v0.2.0

func (w *Window) TFrame(options ...Opt) *TFrameWidget

TFrame — Simple container widget

The resulting Window is a child of 'w'

For details please see TFrame

func (*Window) TLabel added in v0.2.0

func (w *Window) TLabel(options ...Opt) *TLabelWidget

TLabel — Display a text string and/or image

The resulting Window is a child of 'w'

For details please see TLabel

func (*Window) TLabelframe added in v0.2.0

func (w *Window) TLabelframe(options ...Opt) *TLabelframeWidget

TLabelframe — Container widget with optional label

The resulting Window is a child of 'w'

For details please see TLabelframe

func (*Window) TMenubutton added in v0.2.0

func (w *Window) TMenubutton(options ...Opt) *TMenubuttonWidget

TMenubutton — Widget that pops down a menu when pressed

The resulting Window is a child of 'w'

For details please see TMenubutton

func (*Window) TNotebook added in v0.2.0

func (w *Window) TNotebook(options ...Opt) *TNotebookWidget

TNotebook — Multi-paned container widget

The resulting Window is a child of 'w'

For details please see TNotebook

func (*Window) TPanedwindow added in v0.2.0

func (w *Window) TPanedwindow(options ...Opt) *TPanedwindowWidget

TPanedwindow — Multi-pane container window

The resulting Window is a child of 'w'

For details please see TPanedwindow

func (*Window) TProgressbar added in v0.2.0

func (w *Window) TProgressbar(options ...Opt) *TProgressbarWidget

TProgressbar — Provide progress feedback

The resulting Window is a child of 'w'

For details please see TProgressbar

func (*Window) TRadiobutton added in v0.2.0

func (w *Window) TRadiobutton(options ...Opt) *TRadiobuttonWidget

TRadiobutton — Mutually exclusive option widget

The resulting Window is a child of 'w'

For details please see TRadiobutton

func (*Window) TScale added in v0.2.0

func (w *Window) TScale(options ...Opt) *TScaleWidget

TScale — Create and manipulate a scale widget

The resulting Window is a child of 'w'

For details please see TScale

func (*Window) TScrollbar added in v0.2.0

func (w *Window) TScrollbar(options ...Opt) *TScrollbarWidget

TScrollbar — Control the viewport of a scrollable widget

The resulting Window is a child of 'w'

For details please see TScrollbar

func (*Window) TSeparator added in v0.2.0

func (w *Window) TSeparator(options ...Opt) *TSeparatorWidget

TSeparator — Separator bar

The resulting Window is a child of 'w'

For details please see TSeparator

func (*Window) TSizegrip added in v0.2.0

func (w *Window) TSizegrip(options ...Opt) *TSizegripWidget

TSizegrip — Bottom-right corner resize widget

The resulting Window is a child of 'w'

For details please see TSizegrip

func (*Window) TSpinbox added in v0.2.0

func (w *Window) TSpinbox(options ...Opt) *TSpinboxWidget

TSpinbox — Selecting text field widget

The resulting Window is a child of 'w'

For details please see TSpinbox

func (*Window) TTreeview added in v0.2.0

func (w *Window) TTreeview(options ...Opt) *TTreeviewWidget

TTreeview — Hierarchical multicolumn data display widget

The resulting Window is a child of 'w'

For details please see TTreeview

func (*Window) Tabs added in v0.5.18

func (w *Window) Tabs() string

Tabs — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Tabstyle added in v0.5.18

func (w *Window) Tabstyle() string

Tabstyle — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Tearoff added in v0.5.18

func (w *Window) Tearoff() string

Tearoff — Get the configured option value.

Known uses:

  • Menu (widget specific)

func (*Window) Text added in v0.2.0

func (w *Window) Text(options ...Opt) *TextWidget

Text — Create and manipulate 'text' hypertext editing widgets

The resulting Window is a child of 'w'

For details please see Text

func (*Window) Textvariable added in v0.5.18

func (w *Window) Textvariable() (r string)

Textvariable — Get the configured option value.

Known uses:

func (*Window) Tickinterval added in v0.5.18

func (w *Window) Tickinterval() string

Tickinterval — Get the configured option value.

Known uses:

  • Scale (widget specific)

func (*Window) Tile added in v0.5.18

func (w *Window) Tile() string

Tile — Get the configured option value.

Known uses:

func (*Window) Title added in v0.5.18

func (w *Window) Title() string

Title — Get the configured option value.

Known uses:

  • Menu (widget specific)

func (*Window) Titlecolumns added in v0.5.18

func (w *Window) Titlecolumns() string

Titlecolumns — Get the configured option value.

Known uses:

func (*Window) Titleitems added in v0.5.18

func (w *Window) Titleitems() string

Titleitems — Get the configured option value.

Known uses:

func (*Window) Toplevel added in v0.2.0

func (w *Window) Toplevel(options ...Opt) *ToplevelWidget

Toplevel — Create and manipulate 'toplevel' main and popup window widgets

The resulting Window is a child of 'w'

For details please see Toplevel

func (*Window) Tristateimage added in v0.5.18

func (w *Window) Tristateimage() string

Tristateimage — Get the configured option value.

Known uses:

func (*Window) Tristatevalue added in v0.5.18

func (w *Window) Tristatevalue() string

Tristatevalue — Get the configured option value.

Known uses:

func (*Window) Troughcolor added in v0.5.18

func (w *Window) Troughcolor() string

Troughcolor — Get the configured option value.

Known uses:

func (*Window) Txt added in v0.5.18

func (w *Window) Txt() string

Txt — Get the configured option value.

Known uses:

func (*Window) Type added in v0.5.18

func (w *Window) Type() string

Type — Get the configured option value.

Known uses:

func (*Window) Underline added in v0.5.18

func (w *Window) Underline() string

Underline — Get the configured option value.

Known uses:

func (*Window) Undo added in v0.5.18

func (w *Window) Undo() string

Undo — Get the configured option value.

Known uses:

  • Text (widget specific)

func (*Window) Use added in v0.5.18

func (w *Window) Use() string

Use — Get the configured option value.

Known uses:

func (*Window) Validate added in v0.5.18

func (w *Window) Validate() string

Validate — Get the configured option value.

Known uses:

func (*Window) Value added in v0.5.18

func (w *Window) Value() string

Value — Get the configured option value.

Known uses:

func (*Window) Values added in v0.5.18

func (w *Window) Values() string

Values — Get the configured option value.

Known uses:

func (*Window) Variable added in v0.5.18

func (w *Window) Variable() string

Variable — Get the configured option value.

Known uses:

func (*Window) Visual added in v0.5.18

func (w *Window) Visual() string

Visual — Get the configured option value.

Known uses:

func (*Window) Wait added in v0.5.18

func (w *Window) Wait()

Wait — Wait for a window to be destroyed

Description

Wait command waits for 'w' to be destroyed. This is typically used to wait for a user to finish interacting with a dialog box before using the result of that interaction.

While the Wwait command is waiting it processes events in the normal fashion, so the application will continue to respond to user interactions. If an event handler invokes Wait again, the nested call to Wait must complete before the outer call can complete.

func (*Window) WaitVisibility added in v0.5.18

func (w *Window) WaitVisibility()

WaitVisibility — Wait for a window to change visibility

Description

WaitVisibility command waits for a change in w's visibility state (as indicated by the arrival of a VisibilityNotify event). This form is typically used to wait for a newly-created window to appear on the screen before taking some action.

While the Wwait command is waiting it processes events in the normal fashion, so the application will continue to respond to user interactions. If an event handler invokes Wait again, the nested call to Wait must complete before the outer call can complete.

func (*Window) WidgetState added in v0.53.0

func (w *Window) WidgetState(stateSpec string) (r string)

ttk::widget — Standard options and commands supported by Tk themed widgets

Description

Modify or inquire widget state. If stateSpec is not "", sets the widget state: for each flag in stateSpec, sets the corresponding flag or clears it if prefixed by an exclamation point. Returns a new state spec indicating which flags were changed.

If stateSpec is "", returns a list of the currently-enabled state flags.

Widget States

The widget state is a bitmap of independent state flags. Widget state flags include:

  • active: The mouse cursor is over the widget and pressing a mouse button will cause some action to occur. (aka “prelight” (Gnome), “hot” (Windows), “hover”).
  • disabled: Widget is disabled under program control (aka “unavailable”, “inactive”).
  • focus: Widget has keyboard focus.
  • pressed: Widget is being pressed (aka “armed” in Motif).
  • selected: “On”, “true”, or “current” for things like checkbuttons and radiobuttons.
  • background: Windows and the Mac have a notion of an “active” or foreground window. The background state is set for widgets in a background window, and cleared for those in the foreground window.
  • readonly: Widget should not allow user modification.
  • alternate: A widget-specific alternate display format. For example, used for checkbuttons and radiobuttons in the “tristate” or “mixed” state, and for buttons with -default active.
  • invalid: The widget's value is invalid. (Potential uses: scale widget value out of bounds, entry widget value failed validation.)
  • hover: The mouse cursor is within the widget. This is similar to the active state; it is used in some themes for widgets that provide distinct visual feedback for the active widget in addition to the active element within the widget.
  • user1-user6 Freely usable for other purposes

A state specification or stateSpec is a list of state names, optionally prefixed with an exclamation point (!) indicating that the bit is off.

func (*Window) Width added in v0.5.18

func (w *Window) Width() string

Width — Get the configured option value.

Known uses:

func (*Window) WmTitle added in v0.5.18

func (w *Window) WmTitle(s string) string

WmTitle — change the window manager title

Description

If string is specified, then it will be passed to the window manager for use as the title for window (the window manager should display this string in window's title bar). In this case the command returns an empty string. If string is not specified then the command returns the current title for the window. The title for a window defaults to its name.

More information might be available at the Tcl/Tk wm page.

func (*Window) Wrap added in v0.5.18

func (w *Window) Wrap() string

Wrap — Get the configured option value.

Known uses:

func (*Window) Wraplength added in v0.5.18

func (w *Window) Wraplength() string

Wraplength — Get the configured option value.

Known uses:

func (*Window) Xscrollincrement added in v0.5.18

func (w *Window) Xscrollincrement() string

Xscrollincrement — Get the configured option value.

Known uses:

func (*Window) Yscrollincrement added in v0.5.18

func (w *Window) Yscrollincrement() string

Yscrollincrement — Get the configured option value.

Known uses:

Notes

Bugs

Directories

Path Synopsis
The same calculator as in calc.go with additional handling of keyboard input.
The same calculator as in calc.go with additional handling of keyboard input.
The b5 package is a work in progress with no stable API yet.
The b5 package is a work in progress with no stable API yet.
extensions
autoscroll
Package autoscroll provides the [tklib autoscroll].
Package autoscroll provides the [tklib autoscroll].
ctext
Package ctext provides the [tklib ctext] package.
Package ctext provides the [tklib ctext] package.
eval
Package eval provides raw Tcl eval.
Package eval provides raw Tcl eval.
ntext
Package ntext provides the [tklib ntext] package.
Package ntext provides the [tklib ntext] package.
tablelist
Package tablelist provides the [tklib tablelist].
Package tablelist provides the [tklib tablelist].
themes
azure
Package azure provides the [Azure Tk theme].
Package azure provides the [Azure Tk theme].
vnc
Package vnc provides tk9.0 applications with a built-in VNC over websockets server.
Package vnc provides tk9.0 applications with a built-in VNC over websockets server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL