prasb commited on
Commit
40da3e8
·
verified ·
1 Parent(s): de75ef1

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. my_container_sandbox/workspace/anaconda3/lib/libtinfo.so +3 -0
  3. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/ar_in.msg +6 -0
  4. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/bn.msg +49 -0
  5. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/es_ar.msg +6 -0
  6. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/es_pe.msg +6 -0
  7. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/es_py.msg +6 -0
  8. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/es_ve.msg +6 -0
  9. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/fi.msg +50 -0
  10. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/fo.msg +47 -0
  11. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/kw.msg +47 -0
  12. my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/zh_cn.msg +7 -0
  13. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/README +44 -0
  14. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/aniwave.tcl +104 -0
  15. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/arrow.tcl +241 -0
  16. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/bitmap.tcl +52 -0
  17. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/browse +66 -0
  18. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/check.tcl +71 -0
  19. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/clrpick.tcl +54 -0
  20. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/combo.tcl +61 -0
  21. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/cscroll.tcl +172 -0
  22. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/ctext.tcl +176 -0
  23. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/dialog2.tcl +18 -0
  24. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/en.msg +97 -0
  25. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/entry3.tcl +185 -0
  26. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/fontchoose.tcl +67 -0
  27. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/form.tcl +38 -0
  28. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/hscale.tcl +45 -0
  29. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/icon.tcl +51 -0
  30. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/image1.tcl +35 -0
  31. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/image2.tcl +108 -0
  32. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/items.tcl +302 -0
  33. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/ixset +328 -0
  34. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/knightstour.tcl +268 -0
  35. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/label.tcl +40 -0
  36. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/labelframe.tcl +76 -0
  37. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/license.terms +40 -0
  38. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/mclist.tcl +119 -0
  39. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/menu.tcl +180 -0
  40. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/msgbox.tcl +62 -0
  41. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/paned2.tcl +74 -0
  42. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/pendulum.tcl +197 -0
  43. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/plot.tcl +97 -0
  44. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/puzzle.tcl +82 -0
  45. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/radio.tcl +66 -0
  46. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/rmt +210 -0
  47. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/rolodex +204 -0
  48. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/ruler.tcl +175 -0
  49. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/sayings.tcl +44 -0
  50. my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/search.tcl +139 -0
.gitattributes CHANGED
@@ -157,3 +157,4 @@ my_container_sandbox/workspace/anaconda3/lib/libyaml.a filter=lfs diff=lfs merge
157
  my_container_sandbox/workspace/anaconda3/lib/libnppial.so.11.3.3.95 filter=lfs diff=lfs merge=lfs -text
158
  my_container_sandbox/workspace/anaconda3/lib/libnppisu.so.11.3.3.95 filter=lfs diff=lfs merge=lfs -text
159
  my_container_sandbox/workspace/anaconda3/lib/libyaml-0.so.2.0.9 filter=lfs diff=lfs merge=lfs -text
 
 
157
  my_container_sandbox/workspace/anaconda3/lib/libnppial.so.11.3.3.95 filter=lfs diff=lfs merge=lfs -text
158
  my_container_sandbox/workspace/anaconda3/lib/libnppisu.so.11.3.3.95 filter=lfs diff=lfs merge=lfs -text
159
  my_container_sandbox/workspace/anaconda3/lib/libyaml-0.so.2.0.9 filter=lfs diff=lfs merge=lfs -text
160
+ my_container_sandbox/workspace/anaconda3/lib/libtinfo.so filter=lfs diff=lfs merge=lfs -text
my_container_sandbox/workspace/anaconda3/lib/libtinfo.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0591f9269c4672f32dcd994254cf7f56bf3202c9016bef85948af3e7bcb1c16f
3
+ size 287080
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/ar_in.msg ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset ar_IN DATE_FORMAT "%A %d %B %Y"
4
+ ::msgcat::mcset ar_IN TIME_FORMAT_12 "%I:%M:%S %z"
5
+ ::msgcat::mcset ar_IN DATE_TIME_FORMAT "%A %d %B %Y %I:%M:%S %z %z"
6
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/bn.msg ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset bn DAYS_OF_WEEK_ABBREV [list \
4
+ "\u09b0\u09ac\u09bf"\
5
+ "\u09b8\u09cb\u09ae"\
6
+ "\u09ae\u0999\u0997\u09b2"\
7
+ "\u09ac\u09c1\u09a7"\
8
+ "\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf"\
9
+ "\u09b6\u09c1\u0995\u09cd\u09b0"\
10
+ "\u09b6\u09a8\u09bf"]
11
+ ::msgcat::mcset bn DAYS_OF_WEEK_FULL [list \
12
+ "\u09b0\u09ac\u09bf\u09ac\u09be\u09b0"\
13
+ "\u09b8\u09cb\u09ae\u09ac\u09be\u09b0"\
14
+ "\u09ae\u0999\u0997\u09b2\u09ac\u09be\u09b0"\
15
+ "\u09ac\u09c1\u09a7\u09ac\u09be\u09b0"\
16
+ "\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0"\
17
+ "\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0"\
18
+ "\u09b6\u09a8\u09bf\u09ac\u09be\u09b0"]
19
+ ::msgcat::mcset bn MONTHS_ABBREV [list \
20
+ "\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0"\
21
+ "\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09c0"\
22
+ "\u09ae\u09be\u09b0\u09cd\u099a"\
23
+ "\u098f\u09aa\u09cd\u09b0\u09bf\u09b2"\
24
+ "\u09ae\u09c7"\
25
+ "\u099c\u09c1\u09a8"\
26
+ "\u099c\u09c1\u09b2\u09be\u0987"\
27
+ "\u0986\u0997\u09b8\u09cd\u099f"\
28
+ "\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0"\
29
+ "\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0"\
30
+ "\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0"\
31
+ "\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"\
32
+ ""]
33
+ ::msgcat::mcset bn MONTHS_FULL [list \
34
+ "\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0"\
35
+ "\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09c0"\
36
+ "\u09ae\u09be\u09b0\u09cd\u099a"\
37
+ "\u098f\u09aa\u09cd\u09b0\u09bf\u09b2"\
38
+ "\u09ae\u09c7"\
39
+ "\u099c\u09c1\u09a8"\
40
+ "\u099c\u09c1\u09b2\u09be\u0987"\
41
+ "\u0986\u0997\u09b8\u09cd\u099f"\
42
+ "\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0"\
43
+ "\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0"\
44
+ "\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0"\
45
+ "\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"\
46
+ ""]
47
+ ::msgcat::mcset bn AM "\u09aa\u09c2\u09b0\u09cd\u09ac\u09be\u09b9\u09cd\u09a3"
48
+ ::msgcat::mcset bn PM "\u0985\u09aa\u09b0\u09be\u09b9\u09cd\u09a3"
49
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/es_ar.msg ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset es_AR DATE_FORMAT "%d/%m/%Y"
4
+ ::msgcat::mcset es_AR TIME_FORMAT "%H:%M:%S"
5
+ ::msgcat::mcset es_AR DATE_TIME_FORMAT "%d/%m/%Y %H:%M:%S %z"
6
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/es_pe.msg ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset es_PE DATE_FORMAT "%d/%m/%Y"
4
+ ::msgcat::mcset es_PE TIME_FORMAT_12 "%I:%M:%S %P"
5
+ ::msgcat::mcset es_PE DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z"
6
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/es_py.msg ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset es_PY DATE_FORMAT "%d/%m/%Y"
4
+ ::msgcat::mcset es_PY TIME_FORMAT_12 "%I:%M:%S %P"
5
+ ::msgcat::mcset es_PY DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z"
6
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/es_ve.msg ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset es_VE DATE_FORMAT "%d/%m/%Y"
4
+ ::msgcat::mcset es_VE TIME_FORMAT_12 "%I:%M:%S %P"
5
+ ::msgcat::mcset es_VE DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z"
6
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/fi.msg ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset fi DAYS_OF_WEEK_ABBREV [list \
4
+ "su"\
5
+ "ma"\
6
+ "ti"\
7
+ "ke"\
8
+ "to"\
9
+ "pe"\
10
+ "la"]
11
+ ::msgcat::mcset fi DAYS_OF_WEEK_FULL [list \
12
+ "sunnuntai"\
13
+ "maanantai"\
14
+ "tiistai"\
15
+ "keskiviikko"\
16
+ "torstai"\
17
+ "perjantai"\
18
+ "lauantai"]
19
+ ::msgcat::mcset fi MONTHS_ABBREV [list \
20
+ "tammi"\
21
+ "helmi"\
22
+ "maalis"\
23
+ "huhti"\
24
+ "touko"\
25
+ "kes\u00e4"\
26
+ "hein\u00e4"\
27
+ "elo"\
28
+ "syys"\
29
+ "loka"\
30
+ "marras"\
31
+ "joulu"\
32
+ ""]
33
+ ::msgcat::mcset fi MONTHS_FULL [list \
34
+ "tammikuu"\
35
+ "helmikuu"\
36
+ "maaliskuu"\
37
+ "huhtikuu"\
38
+ "toukokuu"\
39
+ "kes\u00e4kuu"\
40
+ "hein\u00e4kuu"\
41
+ "elokuu"\
42
+ "syyskuu"\
43
+ "lokakuu"\
44
+ "marraskuu"\
45
+ "joulukuu"\
46
+ ""]
47
+ ::msgcat::mcset fi DATE_FORMAT "%e.%m.%Y"
48
+ ::msgcat::mcset fi TIME_FORMAT "%k:%M:%S"
49
+ ::msgcat::mcset fi DATE_TIME_FORMAT "%e.%m.%Y %k:%M:%S %z"
50
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/fo.msg ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset fo DAYS_OF_WEEK_ABBREV [list \
4
+ "sun"\
5
+ "m\u00e1n"\
6
+ "t\u00fds"\
7
+ "mik"\
8
+ "h\u00f3s"\
9
+ "fr\u00ed"\
10
+ "ley"]
11
+ ::msgcat::mcset fo DAYS_OF_WEEK_FULL [list \
12
+ "sunnudagur"\
13
+ "m\u00e1nadagur"\
14
+ "t\u00fdsdagur"\
15
+ "mikudagur"\
16
+ "h\u00f3sdagur"\
17
+ "fr\u00edggjadagur"\
18
+ "leygardagur"]
19
+ ::msgcat::mcset fo MONTHS_ABBREV [list \
20
+ "jan"\
21
+ "feb"\
22
+ "mar"\
23
+ "apr"\
24
+ "mai"\
25
+ "jun"\
26
+ "jul"\
27
+ "aug"\
28
+ "sep"\
29
+ "okt"\
30
+ "nov"\
31
+ "des"\
32
+ ""]
33
+ ::msgcat::mcset fo MONTHS_FULL [list \
34
+ "januar"\
35
+ "februar"\
36
+ "mars"\
37
+ "apr\u00edl"\
38
+ "mai"\
39
+ "juni"\
40
+ "juli"\
41
+ "august"\
42
+ "september"\
43
+ "oktober"\
44
+ "november"\
45
+ "desember"\
46
+ ""]
47
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/kw.msg ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset kw DAYS_OF_WEEK_ABBREV [list \
4
+ "Sul"\
5
+ "Lun"\
6
+ "Mth"\
7
+ "Mhr"\
8
+ "Yow"\
9
+ "Gwe"\
10
+ "Sad"]
11
+ ::msgcat::mcset kw DAYS_OF_WEEK_FULL [list \
12
+ "De Sul"\
13
+ "De Lun"\
14
+ "De Merth"\
15
+ "De Merher"\
16
+ "De Yow"\
17
+ "De Gwener"\
18
+ "De Sadorn"]
19
+ ::msgcat::mcset kw MONTHS_ABBREV [list \
20
+ "Gen"\
21
+ "Whe"\
22
+ "Mer"\
23
+ "Ebr"\
24
+ "Me"\
25
+ "Evn"\
26
+ "Gor"\
27
+ "Est"\
28
+ "Gwn"\
29
+ "Hed"\
30
+ "Du"\
31
+ "Kev"\
32
+ ""]
33
+ ::msgcat::mcset kw MONTHS_FULL [list \
34
+ "Mys Genver"\
35
+ "Mys Whevrel"\
36
+ "Mys Merth"\
37
+ "Mys Ebrel"\
38
+ "Mys Me"\
39
+ "Mys Evan"\
40
+ "Mys Gortheren"\
41
+ "Mye Est"\
42
+ "Mys Gwyngala"\
43
+ "Mys Hedra"\
44
+ "Mys Du"\
45
+ "Mys Kevardhu"\
46
+ ""]
47
+ }
my_container_sandbox/workspace/anaconda3/lib/tcl8.6/msgs/zh_cn.msg ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # created by tools/loadICU.tcl -- do not edit
2
+ namespace eval ::tcl::clock {
3
+ ::msgcat::mcset zh_CN DATE_FORMAT "%Y-%m-%e"
4
+ ::msgcat::mcset zh_CN TIME_FORMAT "%k:%M:%S"
5
+ ::msgcat::mcset zh_CN TIME_FORMAT_12 "%P%I\u65f6%M\u5206%S\u79d2"
6
+ ::msgcat::mcset zh_CN DATE_TIME_FORMAT "%Y-%m-%e %k:%M:%S %z"
7
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/README ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This directory contains a collection of programs to demonstrate
2
+ the features of the Tk toolkit. The programs are all scripts for
3
+ "wish", a windowing shell. If wish has been installed on your path
4
+ then you can invoke any of the programs in this directory just
5
+ by typing its file name to your command shell under Unix. Otherwise
6
+ invoke wish with the file as its first argument, e.g., "wish hello".
7
+ The rest of this file contains a brief description of each program.
8
+ Files with names ending in ".tcl" are procedure packages used by one
9
+ or more of the demo programs; they can't be used as programs by
10
+ themselves so they aren't described below.
11
+
12
+ hello - Creates a single button; if you click on it, a message
13
+ is typed and the application terminates.
14
+
15
+ widget - Contains a collection of demonstrations of the widgets
16
+ currently available in the Tk library. Most of the .tcl
17
+ files are scripts for individual demos available through
18
+ the "widget" program.
19
+
20
+ ixset - A simple Tk-based wrapper for the "xset" program, which
21
+ allows you to interactively query and set various X options
22
+ such as mouse acceleration and bell volume. Thanks to
23
+ Pierre David for contributing this example.
24
+
25
+ rolodex - A mock-up of a simple rolodex application. It has much of
26
+ the user interface for such an application but no back-end
27
+ database. This program was written in response to Tom
28
+ LaStrange's toolkit benchmark challenge.
29
+
30
+ tcolor - A color editor. Allows you to edit colors in several
31
+ different ways, and will also perform automatic updates
32
+ using "send".
33
+
34
+ rmt - Allows you to "hook-up" remotely to any Tk application
35
+ on the display. Select an application with the menu,
36
+ then just type commands: they'll go to that application.
37
+
38
+ timer - Displays a seconds timer with start and stop buttons.
39
+ Control-c and control-q cause it to exit.
40
+
41
+ browse - A simple directory browser. Invoke it with and argument
42
+ giving the name of the directory you'd like to browse.
43
+ Double-click on files or subdirectories to browse them.
44
+ Control-c and control-q cause the program to exit.
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/aniwave.tcl ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # aniwave.tcl --
2
+ #
3
+ # This demonstration script illustrates how to adjust canvas item
4
+ # coordinates in a way that does something fairly similar to waveform
5
+ # display.
6
+
7
+ if {![info exists widgetDemo]} {
8
+ error "This script should be run from the \"widget\" demo."
9
+ }
10
+
11
+ package require Tk
12
+
13
+ set w .aniwave
14
+ catch {destroy $w}
15
+ toplevel $w
16
+ wm title $w "Animated Wave Demonstration"
17
+ wm iconname $w "aniwave"
18
+ positionWindow $w
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line; a trace on a variable is used so updates to the variable result in a change of position of the line."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ # Create a canvas large enough to hold the wave. In fact, the wave
28
+ # sticks off both sides of the canvas to prevent visual glitches.
29
+ pack [canvas $w.c -width 300 -height 200 -background black] -padx 10 -pady 10 -expand yes
30
+
31
+ # Ensure that this this is an array
32
+ array set animationCallbacks {}
33
+
34
+ # Creates a coordinates list of a wave. This code does a very sketchy
35
+ # job and relies on Tk's line smoothing to make things look better.
36
+ set waveCoords {}
37
+ for {set x -10} {$x<=300} {incr x 5} {
38
+ lappend waveCoords $x 100
39
+ }
40
+ lappend waveCoords $x 0 [incr x 5] 200
41
+
42
+ # Create a smoothed line and arrange for its coordinates to be the
43
+ # contents of the variable waveCoords.
44
+ $w.c create line $waveCoords -tags wave -width 1 -fill green -smooth 1
45
+ proc waveCoordsTracer {w args} {
46
+ global waveCoords
47
+ # Actual visual update will wait until we have finished
48
+ # processing; Tk does that for us automatically.
49
+ $w.c coords wave $waveCoords
50
+ }
51
+ trace add variable waveCoords write [list waveCoordsTracer $w]
52
+
53
+ # Basic motion handler. Given what direction the wave is travelling
54
+ # in, it advances the y coordinates in the coordinate-list one step in
55
+ # that direction.
56
+ proc basicMotion {} {
57
+ global waveCoords direction
58
+ set oc $waveCoords
59
+ for {set i 1} {$i<[llength $oc]} {incr i 2} {
60
+ if {$direction eq "left"} {
61
+ lset waveCoords $i [lindex $oc \
62
+ [expr {$i+2>[llength $oc] ? 1 : $i+2}]]
63
+ } else {
64
+ lset waveCoords $i \
65
+ [lindex $oc [expr {$i-2<0 ? "end" : $i-2}]]
66
+ }
67
+ }
68
+ }
69
+
70
+ # Oscillation handler. This detects whether to reverse the direction
71
+ # of the wave by checking to see if the peak of the wave has moved off
72
+ # the screen (whose size we know already.)
73
+ proc reverser {} {
74
+ global waveCoords direction
75
+ if {[lindex $waveCoords 1] < 10} {
76
+ set direction "right"
77
+ } elseif {[lindex $waveCoords end] < 10} {
78
+ set direction "left"
79
+ }
80
+ }
81
+
82
+ # Main animation "loop". This calls the two procedures that handle the
83
+ # movement repeatedly by scheduling asynchronous calls back to itself
84
+ # using the [after] command. This procedure is the fundamental basis
85
+ # for all animated effect handling in Tk.
86
+ proc move {} {
87
+ basicMotion
88
+ reverser
89
+
90
+ # Theoretically 100 frames-per-second (==10ms between frames)
91
+ global animationCallbacks
92
+ set animationCallbacks(simpleWave) [after 10 move]
93
+ }
94
+
95
+ # Initialise our remaining animation variables
96
+ set direction "left"
97
+ set animateAfterCallback {}
98
+ # Arrange for the animation loop to stop when the canvas is deleted
99
+ bind $w.c <Destroy> {
100
+ after cancel $animationCallbacks(simpleWave)
101
+ unset animationCallbacks(simpleWave)
102
+ }
103
+ # Start the animation processing
104
+ move
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/arrow.tcl ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # arrow.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget that displays a
4
+ # large line with an arrowhead whose shape can be edited interactively.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # arrowSetup --
13
+ # This procedure regenerates all the text and graphics in the canvas
14
+ # window. It's called when the canvas is initially created, and also
15
+ # whenever any of the parameters of the arrow head are changed
16
+ # interactively.
17
+ #
18
+ # Arguments:
19
+ # c - Name of the canvas widget.
20
+
21
+ proc arrowSetup c {
22
+ upvar #0 demo_arrowInfo v
23
+
24
+ # Remember the current box, if there is one.
25
+
26
+ set tags [$c gettags current]
27
+ if {$tags != ""} {
28
+ set cur [lindex $tags [lsearch -glob $tags box?]]
29
+ } else {
30
+ set cur ""
31
+ }
32
+
33
+ # Create the arrow and outline.
34
+
35
+ $c delete all
36
+ eval {$c create line $v(x1) $v(y) $v(x2) $v(y) -arrow last \
37
+ -width [expr {10*$v(width)}] -arrowshape [list \
38
+ [expr {10*$v(a)}] [expr {10*$v(b)}] [expr {10*$v(c)}]]} \
39
+ $v(bigLineStyle)
40
+ set xtip [expr {$v(x2)-10*$v(b)}]
41
+ set deltaY [expr {10*$v(c)+5*$v(width)}]
42
+ $c create line $v(x2) $v(y) $xtip [expr {$v(y)+$deltaY}] \
43
+ [expr {$v(x2)-10*$v(a)}] $v(y) $xtip [expr {$v(y)-$deltaY}] \
44
+ $v(x2) $v(y) -width 2 -capstyle round -joinstyle round
45
+
46
+ # Create the boxes for reshaping the line and arrowhead.
47
+
48
+ eval {$c create rect [expr {$v(x2)-10*$v(a)-5}] [expr {$v(y)-5}] \
49
+ [expr {$v(x2)-10*$v(a)+5}] [expr {$v(y)+5}] \
50
+ -tags {box1 box}} $v(boxStyle)
51
+ eval {$c create rect [expr {$xtip-5}] [expr {$v(y)-$deltaY-5}] \
52
+ [expr {$xtip+5}] [expr {$v(y)-$deltaY+5}] \
53
+ -tags {box2 box}} $v(boxStyle)
54
+ eval {$c create rect [expr {$v(x1)-5}] [expr {$v(y)-5*$v(width)-5}] \
55
+ [expr {$v(x1)+5}] [expr {$v(y)-5*$v(width)+5}] \
56
+ -tags {box3 box}} $v(boxStyle)
57
+ if {$cur != ""} {
58
+ eval $c itemconfigure $cur $v(activeStyle)
59
+ }
60
+
61
+ # Create three arrows in actual size with the same parameters
62
+
63
+ $c create line [expr {$v(x2)+50}] 0 [expr {$v(x2)+50}] 1000 \
64
+ -width 2
65
+ set tmp [expr {$v(x2)+100}]
66
+ $c create line $tmp [expr {$v(y)-125}] $tmp [expr {$v(y)-75}] \
67
+ -width $v(width) \
68
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
69
+ $c create line [expr {$tmp-25}] $v(y) [expr {$tmp+25}] $v(y) \
70
+ -width $v(width) \
71
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
72
+ $c create line [expr {$tmp-25}] [expr {$v(y)+75}] [expr {$tmp+25}] \
73
+ [expr {$v(y)+125}] -width $v(width) \
74
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
75
+
76
+ # Create a bunch of other arrows and text items showing the
77
+ # current dimensions.
78
+
79
+ set tmp [expr {$v(x2)+10}]
80
+ $c create line $tmp [expr {$v(y)-5*$v(width)}] \
81
+ $tmp [expr {$v(y)-$deltaY}] \
82
+ -arrow both -arrowshape $v(smallTips)
83
+ $c create text [expr {$v(x2)+15}] [expr {$v(y)-$deltaY+5*$v(c)}] \
84
+ -text $v(c) -anchor w
85
+ set tmp [expr {$v(x1)-10}]
86
+ $c create line $tmp [expr {$v(y)-5*$v(width)}] \
87
+ $tmp [expr {$v(y)+5*$v(width)}] \
88
+ -arrow both -arrowshape $v(smallTips)
89
+ $c create text [expr {$v(x1)-15}] $v(y) -text $v(width) -anchor e
90
+ set tmp [expr {$v(y)+5*$v(width)+10*$v(c)+10}]
91
+ $c create line [expr {$v(x2)-10*$v(a)}] $tmp $v(x2) $tmp \
92
+ -arrow both -arrowshape $v(smallTips)
93
+ $c create text [expr {$v(x2)-5*$v(a)}] [expr {$tmp+5}] \
94
+ -text $v(a) -anchor n
95
+ set tmp [expr {$tmp+25}]
96
+ $c create line [expr {$v(x2)-10*$v(b)}] $tmp $v(x2) $tmp \
97
+ -arrow both -arrowshape $v(smallTips)
98
+ $c create text [expr {$v(x2)-5*$v(b)}] [expr {$tmp+5}] \
99
+ -text $v(b) -anchor n
100
+
101
+ $c create text $v(x1) 310 -text "-width $v(width)" \
102
+ -anchor w -font {Helvetica 18}
103
+ $c create text $v(x1) 330 -text "-arrowshape {$v(a) $v(b) $v(c)}" \
104
+ -anchor w -font {Helvetica 18}
105
+
106
+ incr v(count)
107
+ }
108
+
109
+ set w .arrow
110
+ catch {destroy $w}
111
+ toplevel $w
112
+ wm title $w "Arrowhead Editor Demonstration"
113
+ wm iconname $w "arrow"
114
+ positionWindow $w
115
+ set c $w.c
116
+
117
+ label $w.msg -font $font -wraplength 5i -justify left -text "This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."
118
+ pack $w.msg -side top
119
+
120
+ ## See Code / Dismiss buttons
121
+ set btns [addSeeDismiss $w.buttons $w]
122
+ pack $btns -side bottom -fill x
123
+
124
+ canvas $c -width 500 -height 350 -relief sunken -borderwidth 2
125
+ pack $c -expand yes -fill both
126
+
127
+ set demo_arrowInfo(a) 8
128
+ set demo_arrowInfo(b) 10
129
+ set demo_arrowInfo(c) 3
130
+ set demo_arrowInfo(width) 2
131
+ set demo_arrowInfo(motionProc) arrowMoveNull
132
+ set demo_arrowInfo(x1) 40
133
+ set demo_arrowInfo(x2) 350
134
+ set demo_arrowInfo(y) 150
135
+ set demo_arrowInfo(smallTips) {5 5 2}
136
+ set demo_arrowInfo(count) 0
137
+ if {[winfo depth $c] > 1} {
138
+ if {[tk windowingsystem] eq "aqua"} {
139
+ set demo_arrowInfo(bigLineStyle) "-fill systemSelectedTextBackgroundColor"
140
+ } else {
141
+ set demo_arrowInfo(bigLineStyle) "-fill LightSeaGreen"
142
+ }
143
+ set demo_arrowInfo(boxStyle) "-fill {} -width 1"
144
+ set demo_arrowInfo(activeStyle) "-fill red -width 1"
145
+ } else {
146
+ # Main widget program sets variable tk_demoDirectory
147
+ set demo_arrowInfo(bigLineStyle) "-fill black \
148
+ -stipple @[file join $tk_demoDirectory images grey.25]"
149
+ set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 1"
150
+ set demo_arrowInfo(activeStyle) "-fill black -outline black -width 1"
151
+ }
152
+ arrowSetup $c
153
+ $c bind box <Enter> "$c itemconfigure current $demo_arrowInfo(activeStyle)"
154
+ $c bind box <Leave> "$c itemconfigure current $demo_arrowInfo(boxStyle)"
155
+ $c bind box <B1-Enter> " "
156
+ $c bind box <B1-Leave> " "
157
+ $c bind box1 <Button-1> {set demo_arrowInfo(motionProc) arrowMove1}
158
+ $c bind box2 <Button-1> {set demo_arrowInfo(motionProc) arrowMove2}
159
+ $c bind box3 <Button-1> {set demo_arrowInfo(motionProc) arrowMove3}
160
+ $c bind box <B1-Motion> "\$demo_arrowInfo(motionProc) $c %x %y"
161
+ bind $c <ButtonRelease-1> "arrowSetup $c"
162
+
163
+ # arrowMove1 --
164
+ # This procedure is called for each mouse motion event on box1 (the
165
+ # one at the vertex of the arrow). It updates the controlling parameters
166
+ # for the line and arrowhead.
167
+ #
168
+ # Arguments:
169
+ # c - The name of the canvas window.
170
+ # x, y - The coordinates of the mouse.
171
+
172
+ proc arrowMove1 {c x y} {
173
+ upvar #0 demo_arrowInfo v
174
+ set newA [expr {($v(x2)+5-round([$c canvasx $x]))/10}]
175
+ if {$newA < 0} {
176
+ set newA 0
177
+ }
178
+ if {$newA > 25} {
179
+ set newA 25
180
+ }
181
+ if {$newA != $v(a)} {
182
+ $c move box1 [expr {10*($v(a)-$newA)}] 0
183
+ set v(a) $newA
184
+ }
185
+ }
186
+
187
+ # arrowMove2 --
188
+ # This procedure is called for each mouse motion event on box2 (the
189
+ # one at the trailing tip of the arrowhead). It updates the controlling
190
+ # parameters for the line and arrowhead.
191
+ #
192
+ # Arguments:
193
+ # c - The name of the canvas window.
194
+ # x, y - The coordinates of the mouse.
195
+
196
+ proc arrowMove2 {c x y} {
197
+ upvar #0 demo_arrowInfo v
198
+ set newB [expr {($v(x2)+5-round([$c canvasx $x]))/10}]
199
+ if {$newB < 0} {
200
+ set newB 0
201
+ }
202
+ if {$newB > 25} {
203
+ set newB 25
204
+ }
205
+ set newC [expr {($v(y)+5-round([$c canvasy $y])-5*$v(width))/10}]
206
+ if {$newC < 0} {
207
+ set newC 0
208
+ }
209
+ if {$newC > 20} {
210
+ set newC 20
211
+ }
212
+ if {($newB != $v(b)) || ($newC != $v(c))} {
213
+ $c move box2 [expr {10*($v(b)-$newB)}] [expr {10*($v(c)-$newC)}]
214
+ set v(b) $newB
215
+ set v(c) $newC
216
+ }
217
+ }
218
+
219
+ # arrowMove3 --
220
+ # This procedure is called for each mouse motion event on box3 (the
221
+ # one that controls the thickness of the line). It updates the
222
+ # controlling parameters for the line and arrowhead.
223
+ #
224
+ # Arguments:
225
+ # c - The name of the canvas window.
226
+ # x, y - The coordinates of the mouse.
227
+
228
+ proc arrowMove3 {c x y} {
229
+ upvar #0 demo_arrowInfo v
230
+ set newWidth [expr {($v(y)+2-round([$c canvasy $y]))/5}]
231
+ if {$newWidth < 0} {
232
+ set newWidth 0
233
+ }
234
+ if {$newWidth > 20} {
235
+ set newWidth 20
236
+ }
237
+ if {$newWidth != $v(width)} {
238
+ $c move box3 0 [expr {5*($v(width)-$newWidth)}]
239
+ set v(width) $newWidth
240
+ }
241
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/bitmap.tcl ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # bitmap.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window that displays
4
+ # all of Tk's built-in bitmaps.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # bitmapRow --
13
+ # Create a row of bitmap items in a window.
14
+ #
15
+ # Arguments:
16
+ # w - The window that is to contain the row.
17
+ # args - The names of one or more bitmaps, which will be displayed
18
+ # in a new row across the bottom of w along with their
19
+ # names.
20
+
21
+ proc bitmapRow {w args} {
22
+ frame $w
23
+ pack $w -side top -fill both
24
+ set i 0
25
+ foreach bitmap $args {
26
+ frame $w.$i
27
+ pack $w.$i -side left -fill both -pady .25c -padx .25c
28
+ label $w.$i.bitmap -bitmap $bitmap
29
+ label $w.$i.label -text $bitmap -width 9
30
+ pack $w.$i.label $w.$i.bitmap -side bottom
31
+ incr i
32
+ }
33
+ }
34
+
35
+ set w .bitmap
36
+ catch {destroy $w}
37
+ toplevel $w
38
+ wm title $w "Bitmap Demonstration"
39
+ wm iconname $w "bitmap"
40
+ positionWindow $w
41
+
42
+ label $w.msg -font $font -wraplength 4i -justify left -text "This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts."
43
+ pack $w.msg -side top
44
+
45
+ ## See Code / Dismiss buttons
46
+ set btns [addSeeDismiss $w.buttons $w]
47
+ pack $btns -side bottom -fill x
48
+
49
+ frame $w.frame
50
+ bitmapRow $w.frame.0 error gray12 gray25 gray50 gray75
51
+ bitmapRow $w.frame.1 hourglass info question questhead warning
52
+ pack $w.frame -side top -expand yes -fill both
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/browse ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # browse --
6
+ # This script generates a directory browser, which lists the working
7
+ # directory and allows you to open files or subdirectories by
8
+ # double-clicking.
9
+
10
+ package require Tk
11
+
12
+ # Create a scrollbar on the right side of the main window and a listbox
13
+ # on the left side.
14
+
15
+ scrollbar .scroll -command ".list yview"
16
+ pack .scroll -side right -fill y
17
+ listbox .list -yscroll ".scroll set" -relief sunken -width 20 -height 20 \
18
+ -setgrid yes
19
+ pack .list -side left -fill both -expand yes
20
+ wm minsize . 1 1
21
+
22
+ # The procedure below is invoked to open a browser on a given file; if the
23
+ # file is a directory then another instance of this program is invoked; if
24
+ # the file is a regular file then the Mx editor is invoked to display
25
+ # the file.
26
+
27
+ set browseScript [file join [pwd] $argv0]
28
+ proc browse {dir file} {
29
+ global env browseScript
30
+ if {[string compare $dir "."] != 0} {set file $dir/$file}
31
+ switch [file type $file] {
32
+ directory {
33
+ exec [info nameofexecutable] $browseScript $file &
34
+ }
35
+ file {
36
+ if {[info exists env(EDITOR)]} {
37
+ eval exec $env(EDITOR) $file &
38
+ } else {
39
+ exec xedit $file &
40
+ }
41
+ }
42
+ default {
43
+ puts stdout "\"$file\" isn't a directory or regular file"
44
+ }
45
+ }
46
+ }
47
+
48
+ # Fill the listbox with a list of all the files in the directory.
49
+
50
+ if {$argc>0} {set dir [lindex $argv 0]} else {set dir "."}
51
+ foreach i [lsort [glob * .* *.*]] {
52
+ if {[file type $i] eq "directory"} {
53
+ # Safe to do since it is still a directory.
54
+ append i /
55
+ }
56
+ .list insert end $i
57
+ }
58
+
59
+ # Set up bindings for the browser.
60
+
61
+ bind all <Control-c> {destroy .}
62
+ bind .list <Double-Button-1> {foreach i [selection get] {browse $dir $i}}
63
+
64
+ # Local Variables:
65
+ # mode: tcl
66
+ # End:
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/check.tcl ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # check.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # several checkbuttons.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .check
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Checkbutton Demonstration"
16
+ wm iconname $w "check"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "Four checkbuttons are displayed below. If you click on a button, it will toggle the button's selection state and set a Tcl variable to a value indicating the state of the checkbutton. The first button also follows the state of the other three. If only some of the three are checked, the first button will display the tri-state mode. Click the \"See Variables\" button to see the current values of the variables."
20
+ pack $w.msg -side top
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w [list safety wipers brakes sober]]
24
+ pack $btns -side bottom -fill x
25
+
26
+ checkbutton $w.b0 -text "Safety Check" -variable safety -relief flat \
27
+ -onvalue "all" \
28
+ -offvalue "none" \
29
+ -tristatevalue "partial"
30
+ checkbutton $w.b1 -text "Wipers OK" -variable wipers -relief flat
31
+ checkbutton $w.b2 -text "Brakes OK" -variable brakes -relief flat
32
+ checkbutton $w.b3 -text "Driver Sober" -variable sober -relief flat
33
+ pack $w.b0 -side top -pady 2 -anchor w
34
+ pack $w.b1 $w.b2 $w.b3 -side top -pady 2 -anchor w -padx 15
35
+
36
+ ## This code makes $w.b0 function as a tri-state button; it's not
37
+ ## needed at all for just straight yes/no buttons.
38
+
39
+ set in_check 0
40
+ proc tristate_check {n1 n2 op} {
41
+ global safety wipers brakes sober in_check
42
+ if {$in_check} {
43
+ return
44
+ }
45
+ set in_check 1
46
+ if {$n1 eq "safety"} {
47
+ if {$safety eq "none"} {
48
+ set wipers 0
49
+ set brakes 0
50
+ set sober 0
51
+ } elseif {$safety eq "all"} {
52
+ set wipers 1
53
+ set brakes 1
54
+ set sober 1
55
+ }
56
+ } else {
57
+ if {$wipers == 1 && $brakes == 1 && $sober == 1} {
58
+ set safety all
59
+ } elseif {$wipers == 1 || $brakes == 1 || $sober == 1} {
60
+ set safety partial
61
+ } else {
62
+ set safety none
63
+ }
64
+ }
65
+ set in_check 0
66
+ }
67
+
68
+ trace variable wipers w tristate_check
69
+ trace variable brakes w tristate_check
70
+ trace variable sober w tristate_check
71
+ trace variable safety w tristate_check
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/clrpick.tcl ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # clrpick.tcl --
2
+ #
3
+ # This demonstration script prompts the user to select a color.
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .clrpick
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Color Selection Dialog"
15
+ wm iconname $w "colors"
16
+ positionWindow $w
17
+
18
+ label $w.msg -font $font -wraplength 4i -justify left -text "Press the buttons below to choose the foreground and background colors for the widgets in this window."
19
+ pack $w.msg -side top
20
+
21
+ ## See Code / Dismiss buttons
22
+ set btns [addSeeDismiss $w.buttons $w]
23
+ pack $btns -side bottom -fill x
24
+
25
+ button $w.back -text "Set background color ..." \
26
+ -command \
27
+ "setColor $w $w.back background {-background -highlightbackground}"
28
+ button $w.fore -text "Set foreground color ..." \
29
+ -command \
30
+ "setColor $w $w.back foreground -foreground"
31
+
32
+ pack $w.back $w.fore -side top -anchor c -pady 2m
33
+
34
+ proc setColor {w button name options} {
35
+ grab $w
36
+ set initialColor [$button cget -$name]
37
+ set color [tk_chooseColor -title "Choose a $name color" -parent $w \
38
+ -initialcolor $initialColor]
39
+ if {[string compare $color ""]} {
40
+ setColor_helper $w $options $color
41
+ }
42
+ grab release $w
43
+ }
44
+
45
+ proc setColor_helper {w options color} {
46
+ foreach option $options {
47
+ catch {
48
+ $w config $option $color
49
+ }
50
+ }
51
+ foreach child [winfo children $w] {
52
+ setColor_helper $child $options $color
53
+ }
54
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/combo.tcl ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # combo.tcl --
2
+ #
3
+ # This demonstration script creates several combobox widgets.
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .combo
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Combobox Demonstration"
15
+ wm iconname $w "combo"
16
+ positionWindow $w
17
+
18
+ ttk::label $w.msg -font $font -wraplength 5i -justify left -text "Three different\
19
+ combo-boxes are displayed below. You can add characters to the first\
20
+ one by pointing, clicking and typing, just as with an entry; pressing\
21
+ Return will cause the current value to be added to the list that is\
22
+ selectable from the drop-down list, and you can choose other values\
23
+ by pressing the Down key, using the arrow keys to pick another one,\
24
+ and pressing Return again. The second combo-box is fixed to a\
25
+ particular value, and cannot be modified at all. The third one only\
26
+ allows you to select values from its drop-down list of Australian\
27
+ cities."
28
+ pack $w.msg -side top -fill x
29
+
30
+ ## See Code / Dismiss buttons
31
+ set btns [addSeeDismiss $w.buttons $w {firstValue secondValue ozCity}]
32
+ pack $btns -side bottom -fill x
33
+
34
+ ttk::frame $w.f
35
+ pack $w.f -fill both -expand 1
36
+ set w $w.f
37
+
38
+ set australianCities {
39
+ Canberra Sydney Melbourne Perth Adelaide Brisbane
40
+ Hobart Darwin "Alice Springs"
41
+ }
42
+ set secondValue unchangable
43
+ set ozCity Sydney
44
+
45
+ ttk::labelframe $w.c1 -text "Fully Editable"
46
+ ttk::combobox $w.c1.c -textvariable firstValue
47
+ ttk::labelframe $w.c2 -text Disabled
48
+ ttk::combobox $w.c2.c -textvariable secondValue -state disabled
49
+ ttk::labelframe $w.c3 -text "Defined List Only"
50
+ ttk::combobox $w.c3.c -textvariable ozCity -state readonly \
51
+ -values $australianCities
52
+ bind $w.c1.c <Return> {
53
+ if {[%W get] ni [%W cget -values]} {
54
+ %W configure -values [concat [%W cget -values] [list [%W get]]]
55
+ }
56
+ }
57
+
58
+ pack $w.c1 $w.c2 $w.c3 -side top -pady 5 -padx 10
59
+ pack $w.c1.c -pady 5 -padx 10
60
+ pack $w.c2.c -pady 5 -padx 10
61
+ pack $w.c3.c -pady 5 -padx 10
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/cscroll.tcl ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # cscroll.tcl --
2
+ #
3
+ # This demonstration script creates a simple canvas that can be
4
+ # scrolled in two dimensions.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .cscroll
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Scrollable Canvas Demonstration"
16
+ wm iconname $w "cscroll"
17
+ positionWindow $w
18
+ set c $w.c
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "This window displays a canvas widget that can be scrolled either using the scrollbars or by dragging with button 2 in the canvas. If you click button 1 on one of the rectangles, its indices will be printed on stdout."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ frame $w.grid
28
+ scrollbar $w.hscroll -orient horiz -command "$c xview"
29
+ scrollbar $w.vscroll -command "$c yview"
30
+ canvas $c -relief sunken -borderwidth 2 -scrollregion {-11c -11c 50c 20c} \
31
+ -xscrollcommand "$w.hscroll set" \
32
+ -yscrollcommand "$w.vscroll set"
33
+ pack $w.grid -expand yes -fill both -padx 1 -pady 1
34
+ grid rowconfig $w.grid 0 -weight 1 -minsize 0
35
+ grid columnconfig $w.grid 0 -weight 1 -minsize 0
36
+
37
+ grid $c -padx 1 -in $w.grid -pady 1 \
38
+ -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
39
+ grid $w.vscroll -in $w.grid -padx 1 -pady 1 \
40
+ -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
41
+ grid $w.hscroll -in $w.grid -padx 1 -pady 1 \
42
+ -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
43
+
44
+
45
+ set bg [lindex [$c config -bg] 4]
46
+ for {set i 0} {$i < 20} {incr i} {
47
+ set x [expr {-10 + 3*$i}]
48
+ for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
49
+ $c create rect ${x}c ${y}c [expr {$x+2}]c [expr {$y+2}]c \
50
+ -fill $bg -tags rect
51
+ $c create text [expr {$x+1}]c [expr {$y+1}]c -text "$i,$j" \
52
+ -anchor center -tags text
53
+ }
54
+ }
55
+
56
+ $c bind all <Enter> "scrollEnter $c"
57
+ $c bind all <Leave> "scrollLeave $c"
58
+ $c bind all <Button-1> "scrollButton $c"
59
+ if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide Tk] 8.7-]} {
60
+ bind $c <Button-3> "$c scan mark %x %y"
61
+ bind $c <B3-Motion> "$c scan dragto %x %y"
62
+ bind $c <MouseWheel> {
63
+ %W yview scroll [expr {-%D}] units
64
+ }
65
+ bind $c <Option-MouseWheel> {
66
+ %W yview scroll [expr {-10*%D}] units
67
+ }
68
+ bind $c <Shift-MouseWheel> {
69
+ %W xview scroll [expr {-%D}] units
70
+ }
71
+ bind $c <Shift-Option-MouseWheel> {
72
+ %W xview scroll [expr {-10*%D}] units
73
+ }
74
+ } else {
75
+ bind $c <Button-2> "$c scan mark %x %y"
76
+ bind $c <B2-Motion> "$c scan dragto %x %y"
77
+ # We must make sure that positive and negative movements are rounded
78
+ # equally to integers, avoiding the problem that
79
+ # (int)1/-30 = -1,
80
+ # but
81
+ # (int)-1/-30 = 0
82
+ # The following code ensure equal +/- behaviour.
83
+ bind $c <MouseWheel> {
84
+ if {%D >= 0} {
85
+ %W yview scroll [expr {%D/-30}] units
86
+ } else {
87
+ %W yview scroll [expr {(%D-29)/-30}] units
88
+ }
89
+ }
90
+ bind $c <Option-MouseWheel> {
91
+ if {%D >= 0} {
92
+ %W yview scroll [expr {%D/-3}] units
93
+ } else {
94
+ %W yview scroll [expr {(%D-2)/-3}] units
95
+ }
96
+ }
97
+ bind $c <Shift-MouseWheel> {
98
+ if {%D >= 0} {
99
+ %W xview scroll [expr {%D/-30}] units
100
+ } else {
101
+ %W xview scroll [expr {(%D-29)/-30}] units
102
+ }
103
+ }
104
+ bind $c <Shift-Option-MouseWheel> {
105
+ if {%D >= 0} {
106
+ %W xview scroll [expr {%D/-3}] units
107
+ } else {
108
+ %W xview scroll [expr {(%D-2)/-3}] units
109
+ }
110
+ }
111
+ }
112
+
113
+ if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} {
114
+ # Support for mousewheels on Linux/Unix commonly comes through mapping
115
+ # the wheel to the extended buttons. If you have a mousewheel, find
116
+ # Linux configuration info at:
117
+ # https://linuxreviews.org/HOWTO_change_the_mouse_speed_in_X
118
+ bind $c <Button-4> {
119
+ if {!$tk_strictMotif} {
120
+ %W yview scroll -5 units
121
+ }
122
+ }
123
+ bind $c <Shift-Button-4> {
124
+ if {!$tk_strictMotif} {
125
+ %W xview scroll -5 units
126
+ }
127
+ }
128
+ bind $c <Button-5> {
129
+ if {!$tk_strictMotif} {
130
+ %W yview scroll 5 units
131
+ }
132
+ }
133
+ bind $c <Shift-Button-5> {
134
+ if {!$tk_strictMotif} {
135
+ %W xview scroll 5 units
136
+ }
137
+ }
138
+ }
139
+
140
+
141
+ proc scrollEnter canvas {
142
+ global oldFill
143
+ set id [$canvas find withtag current]
144
+ if {[lsearch [$canvas gettags current] text] >= 0} {
145
+ set id [expr {$id-1}]
146
+ }
147
+ set oldFill [lindex [$canvas itemconfig $id -fill] 4]
148
+ if {[winfo depth $canvas] > 1} {
149
+ if {[tk windowingsystem] eq "aqua"} {
150
+ $canvas itemconfigure $id -fill systemSelectedTextBackgroundColor
151
+ } else {
152
+ $canvas itemconfigure $id -fill LightSeaGreen
153
+ }
154
+ }
155
+ }
156
+
157
+ proc scrollLeave canvas {
158
+ global oldFill
159
+ set id [$canvas find withtag current]
160
+ if {[lsearch [$canvas gettags current] text] >= 0} {
161
+ set id [expr {$id-1}]
162
+ }
163
+ $canvas itemconfigure $id -fill $oldFill
164
+ }
165
+
166
+ proc scrollButton canvas {
167
+ set id [$canvas find withtag current]
168
+ if {[lsearch [$canvas gettags current] text] < 0} {
169
+ set id [expr {$id+1}]
170
+ }
171
+ puts stdout "You buttoned at [lindex [$canvas itemconf $id -text] 4]"
172
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/ctext.tcl ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ctext.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget with a text
4
+ # item that can be edited and reconfigured in various ways.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .ctext
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Canvas Text Demonstration"
16
+ wm iconname $w "Text"
17
+ positionWindow $w
18
+ set c $w.c
19
+
20
+ label $w.msg -font $font -wraplength 5i -justify left -text "This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification, and on a pie slice to change its angle. The text also supports the following simple bindings for editing:
21
+ 1. You can point, click, and type.
22
+ 2. You can also select with button 1.
23
+ 3. You can copy the selection to the mouse position with button 2.
24
+ 4. Backspace and Control+h delete the selection if there is one;
25
+ otherwise they delete the character just before the insertion cursor.
26
+ 5. Delete deletes the selection if there is one; otherwise it deletes
27
+ the character just after the insertion cursor."
28
+ pack $w.msg -side top
29
+
30
+ ## See Code / Dismiss buttons
31
+ set btns [addSeeDismiss $w.buttons $w]
32
+ pack $btns -side bottom -fill x
33
+
34
+ canvas $c -relief flat -borderwidth 0 -width 500 -height 350
35
+ pack $w.c -side top -expand yes -fill both
36
+
37
+ set textFont {Helvetica 24}
38
+
39
+ $c create rectangle 245 195 255 205 -outline black -fill red
40
+
41
+ # First, create the text item and give it bindings so it can be edited.
42
+
43
+ $c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left]
44
+ $c bind text <Button-1> "textB1Press $c %x %y"
45
+ $c bind text <B1-Motion> "textB1Move $c %x %y"
46
+ $c bind text <Shift-Button-1> "$c select adjust current @%x,%y"
47
+ $c bind text <Shift-B1-Motion> "textB1Move $c %x %y"
48
+ $c bind text <Key> "textInsert $c %A"
49
+ $c bind text <Return> "textInsert $c \\n"
50
+ $c bind text <Control-h> "textBs $c"
51
+ $c bind text <BackSpace> "textBs $c"
52
+ $c bind text <Delete> "textDel $c"
53
+ if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
54
+ $c bind text <Button-3> "textPaste $c @%x,%y"
55
+ } else {
56
+ $c bind text <Button-2> "textPaste $c @%x,%y"
57
+ }
58
+
59
+ # Next, create some items that allow the text's anchor position
60
+ # to be edited.
61
+
62
+ proc mkTextConfigBox {w x y option value color} {
63
+ set item [$w create rect $x $y [expr {$x+30}] [expr {$y+30}] \
64
+ -outline black -fill $color -width 1]
65
+ $w bind $item <Button-1> "$w itemconf text $option $value"
66
+ $w addtag config withtag $item
67
+ }
68
+ proc mkTextConfigPie {w x y a option value color} {
69
+ set item [$w create arc $x $y [expr {$x+90}] [expr {$y+90}] \
70
+ -start [expr {$a-15}] -extent 30 -outline black -fill $color \
71
+ -width 1]
72
+ $w bind $item <Button-1> "$w itemconf text $option $value"
73
+ $w addtag config withtag $item
74
+ }
75
+
76
+ set x 50
77
+ set y 50
78
+ set color LightSkyBlue1
79
+ mkTextConfigBox $c $x $y -anchor se $color
80
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y }] -anchor s $color
81
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y }] -anchor sw $color
82
+ mkTextConfigBox $c [expr {$x }] [expr {$y+30}] -anchor e $color
83
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y+30}] -anchor center $color
84
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y+30}] -anchor w $color
85
+ mkTextConfigBox $c [expr {$x }] [expr {$y+60}] -anchor ne $color
86
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y+60}] -anchor n $color
87
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
88
+ set item [$c create rect \
89
+ [expr {$x+40}] [expr {$y+40}] [expr {$x+50}] [expr {$y+50}] \
90
+ -outline black -fill red]
91
+ $c bind $item <Button-1> "$c itemconf text -anchor center"
92
+ $c create text [expr {$x+45}] [expr {$y-5}] \
93
+ -text {Text Position} -anchor s -font {Times 20} -fill brown
94
+
95
+ # Now create some items that allow the text's angle to be changed.
96
+
97
+ set x 205
98
+ set y 50
99
+ set color Yellow
100
+ mkTextConfigPie $c $x $y 0 -angle 90 $color
101
+ mkTextConfigPie $c $x $y 30 -angle 120 $color
102
+ mkTextConfigPie $c $x $y 60 -angle 150 $color
103
+ mkTextConfigPie $c $x $y 90 -angle 180 $color
104
+ mkTextConfigPie $c $x $y 120 -angle 210 $color
105
+ mkTextConfigPie $c $x $y 150 -angle 240 $color
106
+ mkTextConfigPie $c $x $y 180 -angle 270 $color
107
+ mkTextConfigPie $c $x $y 210 -angle 300 $color
108
+ mkTextConfigPie $c $x $y 240 -angle 330 $color
109
+ mkTextConfigPie $c $x $y 270 -angle 0 $color
110
+ mkTextConfigPie $c $x $y 300 -angle 30 $color
111
+ mkTextConfigPie $c $x $y 330 -angle 60 $color
112
+ $c create text [expr {$x+45}] [expr {$y-5}] \
113
+ -text {Text Angle} -anchor s -font {Times 20} -fill brown
114
+
115
+ # Lastly, create some items that allow the text's justification to be
116
+ # changed.
117
+
118
+ set x 350
119
+ set y 50
120
+ set color SeaGreen2
121
+ mkTextConfigBox $c $x $y -justify left $color
122
+ mkTextConfigBox $c [expr {$x+30}] $y -justify center $color
123
+ mkTextConfigBox $c [expr {$x+60}] $y -justify right $color
124
+ $c create text [expr {$x+45}] [expr {$y-5}] \
125
+ -text {Justification} -anchor s -font {Times 20} -fill brown
126
+
127
+ $c bind config <Enter> "textEnter $c"
128
+ $c bind config <Leave> "$c itemconf current -fill \$textConfigFill"
129
+
130
+ set textConfigFill {}
131
+
132
+ proc textEnter {w} {
133
+ global textConfigFill
134
+ set textConfigFill [lindex [$w itemconfig current -fill] 4]
135
+ $w itemconfig current -fill black
136
+ }
137
+
138
+ proc textInsert {w string} {
139
+ if {$string == ""} {
140
+ return
141
+ }
142
+ catch {$w dchars text sel.first sel.last}
143
+ $w insert text insert $string
144
+ }
145
+
146
+ proc textPaste {w pos} {
147
+ catch {
148
+ $w insert text $pos [selection get]
149
+ }
150
+ }
151
+
152
+ proc textB1Press {w x y} {
153
+ $w icursor current @$x,$y
154
+ $w focus current
155
+ focus $w
156
+ $w select from current @$x,$y
157
+ }
158
+
159
+ proc textB1Move {w x y} {
160
+ $w select to current @$x,$y
161
+ }
162
+
163
+ proc textBs {w} {
164
+ if {![catch {$w dchars text sel.first sel.last}]} {
165
+ return
166
+ }
167
+ set char [expr {[$w index text insert] - 1}]
168
+ if {$char >= 0} {$w dchar text $char}
169
+ }
170
+
171
+ proc textDel {w} {
172
+ if {![catch {$w dchars text sel.first sel.last}]} {
173
+ return
174
+ }
175
+ $w dchars text insert
176
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/dialog2.tcl ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dialog2.tcl --
2
+ #
3
+ # This demonstration script creates a dialog box with a global grab.
4
+
5
+ after idle {
6
+ .dialog2.msg configure -wraplength 4i
7
+ }
8
+ after 100 {
9
+ grab -global .dialog2
10
+ }
11
+ set i [tk_dialog .dialog2 "Dialog with global grab" {This dialog box uses a global grab. If you are using an X11 window manager you will be prevented from interacting with anything on your display until you invoke one of the buttons below. This is almost always a bad idea; don't use global grabs with X11 unless you're truly desperate. On macOS systems you will not be able to interact with any window belonging to this process, but interaction with other macOS Applications will still be possible.}\
12
+ warning 0 OK Cancel {Show Code}]
13
+
14
+ switch $i {
15
+ 0 {puts "You pressed OK"}
16
+ 1 {puts "You pressed Cancel"}
17
+ 2 {showCode .dialog2}
18
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/en.msg ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ::msgcat::mcset en "Widget Demonstration"
2
+ ::msgcat::mcset en "tkWidgetDemo"
3
+ ::msgcat::mcset en "&File"
4
+ ::msgcat::mcset en "About..."
5
+ ::msgcat::mcset en "&About..."
6
+ ::msgcat::mcset en "<F1>"
7
+ ::msgcat::mcset en "&Quit"
8
+ ::msgcat::mcset en "Meta+Q" ;# Displayed hotkey
9
+ ::msgcat::mcset en "Meta-q" ;# Actual binding sequence
10
+ ::msgcat::mcset en "Ctrl+Q" ;# Displayed hotkey
11
+ ::msgcat::mcset en "Control-q" ;# Actual binding sequence
12
+ ::msgcat::mcset en "Variable values"
13
+ ::msgcat::mcset en "Variable values:"
14
+ ::msgcat::mcset en "OK"
15
+ ::msgcat::mcset en "Run the \"%s\" sample program"
16
+ ::msgcat::mcset en "Dismiss"
17
+ ::msgcat::mcset en "Rerun Demo"
18
+ ::msgcat::mcset en "Demo code: %s"
19
+ ::msgcat::mcset en "About Widget Demo"
20
+ ::msgcat::mcset en "Tk widget demonstration application"
21
+ ::msgcat::mcset en "Copyright © %s"
22
+ ::msgcat::mcset en "
23
+ @@title
24
+ Tk Widget Demonstrations
25
+ @@newline
26
+ @@normal
27
+ @@newline
28
+
29
+ This application provides a front end for several short scripts
30
+ that demonstrate what you can do with Tk widgets. Each of the
31
+ numbered lines below describes a demonstration; you can click on
32
+ it to invoke the demonstration. Once the demonstration window
33
+ appears, you can click the
34
+ @@bold
35
+ See Code
36
+ @@normal
37
+ button to see the Tcl/Tk code that created the demonstration. If
38
+ you wish, you can edit the code and click the
39
+ @@bold
40
+ Rerun Demo
41
+ @@normal
42
+ button in the code window to reinvoke the demonstration with the
43
+ modified code.
44
+ @@newline
45
+ "
46
+ ::msgcat::mcset en "Labels, buttons, checkbuttons, and radiobuttons"
47
+ ::msgcat::mcset en "Labels (text and bitmaps)"
48
+ ::msgcat::mcset en "Labels and UNICODE text"
49
+ ::msgcat::mcset en "Buttons"
50
+ ::msgcat::mcset en "Check-buttons (select any of a group)"
51
+ ::msgcat::mcset en "Radio-buttons (select one of a group)"
52
+ ::msgcat::mcset en "A 15-puzzle game made out of buttons"
53
+ ::msgcat::mcset en "Iconic buttons that use bitmaps"
54
+ ::msgcat::mcset en "Two labels displaying images"
55
+ ::msgcat::mcset en "A simple user interface for viewing images"
56
+ ::msgcat::mcset en "Labelled frames"
57
+ ::msgcat::mcset en "Listboxes"
58
+ ::msgcat::mcset en "The 50 states"
59
+ ::msgcat::mcset en "Colors: change the color scheme for the application"
60
+ ::msgcat::mcset en "A collection of famous and infamous sayings"
61
+ ::msgcat::mcset en "Entries and Spin-boxes"
62
+ ::msgcat::mcset en "Entries without scrollbars"
63
+ ::msgcat::mcset en "Entries with scrollbars"
64
+ ::msgcat::mcset en "Validated entries and password fields"
65
+ ::msgcat::mcset en "Spin-boxes"
66
+ ::msgcat::mcset en "Simple Rolodex-like form"
67
+ ::msgcat::mcset en "Text"
68
+ ::msgcat::mcset en "Basic editable text"
69
+ ::msgcat::mcset en "Text display styles"
70
+ ::msgcat::mcset en "Hypertext (tag bindings)"
71
+ ::msgcat::mcset en "A text widget with embedded windows"
72
+ ::msgcat::mcset en "A search tool built with a text widget"
73
+ ::msgcat::mcset en "Canvases"
74
+ ::msgcat::mcset en "The canvas item types"
75
+ ::msgcat::mcset en "A simple 2-D plot"
76
+ ::msgcat::mcset en "Text items in canvases"
77
+ ::msgcat::mcset en "An editor for arrowheads on canvas lines"
78
+ ::msgcat::mcset en "A ruler with adjustable tab stops"
79
+ ::msgcat::mcset en "A building floor plan"
80
+ ::msgcat::mcset en "A simple scrollable canvas"
81
+ ::msgcat::mcset en "Scales"
82
+ ::msgcat::mcset en "Horizontal scale"
83
+ ::msgcat::mcset en "Vertical scale"
84
+ ::msgcat::mcset en "Paned Windows"
85
+ ::msgcat::mcset en "Horizontal paned window"
86
+ ::msgcat::mcset en "Vertical paned window"
87
+ ::msgcat::mcset en "Menus"
88
+ ::msgcat::mcset en "Menus and cascades (sub-menus)"
89
+ ::msgcat::mcset en "Menu-buttons"
90
+ ::msgcat::mcset en "Common Dialogs"
91
+ ::msgcat::mcset en "Message boxes"
92
+ ::msgcat::mcset en "File selection dialog"
93
+ ::msgcat::mcset en "Color picker"
94
+ ::msgcat::mcset en "Miscellaneous"
95
+ ::msgcat::mcset en "The built-in bitmaps"
96
+ ::msgcat::mcset en "A dialog box with a local grab"
97
+ ::msgcat::mcset en "A dialog box with a global grab"
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/entry3.tcl ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # entry3.tcl --
2
+ #
3
+ # This demonstration script creates several entry widgets whose
4
+ # permitted input is constrained in some way. It also shows off a
5
+ # password entry.
6
+
7
+ if {![info exists widgetDemo]} {
8
+ error "This script should be run from the \"widget\" demo."
9
+ }
10
+
11
+ package require Tk
12
+
13
+ set w .entry3
14
+ catch {destroy $w}
15
+ toplevel $w
16
+ wm title $w "Constrained Entry Demonstration"
17
+ wm iconname $w "entry3"
18
+ positionWindow $w
19
+
20
+ label $w.msg -font $font -wraplength 5i -justify left -text "Four different\
21
+ entries are displayed below. You can add characters by pointing,\
22
+ clicking and typing, though each is constrained in what it will\
23
+ accept. The first only accepts 32-bit integers or the empty string\
24
+ (checking when focus leaves it) and will flash to indicate any\
25
+ problem. The second only accepts strings with fewer than ten\
26
+ characters and sounds the bell when an attempt to go over the limit\
27
+ is made. The third accepts US phone numbers, mapping letters to\
28
+ their digit equivalent and sounding the bell on encountering an\
29
+ illegal character or if trying to type over a character that is not\
30
+ a digit. The fourth is a password field that accepts up to eight\
31
+ characters (silently ignoring further ones), and displaying them as\
32
+ asterisk characters."
33
+
34
+ ## See Code / Dismiss buttons
35
+ set btns [addSeeDismiss $w.buttons $w]
36
+ pack $btns -side bottom -fill x
37
+
38
+ # focusAndFlash --
39
+ # Error handler for entry widgets that forces the focus onto the
40
+ # widget and makes the widget flash by exchanging the foreground and
41
+ # background colours at intervals of 200ms (i.e. at approximately
42
+ # 2.5Hz).
43
+ #
44
+ # Arguments:
45
+ # W - Name of entry widget to flash
46
+ # fg - Initial foreground colour
47
+ # bg - Initial background colour
48
+ # count - Counter to control the number of times flashed
49
+
50
+ proc focusAndFlash {W fg bg {count 9}} {
51
+ focus -force $W
52
+ if {$count<1} {
53
+ $W configure -foreground $fg -background $bg
54
+ } else {
55
+ if {$count%2} {
56
+ $W configure -foreground $bg -background $fg
57
+ } else {
58
+ $W configure -foreground $fg -background $bg
59
+ }
60
+ after 200 [list focusAndFlash $W $fg $bg [expr {$count-1}]]
61
+ }
62
+ }
63
+
64
+ labelframe $w.l1 -text "Integer Entry"
65
+ # Alternatively try using {string is digit} for arbitrary length numbers,
66
+ # and not just 32-bit ones.
67
+ entry $w.l1.e -validate focus -vcmd {string is integer %P}
68
+ $w.l1.e configure -invalidcommand \
69
+ "focusAndFlash %W [$w.l1.e cget -fg] [$w.l1.e cget -bg]"
70
+ pack $w.l1.e -fill x -expand 1 -padx 1m -pady 1m
71
+
72
+ labelframe $w.l2 -text "Length-Constrained Entry"
73
+ entry $w.l2.e -validate key -invcmd bell -vcmd {expr {[string length %P]<10}}
74
+ pack $w.l2.e -fill x -expand 1 -padx 1m -pady 1m
75
+
76
+ ### PHONE NUMBER ENTRY ###
77
+ # Note that the source to this is quite a bit longer as the behaviour
78
+ # demonstrated is a lot more ambitious than with the others.
79
+
80
+ # Initial content for the third entry widget
81
+ set entry3content "1-(000)-000-0000"
82
+ # Mapping from alphabetic characters to numbers. This is probably
83
+ # wrong, but it is the only mapping I have; the UK doesn't really go
84
+ # for associating letters with digits for some reason.
85
+ set phoneNumberMap {}
86
+ foreach {chars digit} {abc 2 def 3 ghi 4 jkl 5 mno 6 pqrs 7 tuv 8 wxyz 9} {
87
+ foreach char [split $chars ""] {
88
+ lappend phoneNumberMap $char $digit [string toupper $char] $digit
89
+ }
90
+ }
91
+
92
+ # validatePhoneChange --
93
+ # Checks that the replacement (mapped to a digit) of the given
94
+ # character in an entry widget at the given position will leave a
95
+ # valid phone number in the widget.
96
+ #
97
+ # W - The entry widget to validate
98
+ # vmode - The widget's validation mode
99
+ # idx - The index where replacement is to occur
100
+ # char - The character (or string, though that will always be
101
+ # refused) to be overwritten at that point.
102
+
103
+ proc validatePhoneChange {W vmode idx char} {
104
+ global phoneNumberMap entry3content
105
+ if {$idx < 0} {return 1}
106
+ after idle [list $W configure -validate $vmode -invcmd bell]
107
+ if {
108
+ !($idx<3 || $idx==6 || $idx==7 || $idx==11 || $idx>15) &&
109
+ [string match {[0-9A-Za-z]} $char]
110
+ } then {
111
+ $W delete $idx
112
+ $W insert $idx [string map $phoneNumberMap $char]
113
+ after idle [list phoneSkipRight $W -1]
114
+ return 1
115
+ }
116
+ return 0
117
+ }
118
+
119
+ # phoneSkipLeft --
120
+ # Skip over fixed characters in a phone-number string when moving left.
121
+ #
122
+ # Arguments:
123
+ # W - The entry widget containing the phone-number.
124
+
125
+ proc phoneSkipLeft {W} {
126
+ set idx [$W index insert]
127
+ if {$idx == 8} {
128
+ # Skip back two extra characters
129
+ $W icursor [incr idx -2]
130
+ } elseif {$idx == 7 || $idx == 12} {
131
+ # Skip back one extra character
132
+ $W icursor [incr idx -1]
133
+ } elseif {$idx <= 3} {
134
+ # Can't move any further
135
+ bell
136
+ return -code break
137
+ }
138
+ }
139
+
140
+ # phoneSkipRight --
141
+ # Skip over fixed characters in a phone-number string when moving right.
142
+ #
143
+ # Arguments:
144
+ # W - The entry widget containing the phone-number.
145
+ # add - Offset to add to index before calculation (used by validation.)
146
+
147
+ proc phoneSkipRight {W {add 0}} {
148
+ set idx [$W index insert]
149
+ if {$idx+$add == 5} {
150
+ # Skip forward two extra characters
151
+ $W icursor [incr idx 2]
152
+ } elseif {$idx+$add == 6 || $idx+$add == 10} {
153
+ # Skip forward one extra character
154
+ $W icursor [incr idx]
155
+ } elseif {$idx+$add == 15 && !$add} {
156
+ # Can't move any further
157
+ bell
158
+ return -code break
159
+ }
160
+ }
161
+
162
+ labelframe $w.l3 -text "US Phone-Number Entry"
163
+ entry $w.l3.e -validate key -invcmd bell -textvariable entry3content \
164
+ -vcmd {validatePhoneChange %W %v %i %S}
165
+ # Click to focus goes to the first editable character...
166
+ bind $w.l3.e <FocusIn> {
167
+ if {"%d" ne "NotifyAncestor"} {
168
+ %W icursor 3
169
+ after idle {%W selection clear}
170
+ }
171
+ }
172
+ bind $w.l3.e <<PrevChar>> {phoneSkipLeft %W}
173
+ bind $w.l3.e <<NextChar>> {phoneSkipRight %W}
174
+ pack $w.l3.e -fill x -expand 1 -padx 1m -pady 1m
175
+
176
+ labelframe $w.l4 -text "Password Entry"
177
+ entry $w.l4.e -validate key -show "*" -vcmd {expr {[string length %P]<=8}}
178
+ pack $w.l4.e -fill x -expand 1 -padx 1m -pady 1m
179
+
180
+ lower [frame $w.mid]
181
+ grid $w.l1 $w.l2 -in $w.mid -padx 3m -pady 1m -sticky ew
182
+ grid $w.l3 $w.l4 -in $w.mid -padx 3m -pady 1m -sticky ew
183
+ grid columnconfigure $w.mid {0 1} -uniform 1
184
+ pack $w.msg -side top
185
+ pack $w.mid -fill both -expand 1
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/fontchoose.tcl ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # fontchoose.tcl --
2
+ #
3
+ # Show off the stock font selector dialog
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .fontchoose
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Font Selection Dialog"
15
+ wm iconname $w "fontchooser"
16
+ positionWindow $w
17
+
18
+ catch {font create FontchooseDemoFont {*}[font actual TkDefaultFont]}
19
+
20
+ # The font chooser needs to be configured and then shown.
21
+ proc SelectFont {parent} {
22
+ tk fontchooser configure -font FontchooseDemoFont \
23
+ -command ApplyFont -parent $parent
24
+ tk fontchooser show
25
+ }
26
+
27
+ proc ApplyFont {font} {
28
+ font configure FontchooseDemoFont {*}[font actual $font]
29
+ }
30
+
31
+ # When the visibility of the fontchooser changes, the following event is fired
32
+ # to the parent widget.
33
+ #
34
+ bind $w <<TkFontchooserVisibility>> {
35
+ if {[tk fontchooser configure -visible]} {
36
+ %W.f.font state disabled
37
+ } else {
38
+ %W.f.font state !disabled
39
+ }
40
+ }
41
+
42
+
43
+ set f [ttk::frame $w.f -relief sunken -padding 2]
44
+
45
+ text $f.msg -font FontchooseDemoFont -width 40 -height 6 -borderwidth 0 \
46
+ -yscrollcommand [list $f.vs set]
47
+ ttk::scrollbar $f.vs -command [list $f.msg yview]
48
+
49
+ $f.msg insert end "Press the buttons below to choose a new font for the\
50
+ text shown in this window.\n" {}
51
+
52
+ ttk::button $f.font -text "Set font ..." -command [list SelectFont $w]
53
+
54
+ grid $f.msg $f.vs -sticky news
55
+ grid $f.font - -sticky e
56
+ grid columnconfigure $f 0 -weight 1
57
+ grid rowconfigure $f 0 -weight 1
58
+
59
+ ## See Code / Dismiss buttons
60
+ set btns [addSeeDismiss $w.buttons $w]
61
+
62
+ grid $f -sticky news
63
+ grid $btns -sticky ew
64
+ grid columnconfigure $w 0 -weight 1
65
+ grid rowconfigure $w 0 -weight 1
66
+ update idletasks
67
+ grid propagate $f 0
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/form.tcl ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # form.tcl --
2
+ #
3
+ # This demonstration script creates a simple form with a bunch
4
+ # of entry widgets.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .form
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Form Demonstration"
16
+ wm iconname $w "form"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "This window contains a simple form where you can type in the various entries and use tabs to move circularly between the entries."
20
+ pack $w.msg -side top
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w]
24
+ pack $btns -side bottom -fill x
25
+
26
+ foreach i {f1 f2 f3 f4 f5} {
27
+ frame $w.$i -bd 2
28
+ entry $w.$i.entry -relief sunken -width 40
29
+ label $w.$i.label
30
+ pack $w.$i.entry -side right
31
+ pack $w.$i.label -side left
32
+ }
33
+ $w.f1.label config -text Name:
34
+ $w.f2.label config -text Address:
35
+ $w.f5.label config -text Phone:
36
+ pack $w.msg $w.f1 $w.f2 $w.f3 $w.f4 $w.f5 -side top -fill x
37
+ bind $w <Return> "destroy $w"
38
+ focus $w.f1.entry
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/hscale.tcl ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # hscale.tcl --
2
+ #
3
+ # This demonstration script shows an example with a horizontal scale.
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .hscale
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Horizontal Scale Demonstration"
15
+ wm iconname $w "hscale"
16
+ positionWindow $w
17
+
18
+ label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a horizontal scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the length of the arrow."
19
+ pack $w.msg -side top -padx .5c
20
+
21
+ ## See Code / Dismiss buttons
22
+ set btns [addSeeDismiss $w.buttons $w]
23
+ pack $btns -side bottom -fill x
24
+
25
+ frame $w.frame -borderwidth 10
26
+ pack $w.frame -side top -fill x
27
+
28
+ canvas $w.frame.canvas -width 50 -height 50 -bd 0 -highlightthickness 0
29
+ $w.frame.canvas create polygon 0 0 1 1 2 2 -fill DeepSkyBlue3 -tags poly
30
+ $w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line
31
+ scale $w.frame.scale -orient horizontal -length 284 -from 0 -to 250 \
32
+ -command "setWidth $w.frame.canvas" -tickinterval 50
33
+ pack $w.frame.canvas -side top -expand yes -anchor s -fill x -padx 15
34
+ pack $w.frame.scale -side bottom -expand yes -anchor n
35
+ $w.frame.scale set 75
36
+
37
+ proc setWidth {w width} {
38
+ incr width 21
39
+ set x2 [expr {$width - 30}]
40
+ if {$x2 < 21} {
41
+ set x2 21
42
+ }
43
+ $w coords poly 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15
44
+ $w coords line 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15
45
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/icon.tcl ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # icon.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # buttons that display bitmaps instead of text.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .icon
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Iconic Button Demonstration"
16
+ wm iconname $w "icon"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 5i -justify left -text "This window shows three ways of using bitmaps or images in radiobuttons and checkbuttons. On the left are two radiobuttons, each of which displays a bitmap and an indicator. In the middle is a checkbutton that displays a different image depending on whether it is selected or not. On the right is a checkbutton that displays a single bitmap but changes its background color to indicate whether or not it is selected."
20
+ pack $w.msg -side top
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w]
24
+ pack $btns -side bottom -fill x
25
+
26
+ # Main widget program sets variable tk_demoDirectory
27
+ image create bitmap flagup \
28
+ -file [file join $tk_demoDirectory images flagup.xbm] \
29
+ -maskfile [file join $tk_demoDirectory images flagup.xbm]
30
+ image create bitmap flagdown \
31
+ -file [file join $tk_demoDirectory images flagdown.xbm] \
32
+ -maskfile [file join $tk_demoDirectory images flagdown.xbm]
33
+ frame $w.frame -borderwidth 10
34
+ pack $w.frame -side top
35
+
36
+ checkbutton $w.frame.b1 -image flagdown -selectimage flagup \
37
+ -indicatoron 0
38
+ $w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background]
39
+ checkbutton $w.frame.b2 \
40
+ -bitmap @[file join $tk_demoDirectory images letters.xbm] \
41
+ -indicatoron 0 -selectcolor SeaGreen1
42
+ frame $w.frame.left
43
+ pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m
44
+
45
+ radiobutton $w.frame.left.b3 \
46
+ -bitmap @[file join $tk_demoDirectory images letters.xbm] \
47
+ -variable letters -value full
48
+ radiobutton $w.frame.left.b4 \
49
+ -bitmap @[file join $tk_demoDirectory images noletter.xbm] \
50
+ -variable letters -value empty
51
+ pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/image1.tcl ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # image1.tcl --
2
+ #
3
+ # This demonstration script displays two image widgets.
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .image1
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Image Demonstration #1"
15
+ wm iconname $w "Image1"
16
+ positionWindow $w
17
+
18
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration displays two images, each in a separate label widget."
19
+ pack $w.msg -side top
20
+
21
+ ## See Code / Dismiss buttons
22
+ set btns [addSeeDismiss $w.buttons $w]
23
+ pack $btns -side bottom -fill x
24
+
25
+ # Main widget program sets variable tk_demoDirectory
26
+ catch {image delete image1a}
27
+ image create photo image1a -file [file join $tk_demoDirectory images earth.gif]
28
+ label $w.l1 -image image1a -bd 1 -relief sunken
29
+
30
+ catch {image delete image1b}
31
+ image create photo image1b \
32
+ -file [file join $tk_demoDirectory images earthris.gif]
33
+ label $w.l2 -image image1b -bd 1 -relief sunken
34
+
35
+ pack $w.l1 $w.l2 -side top -padx .5m -pady .5m
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/image2.tcl ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # image2.tcl --
2
+ #
3
+ # This demonstration script creates a simple collection of widgets
4
+ # that allow you to select and view images in a Tk label.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # loadDir --
13
+ # This procedure reloads the directory listbox from the directory
14
+ # named in the demo's entry.
15
+ #
16
+ # Arguments:
17
+ # w - Name of the toplevel window of the demo.
18
+
19
+ proc loadDir w {
20
+ global dirName
21
+
22
+ $w.f.list delete 0 end
23
+ foreach i [lsort [glob -type f -directory $dirName *]] {
24
+ $w.f.list insert end [file tail $i]
25
+ }
26
+ }
27
+
28
+ # selectAndLoadDir --
29
+ # This procedure pops up a dialog to ask for a directory to load into
30
+ # the listobx and (if the user presses OK) reloads the directory
31
+ # listbox from the directory named in the demo's entry.
32
+ #
33
+ # Arguments:
34
+ # w - Name of the toplevel window of the demo.
35
+
36
+ proc selectAndLoadDir w {
37
+ global dirName
38
+ set dir [tk_chooseDirectory -initialdir $dirName -parent $w -mustexist 1]
39
+ if {$dir ne ""} {
40
+ set dirName $dir
41
+ loadDir $w
42
+ }
43
+ }
44
+
45
+ # loadImage --
46
+ # Given the name of the toplevel window of the demo and the mouse
47
+ # position, extracts the directory entry under the mouse and loads
48
+ # that file into a photo image for display.
49
+ #
50
+ # Arguments:
51
+ # w - Name of the toplevel window of the demo.
52
+ # x, y- Mouse position within the listbox.
53
+
54
+ proc loadImage {w x y} {
55
+ global dirName
56
+
57
+ set file [file join $dirName [$w.f.list get @$x,$y]]
58
+ if {[catch {
59
+ image2a configure -file $file
60
+ }]} then {
61
+ # Mark the file as not loadable
62
+ $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000
63
+ }
64
+ }
65
+
66
+ set w .image2
67
+ catch {destroy $w}
68
+ toplevel $w
69
+ wm title $w "Image Demonstration #2"
70
+ wm iconname $w "Image2"
71
+ positionWindow $w
72
+
73
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration allows you to view images using a Tk \"photo\" image. First type a directory name in the listbox, then type Return to load the directory into the listbox. Then double-click on a file name in the listbox to see that image."
74
+ pack $w.msg -side top
75
+
76
+ ## See Code / Dismiss buttons
77
+ set btns [addSeeDismiss $w.buttons $w]
78
+ pack $btns -side bottom -fill x
79
+
80
+ frame $w.mid
81
+ pack $w.mid -fill both -expand 1
82
+
83
+ labelframe $w.dir -text "Directory:"
84
+ # Main widget program sets variable tk_demoDirectory
85
+ set dirName [file join $tk_demoDirectory images]
86
+ entry $w.dir.e -width 30 -textvariable dirName
87
+ button $w.dir.b -pady 0 -padx 2m -text "Select Dir." \
88
+ -command "selectAndLoadDir $w"
89
+ bind $w.dir.e <Return> "loadDir $w"
90
+ pack $w.dir.e -side left -fill both -padx 2m -pady 2m -expand true
91
+ pack $w.dir.b -side left -fill y -padx {0 2m} -pady 2m
92
+ labelframe $w.f -text "File:" -padx 2m -pady 2m
93
+
94
+ listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set"
95
+ ttk::scrollbar $w.f.scroll -command "$w.f.list yview"
96
+ pack $w.f.list $w.f.scroll -side left -fill y -expand 1
97
+ $w.f.list insert 0 earth.gif earthris.gif teapot.ppm
98
+ bind $w.f.list <Double-Button-1> "loadImage $w %x %y"
99
+
100
+ catch {image delete image2a}
101
+ image create photo image2a
102
+ labelframe $w.image -text "Image:"
103
+ label $w.image.image -image image2a
104
+ pack $w.image.image -padx 2m -pady 2m
105
+
106
+ grid $w.dir - -sticky ew -padx 1m -pady 1m -in $w.mid
107
+ grid $w.f $w.image -sticky nw -padx 1m -pady 1m -in $w.mid
108
+ grid columnconfigure $w.mid 1 -weight 1
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/items.tcl ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # items.tcl --
2
+ #
3
+ # This demonstration script creates a canvas that displays the
4
+ # canvas item types.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .items
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Canvas Item Demonstration"
16
+ wm iconname $w "Items"
17
+ positionWindow $w
18
+ set c $w.frame.c
19
+
20
+ label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ frame $w.frame
28
+ pack $w.frame -side top -fill both -expand yes
29
+
30
+ canvas $c -scrollregion {0c 0c 30c 24c} -width 15c -height 10c \
31
+ -relief sunken -borderwidth 2 \
32
+ -xscrollcommand "$w.frame.hscroll set" \
33
+ -yscrollcommand "$w.frame.vscroll set"
34
+ ttk::scrollbar $w.frame.vscroll -command "$c yview"
35
+ ttk::scrollbar $w.frame.hscroll -orient horiz -command "$c xview"
36
+
37
+ grid $c -in $w.frame \
38
+ -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
39
+ grid $w.frame.vscroll \
40
+ -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
41
+ grid $w.frame.hscroll \
42
+ -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
43
+ grid rowconfig $w.frame 0 -weight 1 -minsize 0
44
+ grid columnconfig $w.frame 0 -weight 1 -minsize 0
45
+
46
+ # Display a 3x3 rectangular grid.
47
+
48
+ $c create rect 0c 0c 30c 24c -width 2
49
+ $c create line 0c 8c 30c 8c -width 2
50
+ $c create line 0c 16c 30c 16c -width 2
51
+ $c create line 10c 0c 10c 24c -width 2
52
+ $c create line 20c 0c 20c 24c -width 2
53
+
54
+ set font1 {Helvetica 12}
55
+ set font2 {Helvetica 24 bold}
56
+ if {[winfo depth $c] > 1} {
57
+ set blue DeepSkyBlue3
58
+ set red red
59
+ set bisque bisque3
60
+ set green SeaGreen3
61
+ } else {
62
+ set blue black
63
+ set red black
64
+ set bisque black
65
+ set green black
66
+ }
67
+
68
+ # Set up demos within each of the areas of the grid.
69
+
70
+ $c create text 5c .2c -text Lines -anchor n
71
+ $c create line 1c 1c 3c 1c 1c 4c 3c 4c -width 2m -fill $blue \
72
+ -cap butt -join miter -tags item
73
+ $c create line 4.67c 1c 4.67c 4c -arrow last -tags item
74
+ $c create line 6.33c 1c 6.33c 4c -arrow both -tags item
75
+ $c create line 5c 6c 9c 6c 9c 1c 8c 1c 8c 4.8c 8.8c 4.8c 8.8c 1.2c \
76
+ 8.2c 1.2c 8.2c 4.6c 8.6c 4.6c 8.6c 1.4c 8.4c 1.4c 8.4c 4.4c \
77
+ -width 3 -fill $red -tags item
78
+ # Main widget program sets variable tk_demoDirectory
79
+ $c create line 1c 5c 7c 5c 7c 7c 9c 7c -width .5c \
80
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
81
+ -arrow both -arrowshape {15 15 7} -tags item
82
+ $c create line 1c 7c 1.75c 5.8c 2.5c 7c 3.25c 5.8c 4c 7c -width .5c \
83
+ -cap round -join round -tags item
84
+
85
+ $c create text 15c .2c -text "Curves (smoothed lines)" -anchor n
86
+ $c create line 11c 4c 11.5c 1c 13.5c 1c 14c 4c -smooth on \
87
+ -fill $blue -tags item
88
+ $c create line 15.5c 1c 19.5c 1.5c 15.5c 4.5c 19.5c 4c -smooth on \
89
+ -arrow both -width 3 -tags item
90
+ $c create line 12c 6c 13.5c 4.5c 16.5c 7.5c 18c 6c \
91
+ 16.5c 4.5c 13.5c 7.5c 12c 6c -smooth on -width 3m -cap round \
92
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
93
+ -fill $red -tags item
94
+
95
+ $c create text 25c .2c -text Polygons -anchor n
96
+ $c create polygon 21c 1.0c 22.5c 1.75c 24c 1.0c 23.25c 2.5c \
97
+ 24c 4.0c 22.5c 3.25c 21c 4.0c 21.75c 2.5c -fill $green \
98
+ -outline {} -width 4 -tags item
99
+ $c create polygon 25c 4c 25c 4c 25c 1c 26c 1c 27c 4c 28c 1c \
100
+ 29c 1c 29c 4c 29c 4c -fill $red -outline {} -smooth on -tags item
101
+ $c create polygon 22c 4.5c 25c 4.5c 25c 6.75c 28c 6.75c \
102
+ 28c 5.25c 24c 5.25c 24c 6.0c 26c 6c 26c 7.5c 22c 7.5c \
103
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
104
+ -fill $blue -outline {} -tags item
105
+
106
+ $c create text 5c 8.2c -text Rectangles -anchor n
107
+ $c create rectangle 1c 9.5c 4c 12.5c -outline $red -width 3m -tags item
108
+ $c create rectangle 0.5c 13.5c 4.5c 15.5c -fill $green -tags item
109
+ $c create rectangle 6c 10c 9c 15c -outline {} \
110
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
111
+ -fill $blue -tags item
112
+
113
+ $c create text 15c 8.2c -text Ovals -anchor n
114
+ $c create oval 11c 9.5c 14c 12.5c -outline $red -width 3m -tags item
115
+ $c create oval 10.5c 13.5c 14.5c 15.5c -fill $green -tags item
116
+ $c create oval 16c 10c 19c 15c -outline {} \
117
+ -stipple @[file join $tk_demoDirectory images gray25.xbm] \
118
+ -fill $blue -tags item
119
+
120
+ $c create text 25c 8.2c -text Text -anchor n
121
+ $c create rectangle 22.4c 8.9c 22.6c 9.1c
122
+ $c create text 22.5c 9c -anchor n -font $font1 -width 4c \
123
+ -text "A short string of text, word-wrapped, justified left, and anchored north (at the top). The rectangles show the anchor points for each piece of text." -tags item
124
+ $c create rectangle 25.4c 10.9c 25.6c 11.1c
125
+ $c create text 25.5c 11c -anchor w -font $font1 -fill $blue \
126
+ -text "Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge." \
127
+ -justify center -tags item
128
+ $c create rectangle 24.9c 13.9c 25.1c 14.1c
129
+ catch {
130
+ $c create text 25c 14c -font $font2 -anchor c -fill $red -angle 15 \
131
+ -text "Angled characters" -tags item
132
+ }
133
+
134
+ $c create text 5c 16.2c -text Arcs -anchor n
135
+ $c create arc 0.5c 17c 7c 20c -fill $green -outline black \
136
+ -start 45 -extent 270 -style pieslice -tags item
137
+ $c create arc 6.5c 17c 9.5c 20c -width 4m -style arc \
138
+ -outline $blue -start -135 -extent 270 -tags item \
139
+ -outlinestipple @[file join $tk_demoDirectory images gray25.xbm]
140
+ $c create arc 0.5c 20c 9.5c 24c -width 4m -style pieslice \
141
+ -fill {} -outline $red -start 225 -extent -90 -tags item
142
+ $c create arc 5.5c 20.5c 9.5c 23.5c -width 4m -style chord \
143
+ -fill $blue -outline {} -start 45 -extent 270 -tags item
144
+
145
+ $c create text 15c 16.2c -text "Bitmaps and Images" -anchor n
146
+ catch {
147
+ image create photo items.ousterhout \
148
+ -file [file join $tk_demoDirectory images ouster.png]
149
+ image create photo items.ousterhout.active -format "png -alpha 0.5" \
150
+ -file [file join $tk_demoDirectory images ouster.png]
151
+ $c create image 13c 20c -tags item -image items.ousterhout \
152
+ -activeimage items.ousterhout.active
153
+ }
154
+ $c create bitmap 17c 18.5c -tags item \
155
+ -bitmap @[file join $tk_demoDirectory images noletter.xbm]
156
+ $c create bitmap 17c 21.5c -tags item \
157
+ -bitmap @[file join $tk_demoDirectory images letters.xbm]
158
+
159
+ $c create text 25c 16.2c -text Windows -anchor n
160
+ button $c.button -text "Press Me" -command "butPress $c $red"
161
+ $c create window 21c 18c -window $c.button -anchor nw -tags item
162
+ entry $c.entry -width 20 -relief sunken
163
+ $c.entry insert end "Edit this text"
164
+ $c create window 21c 21c -window $c.entry -anchor nw -tags item
165
+ scale $c.scale -from 0 -to 100 -length 6c -sliderlength .4c \
166
+ -width .5c -tickinterval 0
167
+ $c create window 28.5c 17.5c -window $c.scale -anchor n -tags item
168
+ $c create text 21c 17.9c -text Button: -anchor sw
169
+ $c create text 21c 20.9c -text Entry: -anchor sw
170
+ $c create text 28.5c 17.4c -text Scale: -anchor s
171
+
172
+ # Set up event bindings for canvas:
173
+
174
+ $c bind item <Enter> "itemEnter $c"
175
+ $c bind item <Leave> "itemLeave $c"
176
+ if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
177
+ bind $c <Button-2> "itemMark $c %x %y"
178
+ bind $c <B2-Motion> "itemStroke $c %x %y"
179
+ bind $c <Button-3> "$c scan mark %x %y"
180
+ bind $c <B3-Motion> "$c scan dragto %x %y"
181
+ } else {
182
+ bind $c <Button-2> "$c scan mark %x %y"
183
+ bind $c <B2-Motion> "$c scan dragto %x %y"
184
+ bind $c <Button-3> "itemMark $c %x %y"
185
+ bind $c <B3-Motion> "itemStroke $c %x %y"
186
+ }
187
+ bind $c <<NextChar>> "itemsUnderArea $c"
188
+ bind $c <Button-1> "itemStartDrag $c %x %y"
189
+ bind $c <B1-Motion> "itemDrag $c %x %y"
190
+
191
+ # Utility procedures for highlighting the item under the pointer:
192
+
193
+ proc itemEnter {c} {
194
+ global restoreCmd
195
+
196
+ if {[winfo depth $c] == 1} {
197
+ set restoreCmd {}
198
+ return
199
+ }
200
+ set type [$c type current]
201
+ if {$type == "window" || $type == "image"} {
202
+ set restoreCmd {}
203
+ return
204
+ } elseif {$type == "bitmap"} {
205
+ set bg [lindex [$c itemconf current -background] 4]
206
+ set restoreCmd [list $c itemconfig current -background $bg]
207
+ $c itemconfig current -background SteelBlue2
208
+ return
209
+ } elseif {$type == "image"} {
210
+ set restoreCmd [list $c itemconfig current -state normal]
211
+ $c itemconfig current -state active
212
+ return
213
+ }
214
+ set fill [lindex [$c itemconfig current -fill] 4]
215
+ if {(($type == "rectangle") || ($type == "oval") || ($type == "arc"))
216
+ && ($fill == "")} {
217
+ set outline [lindex [$c itemconfig current -outline] 4]
218
+ set restoreCmd "$c itemconfig current -outline $outline"
219
+ $c itemconfig current -outline SteelBlue2
220
+ } else {
221
+ set restoreCmd "$c itemconfig current -fill $fill"
222
+ $c itemconfig current -fill SteelBlue2
223
+ }
224
+ }
225
+
226
+ proc itemLeave {c} {
227
+ global restoreCmd
228
+
229
+ eval $restoreCmd
230
+ }
231
+
232
+ # Utility procedures for stroking out a rectangle and printing what's
233
+ # underneath the rectangle's area.
234
+
235
+ proc itemMark {c x y} {
236
+ global areaX1 areaY1
237
+ set areaX1 [$c canvasx $x]
238
+ set areaY1 [$c canvasy $y]
239
+ $c delete area
240
+ }
241
+
242
+ proc itemStroke {c x y} {
243
+ global areaX1 areaY1 areaX2 areaY2
244
+ set x [$c canvasx $x]
245
+ set y [$c canvasy $y]
246
+ if {($areaX1 != $x) && ($areaY1 != $y)} {
247
+ $c delete area
248
+ $c addtag area withtag [$c create rect $areaX1 $areaY1 $x $y \
249
+ -outline black]
250
+ set areaX2 $x
251
+ set areaY2 $y
252
+ }
253
+ }
254
+
255
+ proc itemsUnderArea {c} {
256
+ global areaX1 areaY1 areaX2 areaY2
257
+ set area [$c find withtag area]
258
+ set items ""
259
+ foreach i [$c find enclosed $areaX1 $areaY1 $areaX2 $areaY2] {
260
+ if {[lsearch [$c gettags $i] item] >= 0} {
261
+ lappend items $i
262
+ }
263
+ }
264
+ puts stdout "Items enclosed by area: $items"
265
+ set items ""
266
+ foreach i [$c find overlapping $areaX1 $areaY1 $areaX2 $areaY2] {
267
+ if {[lsearch [$c gettags $i] item] >= 0} {
268
+ lappend items $i
269
+ }
270
+ }
271
+ puts stdout "Items overlapping area: $items"
272
+ }
273
+
274
+ set areaX1 0
275
+ set areaY1 0
276
+ set areaX2 0
277
+ set areaY2 0
278
+
279
+ # Utility procedures to support dragging of items.
280
+
281
+ proc itemStartDrag {c x y} {
282
+ global lastX lastY
283
+ set lastX [$c canvasx $x]
284
+ set lastY [$c canvasy $y]
285
+ }
286
+
287
+ proc itemDrag {c x y} {
288
+ global lastX lastY
289
+ set x [$c canvasx $x]
290
+ set y [$c canvasy $y]
291
+ $c move current [expr {$x-$lastX}] [expr {$y-$lastY}]
292
+ set lastX $x
293
+ set lastY $y
294
+ }
295
+
296
+ # Procedure that's invoked when the button embedded in the canvas
297
+ # is invoked.
298
+
299
+ proc butPress {w color} {
300
+ set i [$w create text 25c 18.1c -text "Oooohhh!!" -fill $color -anchor n]
301
+ after 500 "$w delete $i"
302
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/ixset ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # ixset --
6
+ # A nice interface to "xset" to change X server settings
7
+ #
8
+ # History :
9
+ # 91/11/23 : pda@masi.ibp.fr, jt@ratp.fr : design
10
+ # 92/08/01 : pda@masi.ibp.fr : cleaning
11
+
12
+ package require Tk
13
+
14
+ #
15
+ # Button actions
16
+ #
17
+
18
+ proc quit {} {
19
+ destroy .
20
+ }
21
+
22
+ proc ok {} {
23
+ writesettings
24
+ quit
25
+ }
26
+
27
+ proc cancel {} {
28
+ readsettings
29
+ dispsettings
30
+ .buttons.apply configure -state disabled
31
+ .buttons.cancel configure -state disabled
32
+ }
33
+
34
+ proc apply {} {
35
+ writesettings
36
+ .buttons.apply configure -state disabled
37
+ .buttons.cancel configure -state disabled
38
+ }
39
+
40
+ #
41
+ # Read current settings
42
+ #
43
+
44
+ proc readsettings {} {
45
+ global kbdrep ; set kbdrep "on"
46
+ global kbdcli ; set kbdcli 0
47
+ global bellvol ; set bellvol 100
48
+ global bellpit ; set bellpit 440
49
+ global belldur ; set belldur 100
50
+ global mouseacc ; set mouseacc "3/1"
51
+ global mousethr ; set mousethr 4
52
+ global screenbla ; set screenbla "blank"
53
+ global screentim ; set screentim 600
54
+ global screencyc ; set screencyc 600
55
+
56
+ set xfd [open "|xset q" r]
57
+ while {[gets $xfd line] >= 0} {
58
+ switch -- [lindex $line 0] {
59
+ auto {
60
+ set rpt [lindex $line 1]
61
+ if {$rpt eq "repeat:"} {
62
+ set kbdrep [lindex $line 2]
63
+ set kbdcli [lindex $line 6]
64
+ }
65
+ }
66
+ bell {
67
+ set bellvol [lindex $line 2]
68
+ set bellpit [lindex $line 5]
69
+ set belldur [lindex $line 8]
70
+ }
71
+ acceleration: {
72
+ set mouseacc [lindex $line 1]
73
+ set mousethr [lindex $line 3]
74
+ }
75
+ prefer {
76
+ set bla [lindex $line 2]
77
+ set screenbla [expr {$bla eq "yes" ? "blank" : "noblank"}]
78
+ }
79
+ timeout: {
80
+ set screentim [lindex $line 1]
81
+ set screencyc [lindex $line 3]
82
+ }
83
+ }
84
+ }
85
+ close $xfd
86
+
87
+ # puts stdout [format "Key REPEAT = %s\n" $kbdrep]
88
+ # puts stdout [format "Key CLICK = %s\n" $kbdcli]
89
+ # puts stdout [format "Bell VOLUME = %s\n" $bellvol]
90
+ # puts stdout [format "Bell PITCH = %s\n" $bellpit]
91
+ # puts stdout [format "Bell DURATION = %s\n" $belldur]
92
+ # puts stdout [format "Mouse ACCELERATION = %s\n" $mouseacc]
93
+ # puts stdout [format "Mouse THRESHOLD = %s\n" $mousethr]
94
+ # puts stdout [format "Screen BLANCK = %s\n" $screenbla]
95
+ # puts stdout [format "Screen TIMEOUT = %s\n" $screentim]
96
+ # puts stdout [format "Screen CYCLE = %s\n" $screencyc]
97
+ }
98
+
99
+
100
+ #
101
+ # Write settings into the X server
102
+ #
103
+
104
+ proc writesettings {} {
105
+ global kbdrep kbdcli bellvol bellpit belldur
106
+ global mouseacc mousethr screenbla screentim screencyc
107
+
108
+ set bellvol [.bell.vol get]
109
+ set bellpit [.bell.val.pit.entry get]
110
+ set belldur [.bell.val.dur.entry get]
111
+
112
+ if {$kbdrep eq "on"} {
113
+ set kbdcli [.kbd.val.cli get]
114
+ } else {
115
+ set kbdcli "off"
116
+ }
117
+
118
+ set mouseacc [.mouse.hor.acc.entry get]
119
+ set mousethr [.mouse.hor.thr.entry get]
120
+
121
+ set screentim [.screen.tim.entry get]
122
+ set screencyc [.screen.cyc.entry get]
123
+
124
+ exec xset \
125
+ b $bellvol $bellpit $belldur \
126
+ c $kbdcli \
127
+ r $kbdrep \
128
+ m $mouseacc $mousethr \
129
+ s $screentim $screencyc \
130
+ s $screenbla
131
+ }
132
+
133
+
134
+ #
135
+ # Sends all settings to the window
136
+ #
137
+
138
+ proc dispsettings {} {
139
+ global kbdrep kbdcli bellvol bellpit belldur
140
+ global mouseacc mousethr screenbla screentim screencyc
141
+
142
+ .bell.vol set $bellvol
143
+ .bell.val.pit.entry delete 0 end
144
+ .bell.val.pit.entry insert 0 $bellpit
145
+ .bell.val.dur.entry delete 0 end
146
+ .bell.val.dur.entry insert 0 $belldur
147
+
148
+ .kbd.val.onoff [expr {$kbdrep eq "on" ? "select" : "deselect"}]
149
+ .kbd.val.cli set $kbdcli
150
+
151
+ .mouse.hor.acc.entry delete 0 end
152
+ .mouse.hor.acc.entry insert 0 $mouseacc
153
+ .mouse.hor.thr.entry delete 0 end
154
+ .mouse.hor.thr.entry insert 0 $mousethr
155
+
156
+ .screen.blank [expr {$screenbla eq "blank" ? "select" : "deselect"}]
157
+ .screen.pat [expr {$screenbla ne "blank" ? "select" : "deselect"}]
158
+ .screen.tim.entry delete 0 end
159
+ .screen.tim.entry insert 0 $screentim
160
+ .screen.cyc.entry delete 0 end
161
+ .screen.cyc.entry insert 0 $screencyc
162
+ }
163
+
164
+
165
+ #
166
+ # Create all windows, and pack them
167
+ #
168
+
169
+ proc labelentry {path text length {range {}}} {
170
+ frame $path
171
+ label $path.label -text $text
172
+ if {[llength $range]} {
173
+ spinbox $path.entry -width $length -relief sunken \
174
+ -from [lindex $range 0] -to [lindex $range 1]
175
+ } else {
176
+ entry $path.entry -width $length -relief sunken
177
+ }
178
+ pack $path.label -side left
179
+ pack $path.entry -side right -expand y -fill x
180
+ }
181
+
182
+ proc createwindows {} {
183
+ #
184
+ # Buttons
185
+ #
186
+
187
+ frame .buttons
188
+ button .buttons.ok -default active -command ok -text "Ok"
189
+ button .buttons.apply -default normal -command apply -text "Apply" \
190
+ -state disabled
191
+ button .buttons.cancel -default normal -command cancel -text "Cancel" \
192
+ -state disabled
193
+ button .buttons.quit -default normal -command quit -text "Quit"
194
+
195
+ pack .buttons.ok .buttons.apply .buttons.cancel .buttons.quit \
196
+ -side left -expand yes -pady 5
197
+
198
+ bind . <Return> {.buttons.ok flash; .buttons.ok invoke}
199
+ bind . <Escape> {.buttons.quit flash; .buttons.quit invoke}
200
+ bind . <Button-1> {
201
+ if {![string match .buttons* %W]} {
202
+ .buttons.apply configure -state normal
203
+ .buttons.cancel configure -state normal
204
+ }
205
+ }
206
+ bind . <Key> {
207
+ if {![string match .buttons* %W]} {
208
+ switch -glob %K {
209
+ Return - Escape - Tab - *Shift* {}
210
+ default {
211
+ .buttons.apply configure -state normal
212
+ .buttons.cancel configure -state normal
213
+ }
214
+ }
215
+ }
216
+ }
217
+
218
+ #
219
+ # Bell settings
220
+ #
221
+
222
+ labelframe .bell -text "Bell Settings" -padx 1.5m -pady 1.5m
223
+ scale .bell.vol \
224
+ -from 0 -to 100 -length 200 -tickinterval 20 \
225
+ -label "Volume (%)" -orient horizontal
226
+
227
+ frame .bell.val
228
+ labelentry .bell.val.pit "Pitch (Hz)" 6 {25 20000}
229
+ labelentry .bell.val.dur "Duration (ms)" 6 {1 10000}
230
+ pack .bell.val.pit -side left -padx 5
231
+ pack .bell.val.dur -side right -padx 5
232
+ pack .bell.vol .bell.val -side top -expand yes
233
+
234
+ #
235
+ # Keyboard settings
236
+ #
237
+
238
+ labelframe .kbd -text "Keyboard Repeat Settings" -padx 1.5m -pady 1.5m
239
+
240
+ frame .kbd.val
241
+ checkbutton .kbd.val.onoff \
242
+ -text "On" \
243
+ -onvalue "on" -offvalue "off" -variable kbdrep \
244
+ -relief flat
245
+ scale .kbd.val.cli \
246
+ -from 0 -to 100 -length 200 -tickinterval 20 \
247
+ -label "Click Volume (%)" -orient horizontal
248
+ pack .kbd.val.onoff -side left -fill x -expand yes -padx {0 1m}
249
+ pack .kbd.val.cli -side left -expand yes -fill x -padx {1m 0}
250
+
251
+ pack .kbd.val -side top -expand yes -pady 2 -fill x
252
+
253
+ #
254
+ # Mouse settings
255
+ #
256
+
257
+ labelframe .mouse -text "Mouse Settings" -padx 1.5m -pady 1.5m
258
+
259
+ frame .mouse.hor
260
+ labelentry .mouse.hor.acc "Acceleration" 5
261
+ labelentry .mouse.hor.thr "Threshold (pixels)" 3 {1 2000}
262
+
263
+ pack .mouse.hor.acc -side left -padx {0 1m}
264
+ pack .mouse.hor.thr -side right -padx {1m 0}
265
+
266
+ pack .mouse.hor -side top -expand yes
267
+
268
+ #
269
+ # Screen Saver settings
270
+ #
271
+
272
+ labelframe .screen -text "Screen-saver Settings" -padx 1.5m -pady 1.5m
273
+
274
+ radiobutton .screen.blank \
275
+ -variable screenblank -text "Blank" -relief flat \
276
+ -value "blank" -variable screenbla -anchor w
277
+ radiobutton .screen.pat \
278
+ -variable screenblank -text "Pattern" -relief flat \
279
+ -value "noblank" -variable screenbla -anchor w
280
+ labelentry .screen.tim "Timeout (s)" 5 {1 100000}
281
+ labelentry .screen.cyc "Cycle (s)" 5 {1 100000}
282
+
283
+ grid .screen.blank .screen.tim -sticky e
284
+ grid .screen.pat .screen.cyc -sticky e
285
+ grid configure .screen.blank .screen.pat -sticky ew
286
+
287
+ #
288
+ # Main window
289
+ #
290
+
291
+ pack .buttons -side top -fill both
292
+ pack .bell .kbd .mouse .screen -side top -fill both -expand yes \
293
+ -padx 1m -pady 1m
294
+
295
+ #
296
+ # Let the user resize our window
297
+ #
298
+ wm minsize . 10 10
299
+ }
300
+
301
+ ##############################################################################
302
+ # Main program
303
+
304
+ #
305
+ # Listen what "xset" tells us...
306
+ #
307
+
308
+ readsettings
309
+
310
+ #
311
+ # Create all windows
312
+ #
313
+
314
+ createwindows
315
+
316
+ #
317
+ # Write xset parameters
318
+ #
319
+
320
+ dispsettings
321
+
322
+ #
323
+ # Now, wait for user actions...
324
+ #
325
+
326
+ # Local Variables:
327
+ # mode: tcl
328
+ # End:
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/knightstour.tcl ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
2
+ #
3
+ # Calculate a Knight's tour of a chessboard.
4
+ #
5
+ # This uses Warnsdorff's rule to calculate the next square each
6
+ # time. This specifies that the next square should be the one that
7
+ # has the least number of available moves.
8
+ #
9
+ # Using this rule it is possible to get to a position where
10
+ # there are no squares available to move into. In this implementation
11
+ # this occurs when the starting square is d6.
12
+ #
13
+ # To solve this fault an enhancement to the rule is that if we
14
+ # have a choice of squares with an equal score, we should choose
15
+ # the one nearest the edge of the board.
16
+ #
17
+ # If the call to the Edgemost function is commented out you can see
18
+ # this occur.
19
+ #
20
+ # You can drag the knight to a specific square to start if you wish.
21
+ # If you let it repeat then it will choose random start positions
22
+ # for each new tour.
23
+
24
+ package require Tk
25
+
26
+ # Return a list of accessible squares from a given square
27
+ proc ValidMoves {square} {
28
+ set moves {}
29
+ foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} {
30
+ set col [expr {($square % 8) + [lindex $pair 0]}]
31
+ set row [expr {($square / 8) + [lindex $pair 1]}]
32
+ if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} {
33
+ lappend moves [expr {$row * 8 + $col}]
34
+ }
35
+ }
36
+ return $moves
37
+ }
38
+
39
+ # Return the number of available moves for this square
40
+ proc CheckSquare {square} {
41
+ variable visited
42
+ set moves 0
43
+ foreach test [ValidMoves $square] {
44
+ if {[lsearch -exact -integer $visited $test] < 0} {
45
+ incr moves
46
+ }
47
+ }
48
+ return $moves
49
+ }
50
+
51
+ # Select the next square to move to. Returns -1 if there are no available
52
+ # squares remaining that we can move to.
53
+ proc Next {square} {
54
+ variable visited
55
+ set minimum 9
56
+ set nextSquare -1
57
+ foreach testSquare [ValidMoves $square] {
58
+ if {[lsearch -exact -integer $visited $testSquare] < 0} {
59
+ set count [CheckSquare $testSquare]
60
+ if {$count < $minimum} {
61
+ set minimum $count
62
+ set nextSquare $testSquare
63
+ } elseif {$count == $minimum} {
64
+ # to remove the enhancement to Warnsdorff's rule
65
+ # remove the next line:
66
+ set nextSquare [Edgemost $nextSquare $testSquare]
67
+ }
68
+ }
69
+ }
70
+ return $nextSquare
71
+ }
72
+
73
+ # Select the square nearest the edge of the board
74
+ proc Edgemost {a b} {
75
+ set colA [expr {3-int(abs(3.5-($a%8)))}]
76
+ set colB [expr {3-int(abs(3.5-($b%8)))}]
77
+ set rowA [expr {3-int(abs(3.5-($a/8)))}]
78
+ set rowB [expr {3-int(abs(3.5-($b/8)))}]
79
+ return [expr {($colA * $rowA) < ($colB * $rowB) ? $a : $b}]
80
+ }
81
+
82
+ # Display a square number as a standard chess square notation.
83
+ proc N {square} {
84
+ return [format %c%d [expr {97 + $square % 8}] \
85
+ [expr {$square / 8 + 1}]]
86
+ }
87
+
88
+ # Perform a Knight's move and schedule the next move.
89
+ proc MovePiece {dlg last square} {
90
+ variable visited
91
+ variable delay
92
+ variable continuous
93
+ $dlg.f.txt insert end "[llength $visited]. [N $last] .. [N $square]\n" {}
94
+ $dlg.f.txt see end
95
+ $dlg.f.c itemconfigure [expr {1+$last}] -state normal -outline black
96
+ $dlg.f.c itemconfigure [expr {1+$square}] -state normal -outline red
97
+ $dlg.f.c moveto knight {*}[lrange [$dlg.f.c coords [expr {1+$square}]] 0 1]
98
+ lappend visited $square
99
+ set next [Next $square]
100
+ if {$next ne -1} {
101
+ variable aid [after $delay [list MovePiece $dlg $square $next]]
102
+ } else {
103
+ $dlg.tf.b1 configure -state normal
104
+ if {[llength $visited] == 64} {
105
+ variable initial
106
+ if {$initial == $square} {
107
+ $dlg.f.txt insert end "Closed tour!"
108
+ } else {
109
+ $dlg.f.txt insert end "Success\n" {}
110
+ if {$continuous} {
111
+ after [expr {$delay * 2}] [namespace code \
112
+ [list Tour $dlg [expr {int(rand() * 64)}]]]
113
+ }
114
+ }
115
+ } else {
116
+ $dlg.f.txt insert end "FAILED!\n" {}
117
+ }
118
+ }
119
+ }
120
+
121
+ # Begin a new tour of the board given a random start position
122
+ proc Tour {dlg {square {}}} {
123
+ variable visited {}
124
+ $dlg.f.txt delete 1.0 end
125
+ $dlg.tf.b1 configure -state disabled
126
+ for {set n 0} {$n < 64} {incr n} {
127
+ $dlg.f.c itemconfigure $n -state disabled -outline black
128
+ }
129
+ if {$square eq {}} {
130
+ set coords [lrange [$dlg.f.c coords knight] 0 1]
131
+ set square [expr {[$dlg.f.c find closest {*}$coords 0 65]-1}]
132
+ }
133
+ variable initial $square
134
+ after idle [list MovePiece $dlg $initial $initial]
135
+ }
136
+
137
+ proc Stop {} {
138
+ variable aid
139
+ catch {after cancel $aid}
140
+ }
141
+
142
+ proc Exit {dlg} {
143
+ Stop
144
+ destroy $dlg
145
+ }
146
+
147
+ proc SetDelay {new} {
148
+ variable delay [expr {int($new)}]
149
+ }
150
+
151
+ proc DragStart {w x y} {
152
+ $w dtag selected
153
+ $w addtag selected withtag current
154
+ variable dragging [list $x $y]
155
+ }
156
+ proc DragMotion {w x y} {
157
+ variable dragging
158
+ if {[info exists dragging]} {
159
+ $w move selected [expr {$x - [lindex $dragging 0]}] \
160
+ [expr {$y - [lindex $dragging 1]}]
161
+ variable dragging [list $x $y]
162
+ }
163
+ }
164
+ proc DragEnd {w x y} {
165
+ set square [$w find closest $x $y 0 65]
166
+ $w moveto selected {*}[lrange [$w coords $square] 0 1]
167
+ $w dtag selected
168
+ variable dragging ; unset dragging
169
+ }
170
+
171
+ proc CreateGUI {} {
172
+ catch {destroy .knightstour}
173
+ set dlg [toplevel .knightstour]
174
+ wm title $dlg "Knights tour"
175
+ wm withdraw $dlg
176
+ set f [ttk::frame $dlg.f]
177
+ set c [canvas $f.c -width 240 -height 240]
178
+ text $f.txt -width 10 -height 1 \
179
+ -yscrollcommand [list $f.vs set] -font {Arial 8}
180
+ ttk::scrollbar $f.vs -command [list $f.txt yview]
181
+
182
+ variable delay 600
183
+ variable continuous 0
184
+ ttk::frame $dlg.tf
185
+ ttk::label $dlg.tf.ls -text Speed
186
+ ttk::scale $dlg.tf.sc -from 8 -to 2000 -command [list SetDelay] \
187
+ -variable [namespace which -variable delay]
188
+ ttk::checkbutton $dlg.tf.cc -text Repeat \
189
+ -variable [namespace which -variable continuous]
190
+ ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg]
191
+ ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg]
192
+ set square 0
193
+ for {set row 7} {$row >= 0} {incr row -1} {
194
+ for {set col 0} {$col < 8} {incr col} {
195
+ if {(($col & 1) ^ ($row & 1))} {
196
+ set fill tan3 ; set dfill tan4
197
+ } else {
198
+ set fill bisque ; set dfill bisque3
199
+ }
200
+ set coords [list [expr {$col * 30 + 4}] [expr {$row * 30 + 4}] \
201
+ [expr {$col * 30 + 30}] [expr {$row * 30 + 30}]]
202
+ $c create rectangle $coords -fill $fill -disabledfill $dfill \
203
+ -width 2 -state disabled -outline black
204
+ }
205
+ }
206
+ if {[tk windowingsystem] ne "x11"} {
207
+ catch {eval font create KnightFont -size -24}
208
+ $c create text 0 0 -font KnightFont -text "\u265e" \
209
+ -anchor nw -tags knight -fill black -activefill "#600000"
210
+ } else {
211
+ # On X11 we cannot reliably tell if the \u265e glyph is available
212
+ # so just use a polygon
213
+ set pts {
214
+ 2 25 24 25 21 19 20 8 14 0 10 0 0 13 0 16
215
+ 2 17 4 14 5 15 3 17 5 17 9 14 10 15 5 21
216
+ }
217
+ $c create polygon $pts -tag knight -offset 8 \
218
+ -fill black -activefill "#600000"
219
+ }
220
+ $c moveto knight {*}[lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1]
221
+ $c bind knight <Button-1> [namespace code [list DragStart %W %x %y]]
222
+ $c bind knight <Motion> [namespace code [list DragMotion %W %x %y]]
223
+ $c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]]
224
+
225
+ grid $c $f.txt $f.vs -sticky news
226
+ grid rowconfigure $f 0 -weight 1
227
+ grid columnconfigure $f 1 -weight 1
228
+
229
+ grid $f - - - - - -sticky news
230
+ set things [list $dlg.tf.ls $dlg.tf.sc $dlg.tf.cc $dlg.tf.b1]
231
+ if {![info exists ::widgetDemo]} {
232
+ lappend things $dlg.tf.b2
233
+ if {[tk windowingsystem] ne "aqua"} {
234
+ set things [linsert $things 0 [ttk::sizegrip $dlg.tf.sg]]
235
+ }
236
+ }
237
+ pack {*}$things -side right
238
+ if {[tk windowingsystem] eq "aqua"} {
239
+ pack configure {*}$things -padx {4 4} -pady {12 12}
240
+ pack configure [lindex $things 0] -padx {4 24}
241
+ pack configure [lindex $things end] -padx {16 4}
242
+ }
243
+ grid $dlg.tf - - - - - -sticky ew
244
+ if {[info exists ::widgetDemo]} {
245
+ grid [addSeeDismiss $dlg.buttons $dlg] - - - - - -sticky ew
246
+ }
247
+
248
+ grid rowconfigure $dlg 0 -weight 1
249
+ grid columnconfigure $dlg 0 -weight 1
250
+
251
+ bind $dlg <Control-F2> {console show}
252
+ bind $dlg <Return> [list $dlg.tf.b1 invoke]
253
+ bind $dlg <Escape> [list $dlg.tf.b2 invoke]
254
+ bind $dlg <Destroy> [namespace code [list Stop]]
255
+ wm protocol $dlg WM_DELETE_WINDOW [namespace code [list Exit $dlg]]
256
+
257
+ wm deiconify $dlg
258
+ tkwait window $dlg
259
+ }
260
+
261
+ if {![winfo exists .knightstour]} {
262
+ if {![info exists widgetDemo]} { wm withdraw . }
263
+ set r [catch [linsert $argv 0 CreateGUI] err]
264
+ if {$r} {
265
+ tk_messageBox -icon error -title "Error" -message $err
266
+ }
267
+ if {![info exists widgetDemo]} { exit $r }
268
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/label.tcl ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # label.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # several label widgets.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .label
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Label Demonstration"
16
+ wm iconname $w "label"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "Five labels are displayed below: three textual ones on the left, and an image label and a text label on the right. Labels are pretty boring because you can't do anything with them."
20
+ pack $w.msg -side top
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w]
24
+ pack $btns -side bottom -fill x
25
+
26
+ frame $w.left
27
+ frame $w.right
28
+ pack $w.left $w.right -side left -expand yes -padx 10 -pady 10 -fill both
29
+
30
+ label $w.left.l1 -text "First label"
31
+ label $w.left.l2 -text "Second label, raised" -relief raised
32
+ label $w.left.l3 -text "Third label, sunken" -relief sunken
33
+ pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -pady 2 -anchor w
34
+
35
+ # Main widget program sets variable tk_demoDirectory
36
+ image create photo label.ousterhout \
37
+ -file [file join $tk_demoDirectory images ouster.png]
38
+ label $w.right.picture -borderwidth 2 -relief sunken -image label.ousterhout
39
+ label $w.right.caption -text "Tcl/Tk Creator"
40
+ pack $w.right.picture $w.right.caption -side top
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/labelframe.tcl ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # labelframe.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # several labelframe widgets.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .labelframe
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Labelframe Demonstration"
16
+ wm iconname $w "labelframe"
17
+ positionWindow $w
18
+
19
+ # Some information
20
+
21
+ label $w.msg -font $font -wraplength 4i -justify left -text "Labelframes are\
22
+ used to group related widgets together. The label may be either \
23
+ plain text or another widget."
24
+ pack $w.msg -side top
25
+
26
+ ## See Code / Dismiss buttons
27
+ set btns [addSeeDismiss $w.buttons $w]
28
+ pack $btns -side bottom -fill x
29
+
30
+ # Demo area
31
+
32
+ frame $w.f
33
+ pack $w.f -side bottom -fill both -expand 1
34
+ set w $w.f
35
+
36
+ # A group of radiobuttons in a labelframe
37
+
38
+ labelframe $w.f -text "Value" -padx 2 -pady 2
39
+ grid $w.f -row 0 -column 0 -pady 2m -padx 2m
40
+
41
+ foreach value {1 2 3 4} {
42
+ radiobutton $w.f.b$value -text "This is value $value" \
43
+ -variable lfdummy -value $value
44
+ pack $w.f.b$value -side top -fill x -pady 2
45
+ }
46
+
47
+
48
+ # Using a label window to control a group of options.
49
+
50
+ proc lfEnableButtons {w} {
51
+ foreach child [winfo children $w] {
52
+ if {$child == "$w.cb"} continue
53
+ if {$::lfdummy2} {
54
+ $child configure -state normal
55
+ } else {
56
+ $child configure -state disabled
57
+ }
58
+ }
59
+ }
60
+
61
+ labelframe $w.f2 -pady 2 -padx 2
62
+ checkbutton $w.f2.cb -text "Use this option." -variable lfdummy2 \
63
+ -command "lfEnableButtons $w.f2" -padx 0
64
+ $w.f2 configure -labelwidget $w.f2.cb
65
+ grid $w.f2 -row 0 -column 1 -pady 2m -padx 2m
66
+
67
+ set t 0
68
+ foreach str {Option1 Option2 Option3} {
69
+ checkbutton $w.f2.b$t -text $str
70
+ pack $w.f2.b$t -side top -fill x -pady 2
71
+ incr t
72
+ }
73
+ lfEnableButtons $w.f2
74
+
75
+
76
+ grid columnconfigure $w {0 1} -weight 1
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/license.terms ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This software is copyrighted by the Regents of the University of
2
+ California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
3
+ Corporation, Apple Inc. and other parties. The following terms apply to
4
+ all files associated with the software unless explicitly disclaimed in
5
+ individual files.
6
+
7
+ The authors hereby grant permission to use, copy, modify, distribute,
8
+ and license this software and its documentation for any purpose, provided
9
+ that existing copyright notices are retained in all copies and that this
10
+ notice is included verbatim in any distributions. No written agreement,
11
+ license, or royalty fee is required for any of the authorized uses.
12
+ Modifications to this software may be copyrighted by their authors
13
+ and need not follow the licensing terms described here, provided that
14
+ the new terms are clearly indicated on the first page of each file where
15
+ they apply.
16
+
17
+ IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
18
+ FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
19
+ ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
20
+ DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
21
+ POSSIBILITY OF SUCH DAMAGE.
22
+
23
+ THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
24
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
26
+ IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
27
+ NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
28
+ MODIFICATIONS.
29
+
30
+ GOVERNMENT USE: If you are acquiring this software on behalf of the
31
+ U.S. government, the Government shall have only "Restricted Rights"
32
+ in the software and related documentation as defined in the Federal
33
+ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
34
+ are acquiring the software on behalf of the Department of Defense, the
35
+ software shall be classified as "Commercial Computer Software" and the
36
+ Government shall have only "Restricted Rights" as defined in Clause
37
+ 252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the
38
+ authors grant the U.S. Government and others acting in its behalf
39
+ permission to use and distribute the software in accordance with the
40
+ terms specified in this license.
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/mclist.tcl ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mclist.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing a Ttk
4
+ # tree widget configured as a multi-column listbox.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .mclist
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Multi-Column List"
16
+ wm iconname $w "mclist"
17
+ positionWindow $w
18
+
19
+ ## Explanatory text
20
+ ttk::label $w.msg -font $font -wraplength 4i -justify left -anchor n -padding {10 2 10 6} -text "Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which can be configured to display multiple columns of informational data without displaying the tree itself. This is a simple way to build a listbox that has multiple columns. Clicking on the heading for a column will sort the data by that column. You can also change the width of the columns by dragging the boundary between them."
21
+ pack $w.msg -fill x
22
+
23
+ ## See Code / Dismiss
24
+ pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
25
+
26
+ ttk::frame $w.container
27
+ ttk::treeview $w.tree -columns {country capital currency} -show headings \
28
+ -yscroll "$w.vsb set" -xscroll "$w.hsb set"
29
+ ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
30
+ ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
31
+ pack $w.container -fill both -expand 1
32
+ grid $w.tree $w.vsb -in $w.container -sticky nsew
33
+ grid $w.hsb -in $w.container -sticky nsew
34
+ grid column $w.container 0 -weight 1
35
+ grid row $w.container 0 -weight 1
36
+
37
+ image create photo upArrow -data {
38
+ R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAImhI+
39
+ py+1LIsJHiBAh+BgmiEAJQITgW6DgUQIAECH4JN8IPqYuNxUAOw==}
40
+ image create photo downArrow -data {
41
+ R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAInhI+
42
+ py+1I4ocQ/IgDEYIPgYJICUCE4F+YIBolEoKPEJKZmVJK6ZACADs=}
43
+ image create photo noArrow -height 14 -width 14
44
+
45
+ ## The data we're going to insert
46
+ set data {
47
+ Argentina {Buenos Aires} ARS
48
+ Australia Canberra AUD
49
+ Brazil Brazilia BRL
50
+ Canada Ottawa CAD
51
+ China Beijing CNY
52
+ France Paris EUR
53
+ Germany Berlin EUR
54
+ India {New Delhi} INR
55
+ Italy Rome EUR
56
+ Japan Tokyo JPY
57
+ Mexico {Mexico City} MXN
58
+ Russia Moscow RUB
59
+ {South Africa} Pretoria ZAR
60
+ {United Kingdom} London GBP
61
+ {United States} {Washington, D.C.} USD
62
+ }
63
+
64
+ ## Code to insert the data nicely
65
+ set font [ttk::style lookup Heading -font]
66
+ foreach col {country capital currency} name {Country Capital Currency} {
67
+ $w.tree heading $col -text $name -image noArrow -anchor w \
68
+ -command [list SortBy $w.tree $col 0]
69
+ $w.tree column $col -width [expr {
70
+ [font measure $font $name] + [image width noArrow] + 5
71
+ }]
72
+ }
73
+ set font [ttk::style lookup Treeview -font]
74
+ foreach {country capital currency} $data {
75
+ $w.tree insert {} end -values [list $country $capital $currency]
76
+ foreach col {country capital currency} {
77
+ set len [font measure $font "[set $col] "]
78
+ if {[$w.tree column $col -width] < $len} {
79
+ $w.tree column $col -width $len
80
+ }
81
+ }
82
+ }
83
+
84
+ ## Code to do the sorting of the tree contents when clicked on
85
+ proc SortBy {tree col direction} {
86
+ # Determine currently sorted column and its sort direction
87
+ foreach c {country capital currency} {
88
+ set s [$tree heading $c state]
89
+ if {("selected" in $s || "alternate" in $s) && $col ne $c} {
90
+ # Sorted column has changed
91
+ $tree heading $c -image noArrow state {!selected !alternate !user1}
92
+ set direction [expr {"alternate" in $s}]
93
+ }
94
+ }
95
+
96
+ # Build something we can sort
97
+ set data {}
98
+ foreach row [$tree children {}] {
99
+ lappend data [list [$tree set $row $col] $row]
100
+ }
101
+
102
+ set dir [expr {$direction ? "-decreasing" : "-increasing"}]
103
+ set r -1
104
+
105
+ # Now reshuffle the rows into the sorted order
106
+ foreach info [lsort -dictionary -index 0 $dir $data] {
107
+ $tree move [lindex $info 1] {} [incr r]
108
+ }
109
+
110
+ # Switch the heading so that it will sort in the opposite direction
111
+ $tree heading $col -command [list SortBy $tree $col [expr {!$direction}]] \
112
+ state [expr {$direction?"!selected alternate":"selected !alternate"}]
113
+ if {[ttk::style theme use] eq "aqua"} {
114
+ # Aqua theme displays native sort arrows when user1 state is set
115
+ $tree heading $col state "user1"
116
+ } else {
117
+ $tree heading $col -image [expr {$direction?"upArrow":"downArrow"}]
118
+ }
119
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/menu.tcl ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # menu.tcl --
2
+ #
3
+ # This demonstration script creates a window with a bunch of menus
4
+ # and cascaded menus using menubars.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .menu
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Menu Demonstration"
16
+ wm iconname $w "menu"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left
20
+ if {[tk windowingsystem] eq "aqua"} {
21
+ catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1}
22
+ $w.msg configure -text "This window has a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by selecting the first item in the menu."
23
+ } else {
24
+ $w.msg configure -text "This window contains a menubar with cascaded menus. You can post a menu from the keyboard by typing Alt+x, where \"x\" is the character underlined on the menu. You can then traverse among the menus using the arrow keys. When a menu is posted, you can invoke the current entry by typing space, or you can invoke any entry by typing its underlined character. If a menu entry has an accelerator, you can invoke the entry without posting the menu just by typing the accelerator. The rightmost menu can be torn off into a palette by selecting the first item in the menu."
25
+ }
26
+ pack $w.msg -side top
27
+
28
+ set menustatus " "
29
+ frame $w.statusBar
30
+ label $w.statusBar.label -textvariable menustatus -relief sunken -bd 1 -font "Helvetica 10" -anchor w
31
+ pack $w.statusBar.label -side left -padx 2 -expand yes -fill both
32
+ pack $w.statusBar -side bottom -fill x -pady 2
33
+
34
+ ## See Code / Dismiss buttons
35
+ set btns [addSeeDismiss $w.buttons $w]
36
+ pack $btns -side bottom -fill x
37
+
38
+ menu $w.menu -tearoff 0
39
+
40
+ set m $w.menu.file
41
+ menu $m -tearoff 0
42
+ $w.menu add cascade -label "File" -menu $m -underline 0
43
+ $m add command -label "Open..." -command {error "this is just a demo: no action has been defined for the \"Open...\" entry"}
44
+ $m add command -label "New" -command {error "this is just a demo: no action has been defined for the \"New\" entry"}
45
+ $m add command -label "Save" -command {error "this is just a demo: no action has been defined for the \"Save\" entry"}
46
+ $m add command -label "Save As..." -command {error "this is just a demo: no action has been defined for the \"Save As...\" entry"}
47
+ $m add separator
48
+ $m add command -label "Print Setup..." -command {error "this is just a demo: no action has been defined for the \"Print Setup...\" entry"}
49
+ $m add command -label "Print..." -command {error "this is just a demo: no action has been defined for the \"Print...\" entry"}
50
+ $m add separator
51
+ $m add command -label "Dismiss Menus Demo" -command "destroy $w"
52
+
53
+ set m $w.menu.basic
54
+ $w.menu add cascade -label "Basic" -menu $m -underline 0
55
+ menu $m -tearoff 0
56
+ $m add command -label "Long entry that does nothing"
57
+ if {[tk windowingsystem] eq "aqua"} {
58
+ set modifier Command
59
+ } elseif {[tk windowingsystem] == "win32"} {
60
+ set modifier Control
61
+ } else {
62
+ set modifier Meta
63
+ }
64
+ foreach i {A B C D E F} {
65
+ $m add command -label "Print letter \"$i\"" -underline 14 \
66
+ -accelerator $modifier+$i -command "puts $i"
67
+ bind $w <$modifier-[string tolower $i]> "puts $i"
68
+ }
69
+
70
+ set m $w.menu.cascade
71
+ $w.menu add cascade -label "Cascades" -menu $m -underline 0
72
+ menu $m -tearoff 0
73
+ $m add command -label "Print hello" \
74
+ -command {puts stdout "Hello"} -accelerator $modifier+H -underline 6
75
+ bind $w <$modifier-h> {puts stdout "Hello"}
76
+ $m add command -label "Print goodbye" -command {\
77
+ puts stdout "Goodbye"} -accelerator $modifier+G -underline 6
78
+ bind $w <$modifier-g> {puts stdout "Goodbye"}
79
+ $m add cascade -label "Check buttons" \
80
+ -menu $w.menu.cascade.check -underline 0
81
+ $m add cascade -label "Radio buttons" \
82
+ -menu $w.menu.cascade.radio -underline 0
83
+
84
+ set m $w.menu.cascade.check
85
+ menu $m -tearoff 0
86
+ $m add check -label "Oil checked" -variable oil
87
+ $m add check -label "Transmission checked" -variable trans
88
+ $m add check -label "Brakes checked" -variable brakes
89
+ $m add check -label "Lights checked" -variable lights
90
+ $m add separator
91
+ $m add command -label "Show current values" \
92
+ -command "showVars $w.menu.cascade.dialog oil trans brakes lights"
93
+ $m invoke 1
94
+ $m invoke 3
95
+
96
+ set m $w.menu.cascade.radio
97
+ menu $m -tearoff 0
98
+ $m add radio -label "10 point" -variable pointSize -value 10
99
+ $m add radio -label "14 point" -variable pointSize -value 14
100
+ $m add radio -label "18 point" -variable pointSize -value 18
101
+ $m add radio -label "24 point" -variable pointSize -value 24
102
+ $m add radio -label "32 point" -variable pointSize -value 32
103
+ $m add sep
104
+ $m add radio -label "Roman" -variable style -value roman
105
+ $m add radio -label "Bold" -variable style -value bold
106
+ $m add radio -label "Italic" -variable style -value italic
107
+ $m add sep
108
+ $m add command -label "Show current values" \
109
+ -command "showVars $w.menu.cascade.dialog pointSize style"
110
+ $m invoke 1
111
+ $m invoke 7
112
+
113
+ set m $w.menu.icon
114
+ $w.menu add cascade -label "Icons" -menu $m -underline 0
115
+ menu $m -tearoff 0
116
+ # Main widget program sets variable tk_demoDirectory
117
+ image create photo lilearth -file [file join $tk_demoDirectory \
118
+ images earthmenu.png]
119
+ $m add command -image lilearth \
120
+ -hidemargin 1 -command [list \
121
+ tk_dialog $w.pattern {Bitmap Menu Entry} \
122
+ "The menu entry you invoked displays a photoimage rather than\
123
+ a text string. Other than this, it is just like any other\
124
+ menu entry." {} 0 OK ]
125
+ foreach i {info questhead error} {
126
+ $m add command -bitmap $i -hidemargin 1 -command [list \
127
+ puts "You invoked the $i bitmap" ]
128
+ }
129
+ $m entryconfigure 2 -columnbreak 1
130
+
131
+ set m $w.menu.more
132
+ $w.menu add cascade -label "More" -menu $m -underline 0
133
+ menu $m -tearoff 0
134
+ foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Make life meaningful}} {
135
+ $m add command -label $i -command [list puts "You invoked \"$i\""]
136
+ }
137
+ set emojiLabel [encoding convertfrom utf-8 "\xF0\x9F\x98\x8D Make friends"]
138
+ $m add command -label $emojiLabel -command [list puts "Menu labels can include non-BMP characters."]
139
+ $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \
140
+ -command [list \
141
+ tk_dialog $w.compound {Compound Menu Entry} \
142
+ "The menu entry you invoked displays both a bitmap and a\
143
+ text string. Other than this, it is just like any other\
144
+ menu entry." {} 0 OK ]
145
+
146
+ set m $w.menu.colors
147
+ $w.menu add cascade -label "Colors" -menu $m -underline 1
148
+ menu $m -tearoff 1
149
+ if {[tk windowingsystem] eq "aqua"} {
150
+ # Aqua ignores the -background and -foreground options, but a compound
151
+ # button can be used for selecting colors.
152
+ foreach i {red orange yellow green blue} {
153
+ image create photo image_$i -height 16 -width 16
154
+ image_$i put black -to 0 0 16 1
155
+ image_$i put black -to 0 1 1 16
156
+ image_$i put black -to 0 15 16 16
157
+ image_$i put black -to 15 1 16 16
158
+ image_$i put $i -to 1 1 15 15
159
+ $m add command -label $i -image image_$i -compound left -command [list \
160
+ puts "You invoked \"$i\"" ]
161
+ }
162
+ } else {
163
+ foreach i {red orange yellow green blue} {
164
+ $m add command -label $i -background $i -command [list \
165
+ puts "You invoked \"$i\"" ]
166
+ }
167
+ }
168
+
169
+ $w configure -menu $w.menu
170
+
171
+ bind Menu <<MenuSelect>> {
172
+ global $menustatus
173
+ if {[catch {%W entrycget active -label} label]} {
174
+ set label " "
175
+ }
176
+ set menustatus $label
177
+ update idletasks
178
+ }
179
+
180
+ if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}}
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/msgbox.tcl ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # msgbox.tcl --
2
+ #
3
+ # This demonstration script creates message boxes of various type
4
+
5
+ if {![info exists widgetDemo]} {
6
+ error "This script should be run from the \"widget\" demo."
7
+ }
8
+
9
+ package require Tk
10
+
11
+ set w .msgbox
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Message Box Demonstration"
15
+ wm iconname $w "messagebox"
16
+ positionWindow $w
17
+
18
+ label $w.msg -font $font -wraplength 4i -justify left -text "Choose the icon and type option of the message box. Then press the \"Message Box\" button to see the message box."
19
+ pack $w.msg -side top
20
+
21
+ pack [addSeeDismiss $w.buttons $w {} {
22
+ ttk::button $w.buttons.vars -text "Message Box" -command "showMessageBox $w"
23
+ }] -side bottom -fill x
24
+ #pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1
25
+
26
+ frame $w.left
27
+ frame $w.right
28
+ pack $w.left $w.right -side left -expand yes -fill y -pady .5c -padx .5c
29
+
30
+ label $w.left.label -text "Icon"
31
+ frame $w.left.sep -relief ridge -bd 1 -height 2
32
+ pack $w.left.label -side top
33
+ pack $w.left.sep -side top -fill x -expand no
34
+
35
+ set msgboxIcon info
36
+ foreach i {error info question warning} {
37
+ radiobutton $w.left.b$i -text $i -variable msgboxIcon \
38
+ -relief flat -value $i -width 16 -anchor w
39
+ pack $w.left.b$i -side top -pady 2 -anchor w -fill x
40
+ }
41
+
42
+ label $w.right.label -text "Type"
43
+ frame $w.right.sep -relief ridge -bd 1 -height 2
44
+ pack $w.right.label -side top
45
+ pack $w.right.sep -side top -fill x -expand no
46
+
47
+ set msgboxType ok
48
+ foreach t {abortretryignore ok okcancel retrycancel yesno yesnocancel} {
49
+ radiobutton $w.right.$t -text $t -variable msgboxType \
50
+ -relief flat -value $t -width 16 -anchor w
51
+ pack $w.right.$t -side top -pady 2 -anchor w -fill x
52
+ }
53
+
54
+ proc showMessageBox {w} {
55
+ global msgboxIcon msgboxType
56
+ set button [tk_messageBox -icon $msgboxIcon -type $msgboxType \
57
+ -title Message -parent $w\
58
+ -message "This is a \"$msgboxType\" type messagebox with the \"$msgboxIcon\" icon"]
59
+
60
+ tk_messageBox -icon info -message "You have selected \"$button\"" -type ok\
61
+ -parent $w
62
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/paned2.tcl ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # paned2.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # a paned window that separates two windows vertically.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .paned2
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Vertical Paned Window Demonstration"
16
+ wm iconname $w "paned2"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "The sash between the two scrolled windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)"
20
+ pack $w.msg -side top
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w]
24
+ pack $btns -side bottom -fill x
25
+
26
+ # Create the pane itself
27
+ panedwindow $w.pane -orient vertical
28
+ pack $w.pane -side top -expand yes -fill both -pady 2 -padx 2m
29
+
30
+ # The top window is a listbox with scrollbar
31
+ set paneList {
32
+ {List of Tk Widgets}
33
+ button
34
+ canvas
35
+ checkbutton
36
+ entry
37
+ frame
38
+ label
39
+ labelframe
40
+ listbox
41
+ menu
42
+ menubutton
43
+ message
44
+ panedwindow
45
+ radiobutton
46
+ scale
47
+ scrollbar
48
+ spinbox
49
+ text
50
+ toplevel
51
+ }
52
+ set f [frame $w.pane.top]
53
+ listbox $f.list -listvariable paneList -yscrollcommand "$f.scr set"
54
+ # Invert the first item to highlight it
55
+ $f.list itemconfigure 0 \
56
+ -background [$f.list cget -fg] -foreground [$f.list cget -bg]
57
+ ttk::scrollbar $f.scr -orient vertical -command "$f.list yview"
58
+ pack $f.scr -side right -fill y
59
+ pack $f.list -fill both -expand 1
60
+
61
+ # The bottom window is a text widget with scrollbar
62
+ set f [frame $w.pane.bottom]
63
+ text $f.text -xscrollcommand "$f.xscr set" -yscrollcommand "$f.yscr set" \
64
+ -width 30 -height 8 -wrap none
65
+ ttk::scrollbar $f.xscr -orient horizontal -command "$f.text xview"
66
+ ttk::scrollbar $f.yscr -orient vertical -command "$f.text yview"
67
+ grid $f.text $f.yscr -sticky nsew
68
+ grid $f.xscr -sticky nsew
69
+ grid columnconfigure $f 0 -weight 1
70
+ grid rowconfigure $f 0 -weight 1
71
+ $f.text insert 1.0 "This is just a normal text widget"
72
+
73
+ # Now add our contents to the paned window
74
+ $w.pane add $w.pane.top $w.pane.bottom
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/pendulum.tcl ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pendulum.tcl --
2
+ #
3
+ # This demonstration illustrates how Tcl/Tk can be used to construct
4
+ # simulations of physical systems.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .pendulum
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Pendulum Animation Demonstration"
16
+ wm iconname $w "pendulum"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration shows how Tcl/Tk can be used to carry out animations that are linked to simulations of physical systems. In the left canvas is a graphical representation of the physical system itself, a simple pendulum, and in the right canvas is a graph of the phase space of the system, which is a plot of the angle (relative to the vertical) against the angular velocity. The pendulum bob may be repositioned by clicking and dragging anywhere on the left canvas."
20
+ pack $w.msg
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w]
24
+ pack $btns -side bottom -fill x
25
+
26
+ # Create some structural widgets
27
+ pack [panedwindow $w.p] -fill both -expand 1
28
+ $w.p add [labelframe $w.p.l1 -text "Pendulum Simulation"]
29
+ $w.p add [labelframe $w.p.l2 -text "Phase Space"]
30
+
31
+ # Create the canvas containing the graphical representation of the
32
+ # simulated system.
33
+ canvas $w.c -width 320 -height 200 -background white -bd 2 -relief sunken
34
+ $w.c create text 5 5 -anchor nw -text "Click to Adjust Bob Start Position"
35
+ # Coordinates of these items don't matter; they will be set properly below
36
+ $w.c create line 0 25 320 25 -tags plate -fill grey50 -width 2
37
+ $w.c create oval 155 20 165 30 -tags pivot -fill grey50 -outline {}
38
+ $w.c create line 1 1 1 1 -tags rod -fill black -width 3
39
+ $w.c create oval 1 1 2 2 -tags bob -fill yellow -outline black
40
+ pack $w.c -in $w.p.l1 -fill both -expand true
41
+
42
+ # Create the canvas containing the phase space graph; this consists of
43
+ # a line that gets gradually paler as it ages, which is an extremely
44
+ # effective visual trick.
45
+ canvas $w.k -width 320 -height 200 -background white -bd 2 -relief sunken
46
+ $w.k create line 160 200 160 0 -fill grey75 -arrow last -tags y_axis
47
+ $w.k create line 0 100 320 100 -fill grey75 -arrow last -tags x_axis
48
+ for {set i 90} {$i>=0} {incr i -10} {
49
+ # Coordinates of these items don't matter; they will be set properly below
50
+ $w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i
51
+ }
52
+
53
+ $w.k create text 0 0 -anchor ne -text "\u03b8" -tags label_theta
54
+ $w.k create text 0 0 -anchor ne -text "\u03b4\u03b8" -tags label_dtheta
55
+ pack $w.k -in $w.p.l2 -fill both -expand true
56
+
57
+ # Initialize some variables
58
+ set points {}
59
+ set Theta 45.0
60
+ set dTheta 0.0
61
+ set pi 3.1415926535897933
62
+ set length 150
63
+ set home 160
64
+
65
+ # This procedure makes the pendulum appear at the correct place on the
66
+ # canvas. If the additional arguments "at $x $y" are passed (the 'at'
67
+ # is really just syntactic sugar) instead of computing the position of
68
+ # the pendulum from the length of the pendulum rod and its angle, the
69
+ # length and angle are computed in reverse from the given location
70
+ # (which is taken to be the centre of the pendulum bob.)
71
+ proc showPendulum {canvas {at {}} {x {}} {y {}}} {
72
+ global Theta dTheta pi length home
73
+ if {$at eq "at" && ($x!=$home || $y!=25)} {
74
+ set dTheta 0.0
75
+ set x2 [expr {$x - $home}]
76
+ set y2 [expr {$y - 25}]
77
+ set length [expr {hypot($x2, $y2)}]
78
+ set Theta [expr {atan2($x2, $y2) * 180/$pi}]
79
+ } else {
80
+ set angle [expr {$Theta * $pi/180}]
81
+ set x [expr {$home + $length*sin($angle)}]
82
+ set y [expr {25 + $length*cos($angle)}]
83
+ }
84
+ $canvas coords rod $home 25 $x $y
85
+ $canvas coords bob \
86
+ [expr {$x-15}] [expr {$y-15}] [expr {$x+15}] [expr {$y+15}]
87
+ }
88
+ showPendulum $w.c
89
+
90
+ # Update the phase-space graph according to the current angle and the
91
+ # rate at which the angle is changing (the first derivative with
92
+ # respect to time.)
93
+ proc showPhase {canvas} {
94
+ global Theta dTheta points psw psh
95
+ lappend points [expr {$Theta+$psw}] [expr {-20*$dTheta+$psh}]
96
+ if {[llength $points] > 100} {
97
+ set points [lrange $points end-99 end]
98
+ }
99
+ for {set i 0} {$i<100} {incr i 10} {
100
+ set list [lrange $points end-[expr {$i-1}] end-[expr {$i-12}]]
101
+ if {[llength $list] >= 4} {
102
+ $canvas coords graph$i $list
103
+ }
104
+ }
105
+ }
106
+
107
+ # Set up some bindings on the canvases. Note that when the user
108
+ # clicks we stop the animation until they release the mouse
109
+ # button. Also note that both canvases are sensitive to <Configure>
110
+ # events, which allows them to find out when they have been resized by
111
+ # the user.
112
+ bind $w.c <Destroy> {
113
+ after cancel $animationCallbacks(pendulum)
114
+ unset animationCallbacks(pendulum)
115
+ }
116
+ bind $w.c <Button-1> {
117
+ after cancel $animationCallbacks(pendulum)
118
+ showPendulum %W at %x %y
119
+ }
120
+ bind $w.c <B1-Motion> {
121
+ showPendulum %W at %x %y
122
+ }
123
+ bind $w.c <ButtonRelease-1> {
124
+ showPendulum %W at %x %y
125
+ set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]]
126
+ }
127
+ bind $w.c <Configure> {
128
+ %W coords plate 0 25 %w 25
129
+ set home [expr {%w/2}]
130
+ %W coords pivot [expr {$home-5}] 20 [expr {$home+5}] 30
131
+ }
132
+ bind $w.k <Configure> {
133
+ set psh [expr {%h/2}]
134
+ set psw [expr {%w/2}]
135
+ %W coords x_axis 2 $psh [expr {%w-2}] $psh
136
+ %W coords y_axis $psw [expr {%h-2}] $psw 2
137
+ %W coords label_dtheta [expr {$psw-4}] 6
138
+ %W coords label_theta [expr {%w-6}] [expr {$psh+4}]
139
+ }
140
+
141
+ # This procedure is the "business" part of the simulation that does
142
+ # simple numerical integration of the formula for a simple rotational
143
+ # pendulum.
144
+ proc recomputeAngle {} {
145
+ global Theta dTheta pi length
146
+ set scaling [expr {3000.0/$length/$length}]
147
+
148
+ # To estimate the integration accurately, we really need to
149
+ # compute the end-point of our time-step. But to do *that*, we
150
+ # need to estimate the integration accurately! So we try this
151
+ # technique, which is inaccurate, but better than doing it in a
152
+ # single step. What we really want is bound up in the
153
+ # differential equation:
154
+ # .. - sin theta
155
+ # theta + theta = -----------
156
+ # length
157
+ # But my math skills are not good enough to solve this!
158
+
159
+ # first estimate
160
+ set firstDDTheta [expr {-sin($Theta * $pi/180)*$scaling}]
161
+ set midDTheta [expr {$dTheta + $firstDDTheta}]
162
+ set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}]
163
+ # second estimate
164
+ set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}]
165
+ set midDTheta [expr {$dTheta + ($firstDDTheta + $midDDTheta)/2}]
166
+ set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}]
167
+ # Now we do a double-estimate approach for getting the final value
168
+ # first estimate
169
+ set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}]
170
+ set lastDTheta [expr {$midDTheta + $midDDTheta}]
171
+ set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}]
172
+ # second estimate
173
+ set lastDDTheta [expr {-sin($lastTheta * $pi/180)*$scaling}]
174
+ set lastDTheta [expr {$midDTheta + ($midDDTheta + $lastDDTheta)/2}]
175
+ set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}]
176
+ # Now put the values back in our globals
177
+ set dTheta $lastDTheta
178
+ set Theta $lastTheta
179
+ }
180
+
181
+ # This method ties together the simulation engine and the graphical
182
+ # display code that visualizes it.
183
+ proc repeat w {
184
+ global animationCallbacks
185
+
186
+ # Simulate
187
+ recomputeAngle
188
+
189
+ # Update the display
190
+ showPendulum $w.c
191
+ showPhase $w.k
192
+
193
+ # Reschedule ourselves
194
+ set animationCallbacks(pendulum) [after 15 [list repeat $w]]
195
+ }
196
+ # Start the simulation after a short pause
197
+ set animationCallbacks(pendulum) [after 500 [list repeat $w]]
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/plot.tcl ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # plot.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget showing a 2-D
4
+ # plot with data points that can be dragged with the mouse.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .plot
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Plot Demonstration"
16
+ wm iconname $w "Plot"
17
+ positionWindow $w
18
+ set c $w.c
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "This window displays a canvas widget containing a simple 2-dimensional plot. You can doctor the data by dragging any of the points with mouse button 1."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ canvas $c -relief raised -width 450 -height 300
28
+ pack $w.c -side top -fill x
29
+
30
+ set plotFont {Helvetica 18}
31
+
32
+ $c create line 100 250 400 250 -width 2
33
+ $c create line 100 250 100 50 -width 2
34
+ $c create text 225 20 -text "A Simple Plot" -font $plotFont -fill brown
35
+
36
+ for {set i 0} {$i <= 10} {incr i} {
37
+ set x [expr {100 + ($i*30)}]
38
+ $c create line $x 250 $x 245 -width 2
39
+ $c create text $x 254 -text [expr {10*$i}] -anchor n -font $plotFont
40
+ }
41
+ for {set i 0} {$i <= 5} {incr i} {
42
+ set y [expr {250 - ($i*40)}]
43
+ $c create line 100 $y 105 $y -width 2
44
+ $c create text 96 $y -text [expr {$i*50}].0 -anchor e -font $plotFont
45
+ }
46
+
47
+ foreach point {
48
+ {12 56} {20 94} {33 98} {32 120} {61 180} {75 160} {98 223}
49
+ } {
50
+ set x [expr {100 + (3*[lindex $point 0])}]
51
+ set y [expr {250 - (4*[lindex $point 1])/5}]
52
+ set item [$c create oval [expr {$x-6}] [expr {$y-6}] \
53
+ [expr {$x+6}] [expr {$y+6}] -width 1 -outline black \
54
+ -fill SkyBlue2]
55
+ $c addtag point withtag $item
56
+ }
57
+
58
+ $c bind point <Enter> "$c itemconfig current -fill red"
59
+ $c bind point <Leave> "$c itemconfig current -fill SkyBlue2"
60
+ $c bind point <Button-1> "plotDown $c %x %y"
61
+ $c bind point <ButtonRelease-1> "$c dtag selected"
62
+ bind $c <B1-Motion> "plotMove $c %x %y"
63
+
64
+ set plot(lastX) 0
65
+ set plot(lastY) 0
66
+
67
+ # plotDown --
68
+ # This procedure is invoked when the mouse is pressed over one of the
69
+ # data points. It sets up state to allow the point to be dragged.
70
+ #
71
+ # Arguments:
72
+ # w - The canvas window.
73
+ # x, y - The coordinates of the mouse press.
74
+
75
+ proc plotDown {w x y} {
76
+ global plot
77
+ $w dtag selected
78
+ $w addtag selected withtag current
79
+ $w raise current
80
+ set plot(lastX) $x
81
+ set plot(lastY) $y
82
+ }
83
+
84
+ # plotMove --
85
+ # This procedure is invoked during mouse motion events. It drags the
86
+ # current item.
87
+ #
88
+ # Arguments:
89
+ # w - The canvas window.
90
+ # x, y - The coordinates of the mouse.
91
+
92
+ proc plotMove {w x y} {
93
+ global plot
94
+ $w move selected [expr {$x-$plot(lastX)}] [expr {$y-$plot(lastY)}]
95
+ set plot(lastX) $x
96
+ set plot(lastY) $y
97
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/puzzle.tcl ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # puzzle.tcl --
2
+ #
3
+ # This demonstration script creates a 15-puzzle game using a collection
4
+ # of buttons.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # puzzleSwitch --
13
+ # This procedure is invoked when the user clicks on a particular button;
14
+ # if the button is next to the empty space, it moves the button into th
15
+ # empty space.
16
+
17
+ proc puzzleSwitch {w num} {
18
+ global xpos ypos
19
+ if {(($ypos($num) >= ($ypos(space) - .01))
20
+ && ($ypos($num) <= ($ypos(space) + .01))
21
+ && ($xpos($num) >= ($xpos(space) - .26))
22
+ && ($xpos($num) <= ($xpos(space) + .26)))
23
+ || (($xpos($num) >= ($xpos(space) - .01))
24
+ && ($xpos($num) <= ($xpos(space) + .01))
25
+ && ($ypos($num) >= ($ypos(space) - .26))
26
+ && ($ypos($num) <= ($ypos(space) + .26)))} {
27
+ set tmp $xpos(space)
28
+ set xpos(space) $xpos($num)
29
+ set xpos($num) $tmp
30
+ set tmp $ypos(space)
31
+ set ypos(space) $ypos($num)
32
+ set ypos($num) $tmp
33
+ place $w.frame.$num -relx $xpos($num) -rely $ypos($num)
34
+ }
35
+ }
36
+
37
+ set w .puzzle
38
+ catch {destroy $w}
39
+ toplevel $w
40
+ wm title $w "15-Puzzle Demonstration"
41
+ wm iconname $w "15-Puzzle"
42
+ positionWindow $w
43
+
44
+ label $w.msg -font $font -wraplength 4i -justify left -text "A 15-puzzle appears below as a collection of buttons. Click on any of the pieces next to the space, and that piece will slide over the space. Continue this until the pieces are arranged in numerical order from upper-left to lower-right."
45
+ pack $w.msg -side top
46
+
47
+ ## See Code / Dismiss buttons
48
+ set btns [addSeeDismiss $w.buttons $w]
49
+ pack $btns -side bottom -fill x
50
+
51
+ # Special trick: select a darker color for the space by creating a
52
+ # scrollbar widget and using its trough color.
53
+
54
+ scrollbar $w.s
55
+
56
+ # The button metrics are a bit bigger in Aqua, and since we are
57
+ # using place which doesn't autosize, then we need to have a
58
+ # slightly larger frame here...
59
+
60
+ if {[tk windowingsystem] eq "aqua"} {
61
+ set frameSize 168
62
+ } else {
63
+ set frameSize 120
64
+ }
65
+
66
+ frame $w.frame -width $frameSize -height $frameSize -borderwidth 2\
67
+ -relief sunken -bg [$w.s cget -troughcolor]
68
+ pack $w.frame -side top -pady 1c -padx 1c
69
+ destroy $w.s
70
+
71
+ set order {3 1 6 2 5 7 15 13 4 11 8 9 14 10 12}
72
+ for {set i 0} {$i < 15} {set i [expr {$i+1}]} {
73
+ set num [lindex $order $i]
74
+ set xpos($num) [expr {($i%4)*.25}]
75
+ set ypos($num) [expr {($i/4)*.25}]
76
+ button $w.frame.$num -relief raised -text $num -bd 0 -highlightthickness 0 \
77
+ -command "puzzleSwitch $w $num"
78
+ place $w.frame.$num -relx $xpos($num) -rely $ypos($num) \
79
+ -relwidth .25 -relheight .25
80
+ }
81
+ set xpos(space) .75
82
+ set ypos(space) .75
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/radio.tcl ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # radio.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # several radiobutton widgets.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ set w .radio
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Radiobutton Demonstration"
16
+ wm iconname $w "radio"
17
+ positionWindow $w
18
+ label $w.msg -font $font -wraplength 5i -justify left -text "Three groups of radiobuttons are displayed below. If you click on a button then the button will become selected exclusively among all the buttons in its group. A Tcl variable is associated with each group to indicate which of the group's buttons is selected. When the 'Tristate' button is pressed, the radio buttons will display the tri-state mode. Selecting any radio button will return the buttons to their respective on/off state. Click the \"See Variables\" button to see the current values of the variables."
19
+ grid $w.msg -row 0 -column 0 -columnspan 3 -sticky nsew
20
+
21
+ ## See Code / Dismiss buttons
22
+ set btns [addSeeDismiss $w.buttons $w [list size color align]]
23
+ grid $btns -row 3 -column 0 -columnspan 3 -sticky ew
24
+
25
+ labelframe $w.left -pady 2 -text "Point Size" -padx 2
26
+ labelframe $w.mid -pady 2 -text "Color" -padx 2
27
+ labelframe $w.right -pady 2 -text "Alignment" -padx 2
28
+ button $w.tristate -text Tristate -command "set size multi; set color multi" \
29
+ -pady 2 -padx 2
30
+ if {[tk windowingsystem] eq "aqua"} {
31
+ $w.tristate configure -padx 10
32
+ }
33
+ grid $w.left -column 0 -row 1 -pady .5c -padx .5c -rowspan 2
34
+ grid $w.mid -column 1 -row 1 -pady .5c -padx .5c -rowspan 2
35
+ grid $w.right -column 2 -row 1 -pady .5c -padx .5c
36
+ grid $w.tristate -column 2 -row 2 -pady .5c -padx .5c
37
+
38
+ foreach i {10 12 14 18 24} {
39
+ radiobutton $w.left.b$i -text "Point Size $i" -variable size \
40
+ -relief flat -value $i -tristatevalue "multi"
41
+ pack $w.left.b$i -side top -pady 2 -anchor w -fill x
42
+ }
43
+
44
+ foreach c {Red Green Blue Yellow Orange Purple} {
45
+ set lower [string tolower $c]
46
+ radiobutton $w.mid.$lower -text $c -variable color \
47
+ -relief flat -value $lower -anchor w \
48
+ -command "$w.mid configure -fg \$color" \
49
+ -tristatevalue "multi"
50
+ pack $w.mid.$lower -side top -pady 2 -fill x
51
+ }
52
+
53
+
54
+ label $w.right.l -text "Label" -bitmap questhead -compound left
55
+ $w.right.l configure -width [winfo reqwidth $w.right.l] -compound top
56
+ $w.right.l configure -height [winfo reqheight $w.right.l]
57
+ foreach a {Top Left Right Bottom} {
58
+ set lower [string tolower $a]
59
+ radiobutton $w.right.$lower -text $a -variable align \
60
+ -relief flat -value $lower -indicatoron 0 -width 7 \
61
+ -command "$w.right.l configure -compound \$align"
62
+ }
63
+
64
+ grid x $w.right.top
65
+ grid $w.right.left $w.right.l $w.right.right
66
+ grid x $w.right.bottom
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/rmt ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # rmt --
6
+ # This script implements a simple remote-control mechanism for
7
+ # Tk applications. It allows you to select an application and
8
+ # then type commands to that application.
9
+
10
+ package require Tk
11
+
12
+ wm title . "Tk Remote Controller"
13
+ wm iconname . "Tk Remote"
14
+ wm minsize . 1 1
15
+
16
+ # The global variable below keeps track of the remote application
17
+ # that we're sending to. If it's an empty string then we execute
18
+ # the commands locally.
19
+
20
+ set app "local"
21
+
22
+ # The global variable below keeps track of whether we're in the
23
+ # middle of executing a command entered via the text.
24
+
25
+ set executing 0
26
+
27
+ # The global variable below keeps track of the last command executed,
28
+ # so it can be re-executed in response to !! commands.
29
+
30
+ set lastCommand ""
31
+
32
+ # Create menu bar. Arrange to recreate all the information in the
33
+ # applications sub-menu whenever it is cascaded to.
34
+
35
+ . configure -menu [menu .menu]
36
+ menu .menu.file
37
+ menu .menu.file.apps -postcommand fillAppsMenu
38
+ .menu add cascade -label "File" -underline 0 -menu .menu.file
39
+ .menu.file add cascade -label "Select Application" -underline 0 \
40
+ -menu .menu.file.apps
41
+ .menu.file add command -label "Quit" -command "destroy ." -underline 0
42
+
43
+ # Create text window and scrollbar.
44
+
45
+ text .t -yscrollcommand ".s set" -setgrid true
46
+ scrollbar .s -command ".t yview"
47
+ grid .t .s -sticky nsew
48
+ grid rowconfigure . 0 -weight 1
49
+ grid columnconfigure . 0 -weight 1
50
+
51
+ # Create a binding to forward commands to the target application,
52
+ # plus modify many of the built-in bindings so that only information
53
+ # in the current command can be deleted (can still set the cursor
54
+ # earlier in the text and select and insert; just can't delete).
55
+
56
+ bindtags .t {.t Text . all}
57
+ bind .t <Return> {
58
+ .t mark set insert {end - 1c}
59
+ .t insert insert \n
60
+ invoke
61
+ break
62
+ }
63
+ bind .t <Delete> {
64
+ catch {.t tag remove sel sel.first promptEnd}
65
+ if {[.t tag nextrange sel 1.0 end] eq ""} {
66
+ if {[.t compare insert < promptEnd]} {
67
+ break
68
+ }
69
+ }
70
+ }
71
+ bind .t <BackSpace> {
72
+ catch {.t tag remove sel sel.first promptEnd}
73
+ if {[.t tag nextrange sel 1.0 end] eq ""} {
74
+ if {[.t compare insert <= promptEnd]} {
75
+ break
76
+ }
77
+ }
78
+ }
79
+ bind .t <Control-d> {
80
+ if {[.t compare insert < promptEnd]} {
81
+ break
82
+ }
83
+ }
84
+ bind .t <Control-k> {
85
+ if {[.t compare insert < promptEnd]} {
86
+ .t mark set insert promptEnd
87
+ }
88
+ }
89
+ bind .t <Control-t> {
90
+ if {[.t compare insert < promptEnd]} {
91
+ break
92
+ }
93
+ }
94
+ bind .t <Meta-d> {
95
+ if {[.t compare insert < promptEnd]} {
96
+ break
97
+ }
98
+ }
99
+ bind .t <Meta-BackSpace> {
100
+ if {[.t compare insert <= promptEnd]} {
101
+ break
102
+ }
103
+ }
104
+ bind .t <Control-h> {
105
+ if {[.t compare insert <= promptEnd]} {
106
+ break
107
+ }
108
+ }
109
+ ### This next bit *isn't* nice - DKF ###
110
+ auto_load tk::TextInsert
111
+ proc tk::TextInsert {w s} {
112
+ if {$s eq ""} {
113
+ return
114
+ }
115
+ catch {
116
+ if {
117
+ [$w compare sel.first <= insert] && [$w compare sel.last >= insert]
118
+ } then {
119
+ $w tag remove sel sel.first promptEnd
120
+ $w delete sel.first sel.last
121
+ }
122
+ }
123
+ $w insert insert $s
124
+ $w see insert
125
+ }
126
+
127
+ .t configure -font {Courier 12}
128
+ .t tag configure bold -font {Courier 12 bold}
129
+
130
+ # The procedure below is used to print out a prompt at the
131
+ # insertion point (which should be at the beginning of a line
132
+ # right now).
133
+
134
+ proc prompt {} {
135
+ global app
136
+ .t insert insert "$app: "
137
+ .t mark set promptEnd {insert}
138
+ .t mark gravity promptEnd left
139
+ .t tag add bold {promptEnd linestart} promptEnd
140
+ }
141
+
142
+ # The procedure below executes a command (it takes everything on the
143
+ # current line after the prompt and either sends it to the remote
144
+ # application or executes it locally, depending on "app".
145
+
146
+ proc invoke {} {
147
+ global app executing lastCommand
148
+ set cmd [.t get promptEnd insert]
149
+ incr executing 1
150
+ if {[info complete $cmd]} {
151
+ if {$cmd eq "!!\n"} {
152
+ set cmd $lastCommand
153
+ } else {
154
+ set lastCommand $cmd
155
+ }
156
+ if {$app eq "local"} {
157
+ set result [catch [list uplevel #0 $cmd] msg]
158
+ } else {
159
+ set result [catch [list send $app $cmd] msg]
160
+ }
161
+ if {$result != 0} {
162
+ .t insert insert "Error: $msg\n"
163
+ } elseif {$msg ne ""} {
164
+ .t insert insert $msg\n
165
+ }
166
+ prompt
167
+ .t mark set promptEnd insert
168
+ }
169
+ incr executing -1
170
+ .t yview -pickplace insert
171
+ }
172
+
173
+ # The following procedure is invoked to change the application that
174
+ # we're talking to. It also updates the prompt for the current
175
+ # command, unless we're in the middle of executing a command from
176
+ # the text item (in which case a new prompt is about to be output
177
+ # so there's no need to change the old one).
178
+
179
+ proc newApp appName {
180
+ global app executing
181
+ set app $appName
182
+ if {!$executing} {
183
+ .t mark gravity promptEnd right
184
+ .t delete "promptEnd linestart" promptEnd
185
+ .t insert promptEnd "$appName: "
186
+ .t tag add bold "promptEnd linestart" promptEnd
187
+ .t mark gravity promptEnd left
188
+ }
189
+ return
190
+ }
191
+
192
+ # The procedure below will fill in the applications sub-menu with a list
193
+ # of all the applications that currently exist.
194
+
195
+ proc fillAppsMenu {} {
196
+ set m .menu.file.apps
197
+ catch {$m delete 0 last}
198
+ foreach i [lsort [winfo interps]] {
199
+ $m add command -label $i -command [list newApp $i]
200
+ }
201
+ $m add command -label local -command {newApp local}
202
+ }
203
+
204
+ set app [winfo name .]
205
+ prompt
206
+ focus .t
207
+
208
+ # Local Variables:
209
+ # mode: tcl
210
+ # End:
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/rolodex ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # rolodex --
6
+ # This script was written as an entry in Tom LaStrange's rolodex
7
+ # benchmark. It creates something that has some of the look and
8
+ # feel of a rolodex program, although it's lifeless and doesn't
9
+ # actually do the rolodex application.
10
+
11
+ package require Tk
12
+
13
+ foreach i [winfo child .] {
14
+ catch {destroy $i}
15
+ }
16
+
17
+ set version 1.2
18
+
19
+ #------------------------------------------
20
+ # Phase 0: create the front end.
21
+ #------------------------------------------
22
+
23
+ frame .frame -relief flat
24
+ pack .frame -side top -fill y -anchor center
25
+
26
+ set names {{} Name: Address: {} {} {Home Phone:} {Work Phone:} Fax:}
27
+ foreach i {1 2 3 4 5 6 7} {
28
+ label .frame.label$i -text [lindex $names $i] -anchor e
29
+ entry .frame.entry$i -width 35
30
+ grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1
31
+ }
32
+
33
+ frame .buttons
34
+ pack .buttons -side bottom -pady 2 -anchor center
35
+ button .buttons.clear -text Clear
36
+ button .buttons.add -text Add
37
+ button .buttons.search -text Search
38
+ button .buttons.delete -text "Delete ..."
39
+ pack .buttons.clear .buttons.add .buttons.search .buttons.delete \
40
+ -side left -padx 2
41
+
42
+ #------------------------------------------
43
+ # Phase 1: Add menus, dialog boxes
44
+ #------------------------------------------
45
+
46
+ # DKF - note that this is an old-style menu bar; I just have not yet
47
+ # got around to converting the context help code to work with the new
48
+ # menu system and its <<MenuSelect>> virtual event.
49
+
50
+ frame .menu -relief raised -borderwidth 1
51
+ pack .menu -before .frame -side top -fill x
52
+
53
+ menubutton .menu.file -text "File" -menu .menu.file.m -underline 0
54
+ menu .menu.file.m
55
+ .menu.file.m add command -label "Load ..." -command fileAction -underline 0
56
+ .menu.file.m add command -label "Exit" -command {destroy .} -underline 0
57
+ pack .menu.file -side left
58
+
59
+ menubutton .menu.help -text "Help" -menu .menu.help.m -underline 0
60
+ menu .menu.help.m
61
+ pack .menu.help -side right
62
+
63
+ proc deleteAction {} {
64
+ if {[tk_dialog .delete {Confirm Action} {Are you sure?} {} 0 Cancel]
65
+ == 0} {
66
+ clearAction
67
+ }
68
+ }
69
+ .buttons.delete config -command deleteAction
70
+
71
+ proc fileAction {} {
72
+ tk_dialog .fileSelection {File Selection} {This is a dummy file selection dialog box, which is used because there isn't a good file selection dialog built into Tk yet.} {} 0 OK
73
+ puts stderr {dummy file name}
74
+ }
75
+
76
+ #------------------------------------------
77
+ # Phase 3: Print contents of card
78
+ #------------------------------------------
79
+
80
+ proc addAction {} {
81
+ global names
82
+ foreach i {1 2 3 4 5 6 7} {
83
+ puts stderr [format "%-12s %s" [lindex $names $i] [.frame.entry$i get]]
84
+ }
85
+ }
86
+ .buttons.add config -command addAction
87
+
88
+ #------------------------------------------
89
+ # Phase 4: Miscellaneous other actions
90
+ #------------------------------------------
91
+
92
+ proc clearAction {} {
93
+ foreach i {1 2 3 4 5 6 7} {
94
+ .frame.entry$i delete 0 end
95
+ }
96
+ }
97
+ .buttons.clear config -command clearAction
98
+
99
+ proc fillCard {} {
100
+ clearAction
101
+ .frame.entry1 insert 0 "John Ousterhout"
102
+ .frame.entry2 insert 0 "CS Division, Department of EECS"
103
+ .frame.entry3 insert 0 "University of California"
104
+ .frame.entry4 insert 0 "Berkeley, CA 94720"
105
+ .frame.entry5 insert 0 "private"
106
+ .frame.entry6 insert 0 "510-642-0865"
107
+ .frame.entry7 insert 0 "510-642-5775"
108
+ }
109
+ .buttons.search config -command "addAction; fillCard"
110
+
111
+ #----------------------------------------------------
112
+ # Phase 5: Accelerators, mnemonics, command-line info
113
+ #----------------------------------------------------
114
+
115
+ .buttons.clear config -text "Clear Ctrl+C"
116
+ bind . <Control-c> clearAction
117
+ .buttons.add config -text "Add Ctrl+A"
118
+ bind . <Control-a> addAction
119
+ .buttons.search config -text "Search Ctrl+S"
120
+ bind . <Control-s> "addAction; fillCard"
121
+ .buttons.delete config -text "Delete... Ctrl+D"
122
+ bind . <Control-d> deleteAction
123
+
124
+ .menu.file.m entryconfig 1 -accel Ctrl+F
125
+ bind . <Control-f> fileAction
126
+ .menu.file.m entryconfig 2 -accel Ctrl+Q
127
+ bind . <Control-q> {destroy .}
128
+
129
+ focus .frame.entry1
130
+
131
+ #----------------------------------------------------
132
+ # Phase 6: help
133
+ #----------------------------------------------------
134
+
135
+ proc Help {topic {x 0} {y 0}} {
136
+ global helpTopics helpCmds
137
+ if {$topic == ""} return
138
+ while {[info exists helpCmds($topic)]} {
139
+ set topic [eval $helpCmds($topic)]
140
+ }
141
+ if [info exists helpTopics($topic)] {
142
+ set msg $helpTopics($topic)
143
+ } else {
144
+ set msg "Sorry, but no help is available for this topic"
145
+ }
146
+ tk_dialog .help {Rolodex Help} "Information on $topic:\n\n$msg" \
147
+ {} 0 OK
148
+ }
149
+
150
+ proc getMenuTopic {w x y} {
151
+ return $w.[$w index @[expr {$y-[winfo rooty $w]}]]
152
+ }
153
+
154
+ event add <<Help>> <F1> <Help>
155
+ bind . <<Help>> {Help [winfo containing %X %Y] %X %Y}
156
+ bind Menu <<Help>> {Help [winfo containing %X %Y] %X %Y}
157
+
158
+ # Help text and commands follow:
159
+
160
+ set helpTopics(.menu.file) {This is the "file" menu. It can be used to invoke some overall operations on the rolodex applications, such as loading a file or exiting.}
161
+
162
+ set helpCmds(.menu.file.m) {getMenuTopic $topic $x $y}
163
+ set helpTopics(.menu.file.m.1) {The "Load" entry in the "File" menu posts a dialog box that you can use to select a rolodex file}
164
+ set helpTopics(.menu.file.m.2) {The "Exit" entry in the "File" menu causes the rolodex application to terminate}
165
+ set helpCmds(.menu.file.m.none) {set topic ".menu.file"}
166
+
167
+ set helpTopics(.frame.entry1) {In this field of the rolodex entry you should type the person's name}
168
+ set helpTopics(.frame.entry2) {In this field of the rolodex entry you should type the first line of the person's address}
169
+ set helpTopics(.frame.entry3) {In this field of the rolodex entry you should type the second line of the person's address}
170
+ set helpTopics(.frame.entry4) {In this field of the rolodex entry you should type the third line of the person's address}
171
+ set helpTopics(.frame.entry5) {In this field of the rolodex entry you should type the person's home phone number, or "private" if the person doesn't want his or her number publicized}
172
+ set helpTopics(.frame.entry6) {In this field of the rolodex entry you should type the person's work phone number}
173
+ set helpTopics(.frame.entry7) {In this field of the rolodex entry you should type the phone number for the person's FAX machine}
174
+
175
+ set helpCmds(.frame.label1) {set topic .frame.entry1}
176
+ set helpCmds(.frame.label2) {set topic .frame.entry2}
177
+ set helpCmds(.frame.label3) {set topic .frame.entry3}
178
+ set helpCmds(.frame.label4) {set topic .frame.entry4}
179
+ set helpCmds(.frame.label5) {set topic .frame.entry5}
180
+ set helpCmds(.frame.label6) {set topic .frame.entry6}
181
+ set helpCmds(.frame.label7) {set topic .frame.entry7}
182
+
183
+ set helpTopics(context) {Unfortunately, this application doesn't support context-sensitive help in the usual way, because when this demo was written Tk didn't have a grab mechanism and this is needed for context-sensitive help. Instead, you can achieve much the same effect by simply moving the mouse over the window you're curious about and pressing the Help or F1 keys. You can do this anytime.}
184
+ set helpTopics(help) {This application provides only very crude help. Besides the entries in this menu, you can get help on individual windows by moving the mouse cursor over the window and pressing the Help or F1 keys.}
185
+ set helpTopics(window) {This window is a dummy rolodex application created as part of Tom LaStrange's toolkit benchmark. It doesn't really do anything useful except to demonstrate a few features of the Tk toolkit.}
186
+ set helpTopics(keys) "The following accelerator keys are defined for this application (in addition to those already available for the entry windows):\n\nCtrl+A:\t\tAdd\nCtrl+C:\t\tClear\nCtrl+D:\t\tDelete\nCtrl+F:\t\tEnter file name\nCtrl+Q:\t\tExit application (quit)\nCtrl+S:\t\tSearch (dummy operation)"
187
+ set helpTopics(version) "This is version $version."
188
+
189
+ # Entries in "Help" menu
190
+
191
+ .menu.help.m add command -label "On Context..." -command {Help context} \
192
+ -underline 3
193
+ .menu.help.m add command -label "On Help..." -command {Help help} \
194
+ -underline 3
195
+ .menu.help.m add command -label "On Window..." -command {Help window} \
196
+ -underline 3
197
+ .menu.help.m add command -label "On Keys..." -command {Help keys} \
198
+ -underline 3
199
+ .menu.help.m add command -label "On Version..." -command {Help version} \
200
+ -underline 3
201
+
202
+ # Local Variables:
203
+ # mode: tcl
204
+ # End:
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/ruler.tcl ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ruler.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget that displays a ruler
4
+ # with tab stops that can be set, moved, and deleted.
5
+
6
+ if {![info exists widgetDemo]} {
7
+ error "This script should be run from the \"widget\" demo."
8
+ }
9
+
10
+ package require Tk
11
+
12
+ # rulerMkTab --
13
+ # This procedure creates a new triangular polygon in a canvas to
14
+ # represent a tab stop.
15
+ #
16
+ # Arguments:
17
+ # c - The canvas window.
18
+ # x, y - Coordinates at which to create the tab stop.
19
+
20
+ proc rulerMkTab {c x y} {
21
+ upvar #0 demo_rulerInfo v
22
+ set newTab [$c create polygon $x $y \
23
+ [expr {$x+$v(size)}] [expr {$y+$v(size)}] \
24
+ [expr {$x-$v(size)}] [expr {$y+$v(size)}]]
25
+ set fill [$c itemcget $newTab -outline]
26
+ $c itemconfigure $newTab -fill $fill -outline {}
27
+ set v(normalStyle) "-fill $fill"
28
+ return $newTab
29
+ }
30
+
31
+ set w .ruler
32
+ catch {destroy $w}
33
+ toplevel $w
34
+ wm title $w "Ruler Demonstration"
35
+ wm iconname $w "ruler"
36
+ positionWindow $w
37
+ set c $w.c
38
+
39
+ label $w.msg -font $font -wraplength 5i -justify left -text "This canvas widget shows a mock-up of a ruler. You can create tab stops by dragging them out of the well to the right of the ruler. You can also drag existing tab stops. If you drag a tab stop far enough up or down so that it turns dim, it will be deleted when you release the mouse button."
40
+ pack $w.msg -side top
41
+
42
+ ## See Code / Dismiss buttons
43
+ set btns [addSeeDismiss $w.buttons $w]
44
+ pack $btns -side bottom -fill x
45
+
46
+ canvas $c -width 14.8c -height 2.5c
47
+ pack $w.c -side top -fill x
48
+
49
+ set demo_rulerInfo(grid) .25c
50
+ set demo_rulerInfo(left) [winfo fpixels $c 1c]
51
+ set demo_rulerInfo(right) [winfo fpixels $c 13c]
52
+ set demo_rulerInfo(top) [winfo fpixels $c 1c]
53
+ set demo_rulerInfo(bottom) [winfo fpixels $c 1.5c]
54
+ set demo_rulerInfo(size) [winfo fpixels $c .2c]
55
+ # Main widget program sets variable tk_demoDirectory
56
+ if {[winfo depth $c] > 1} {
57
+ set demo_rulerInfo(activeStyle) "-fill red -stipple {}"
58
+ set demo_rulerInfo(deleteStyle) [list -fill red \
59
+ -stipple @[file join $tk_demoDirectory images gray25.xbm]]
60
+ } else {
61
+ set demo_rulerInfo(activeStyle) "-fill black -stipple {}"
62
+ set demo_rulerInfo(deleteStyle) [list -fill black \
63
+ -stipple @[file join $tk_demoDirectory images gray25.xbm]]
64
+ }
65
+
66
+ $c create line 1c 0.5c 1c 1c 13c 1c 13c 0.5c -width 1
67
+ for {set i 0} {$i < 12} {incr i} {
68
+ set x [expr {$i+1}]
69
+ $c create line ${x}c 1c ${x}c 0.6c -width 1
70
+ $c create line $x.25c 1c $x.25c 0.8c -width 1
71
+ $c create line $x.5c 1c $x.5c 0.7c -width 1
72
+ $c create line $x.75c 1c $x.75c 0.8c -width 1
73
+ $c create text $x.15c .75c -text $i -anchor sw
74
+ }
75
+ $c addtag well withtag [$c create rect 13.2c 1c 13.8c 0.5c \
76
+ -fill [lindex [$c config -bg] 4]]
77
+ $c addtag well withtag [rulerMkTab $c [winfo pixels $c 13.5c] \
78
+ [winfo pixels $c .65c]]
79
+
80
+ $c bind well <Button-1> "rulerNewTab $c %x %y"
81
+ $c bind tab <Button-1> "rulerSelectTab $c %x %y"
82
+ bind $c <B1-Motion> "rulerMoveTab $c %x %y"
83
+ bind $c <ButtonRelease-1> "rulerReleaseTab $c"
84
+
85
+ # rulerNewTab --
86
+ # Does all the work of creating a tab stop, including creating the
87
+ # triangle object and adding tags to it to give it tab behavior.
88
+ #
89
+ # Arguments:
90
+ # c - The canvas window.
91
+ # x, y - The coordinates of the tab stop.
92
+
93
+ proc rulerNewTab {c x y} {
94
+ upvar #0 demo_rulerInfo v
95
+ $c addtag active withtag [rulerMkTab $c $x $y]
96
+ $c addtag tab withtag active
97
+ set v(x) $x
98
+ set v(y) $y
99
+ rulerMoveTab $c $x $y
100
+ }
101
+
102
+ # rulerSelectTab --
103
+ # This procedure is invoked when mouse button 1 is pressed over
104
+ # a tab. It remembers information about the tab so that it can
105
+ # be dragged interactively.
106
+ #
107
+ # Arguments:
108
+ # c - The canvas widget.
109
+ # x, y - The coordinates of the mouse (identifies the point by
110
+ # which the tab was picked up for dragging).
111
+
112
+ proc rulerSelectTab {c x y} {
113
+ upvar #0 demo_rulerInfo v
114
+ set v(x) [$c canvasx $x $v(grid)]
115
+ set v(y) [expr {$v(top)+2}]
116
+ $c addtag active withtag current
117
+ eval "$c itemconf active $v(activeStyle)"
118
+ $c raise active
119
+ }
120
+
121
+ # rulerMoveTab --
122
+ # This procedure is invoked during mouse motion events to drag a tab.
123
+ # It adjusts the position of the tab, and changes its appearance if
124
+ # it is about to be dragged out of the ruler.
125
+ #
126
+ # Arguments:
127
+ # c - The canvas widget.
128
+ # x, y - The coordinates of the mouse.
129
+
130
+ proc rulerMoveTab {c x y} {
131
+ upvar #0 demo_rulerInfo v
132
+ if {[$c find withtag active] == ""} {
133
+ return
134
+ }
135
+ set cx [$c canvasx $x $v(grid)]
136
+ set cy [$c canvasy $y]
137
+ if {$cx < $v(left)} {
138
+ set cx $v(left)
139
+ }
140
+ if {$cx > $v(right)} {
141
+ set cx $v(right)
142
+ }
143
+ if {($cy >= $v(top)) && ($cy <= $v(bottom))} {
144
+ set cy [expr {$v(top)+2}]
145
+ eval "$c itemconf active $v(activeStyle)"
146
+ } else {
147
+ set cy [expr {$cy-$v(size)-2}]
148
+ eval "$c itemconf active $v(deleteStyle)"
149
+ }
150
+ $c move active [expr {$cx-$v(x)}] [expr {$cy-$v(y)}]
151
+ set v(x) $cx
152
+ set v(y) $cy
153
+ }
154
+
155
+ # rulerReleaseTab --
156
+ # This procedure is invoked during button release events that end
157
+ # a tab drag operation. It deselects the tab and deletes the tab if
158
+ # it was dragged out of the ruler.
159
+ #
160
+ # Arguments:
161
+ # c - The canvas widget.
162
+ # x, y - The coordinates of the mouse.
163
+
164
+ proc rulerReleaseTab c {
165
+ upvar #0 demo_rulerInfo v
166
+ if {[$c find withtag active] == {}} {
167
+ return
168
+ }
169
+ if {$v(y) != $v(top)+2} {
170
+ $c delete active
171
+ } else {
172
+ eval "$c itemconf active $v(normalStyle)"
173
+ $c dtag active
174
+ }
175
+ }
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/sayings.tcl ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # sayings.tcl --
2
+ #
3
+ # This demonstration script creates a listbox that can be scrolled
4
+ # both horizontally and vertically. It displays a collection of
5
+ # well-known sayings.
6
+
7
+ if {![info exists widgetDemo]} {
8
+ error "This script should be run from the \"widget\" demo."
9
+ }
10
+
11
+ package require Tk
12
+
13
+ set w .sayings
14
+ catch {destroy $w}
15
+ toplevel $w
16
+ wm title $w "Listbox Demonstration (well-known sayings)"
17
+ wm iconname $w "sayings"
18
+ positionWindow $w
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "The listbox below contains a collection of well-known sayings. You can scan the list using either of the scrollbars or by dragging in the listbox window with button 2 pressed."
21
+ pack $w.msg -side top
22
+
23
+ ## See Code / Dismiss buttons
24
+ set btns [addSeeDismiss $w.buttons $w]
25
+ pack $btns -side bottom -fill x
26
+
27
+ frame $w.frame -borderwidth 10
28
+ pack $w.frame -side top -expand yes -fill both -padx 1c
29
+
30
+
31
+ ttk::scrollbar $w.frame.yscroll -command "$w.frame.list yview"
32
+ ttk::scrollbar $w.frame.xscroll -orient horizontal \
33
+ -command "$w.frame.list xview"
34
+ listbox $w.frame.list -width 20 -height 10 -setgrid 1 \
35
+ -yscroll "$w.frame.yscroll set" -xscroll "$w.frame.xscroll set"
36
+
37
+ grid $w.frame.list -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
38
+ grid $w.frame.yscroll -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
39
+ grid $w.frame.xscroll -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
40
+ grid rowconfig $w.frame 0 -weight 1 -minsize 0
41
+ grid columnconfig $w.frame 0 -weight 1 -minsize 0
42
+
43
+
44
+ $w.frame.list insert 0 "Don't speculate, measure" "Waste not, want not" "Early to bed and early to rise makes a man healthy, wealthy, and wise" "Ask not what your country can do for you, ask what you can do for your country" "I shall return" "NOT" "A picture is worth a thousand words" "User interfaces are hard to build" "Thou shalt not steal" "A penny for your thoughts" "Fool me once, shame on you; fool me twice, shame on me" "Every cloud has a silver lining" "Where there's smoke there's fire" "It takes one to know one" "Curiosity killed the cat" "Take this job and shove it" "Up a creek without a paddle" "I'm mad as hell and I'm not going to take it any more" "An apple a day keeps the doctor away" "Don't look a gift horse in the mouth" "Measure twice, cut once"
my_container_sandbox/workspace/anaconda3/lib/tk8.6/demos/search.tcl ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # search.tcl --
2
+ #
3
+ # This demonstration script creates a collection of widgets that
4
+ # allow you to load a file into a text widget, then perform searches
5
+ # on that file.
6
+
7
+ if {![info exists widgetDemo]} {
8
+ error "This script should be run from the \"widget\" demo."
9
+ }
10
+
11
+ package require Tk
12
+
13
+ # textLoadFile --
14
+ # This procedure below loads a file into a text widget, discarding
15
+ # the previous contents of the widget. Tags for the old widget are
16
+ # not affected, however.
17
+ #
18
+ # Arguments:
19
+ # w - The window into which to load the file. Must be a
20
+ # text widget.
21
+ # file - The name of the file to load. Must be readable.
22
+
23
+ proc textLoadFile {w file} {
24
+ set f [open $file]
25
+ $w delete 1.0 end
26
+ while {![eof $f]} {
27
+ $w insert end [read $f 10000]
28
+ }
29
+ close $f
30
+ }
31
+
32
+ # textSearch --
33
+ # Search for all instances of a given string in a text widget and
34
+ # apply a given tag to each instance found.
35
+ #
36
+ # Arguments:
37
+ # w - The window in which to search. Must be a text widget.
38
+ # string - The string to search for. The search is done using
39
+ # exact matching only; no special characters.
40
+ # tag - Tag to apply to each instance of a matching string.
41
+
42
+ proc textSearch {w string tag} {
43
+ $w tag remove search 0.0 end
44
+ if {$string == ""} {
45
+ return
46
+ }
47
+ set cur 1.0
48
+ while 1 {
49
+ set cur [$w search -count length $string $cur end]
50
+ if {$cur == ""} {
51
+ break
52
+ }
53
+ $w tag add $tag $cur "$cur + $length char"
54
+ set cur [$w index "$cur + $length char"]
55
+ }
56
+ }
57
+
58
+ # textToggle --
59
+ # This procedure is invoked repeatedly to invoke two commands at
60
+ # periodic intervals. It normally reschedules itself after each
61
+ # execution but if an error occurs (e.g. because the window was
62
+ # deleted) then it doesn't reschedule itself.
63
+ #
64
+ # Arguments:
65
+ # cmd1 - Command to execute when procedure is called.
66
+ # sleep1 - Ms to sleep after executing cmd1 before executing cmd2.
67
+ # cmd2 - Command to execute in the *next* invocation of this
68
+ # procedure.
69
+ # sleep2 - Ms to sleep after executing cmd2 before executing cmd1 again.
70
+
71
+ proc textToggle {cmd1 sleep1 cmd2 sleep2} {
72
+ catch {
73
+ eval $cmd1
74
+ after $sleep1 [list textToggle $cmd2 $sleep2 $cmd1 $sleep1]
75
+ }
76
+ }
77
+
78
+ set w .search
79
+ catch {destroy $w}
80
+ toplevel $w
81
+ wm title $w "Text Demonstration - Search and Highlight"
82
+ wm iconname $w "search"
83
+ positionWindow $w
84
+
85
+ ## See Code / Dismiss buttons
86
+ set btns [addSeeDismiss $w.buttons $w]
87
+ pack $btns -side bottom -fill x
88
+
89
+ frame $w.file
90
+ label $w.file.label -text "File name:" -width 13 -anchor w
91
+ entry $w.file.entry -width 40 -textvariable fileName
92
+ button $w.file.button -text "Load File" \
93
+ -command "textLoadFile $w.text \$fileName"
94
+ pack $w.file.label $w.file.entry -side left
95
+ pack $w.file.button -side left -pady 5 -padx 10
96
+ bind $w.file.entry <Return> "
97
+ textLoadFile $w.text \$fileName
98
+ focus $w.string.entry
99
+ "
100
+ focus $w.file.entry
101
+
102
+ frame $w.string
103
+ label $w.string.label -text "Search string:" -width 13 -anchor w
104
+ entry $w.string.entry -width 40 -textvariable searchString
105
+ button $w.string.button -text "Highlight" \
106
+ -command "textSearch $w.text \$searchString search"
107
+ pack $w.string.label $w.string.entry -side left
108
+ pack $w.string.button -side left -pady 5 -padx 10
109
+ bind $w.string.entry <Return> "textSearch $w.text \$searchString search"
110
+
111
+ text $w.text -yscrollcommand "$w.scroll set" -setgrid true
112
+ ttk::scrollbar $w.scroll -command "$w.text yview"
113
+ pack $w.file $w.string -side top -fill x
114
+ pack $w.scroll -side right -fill y
115
+ pack $w.text -expand yes -fill both
116
+
117
+ # Set up display styles for text highlighting.
118
+
119
+ if {[winfo depth $w] > 1} {
120
+ textToggle "$w.text tag configure search -background \
121
+ #ce5555 -foreground white" 800 "$w.text tag configure \
122
+ search -background {} -foreground {}" 200
123
+ } else {
124
+ textToggle "$w.text tag configure search -background \
125
+ black -foreground white" 800 "$w.text tag configure \
126
+ search -background {} -foreground {}" 200
127
+ }
128
+ $w.text insert 1.0 \
129
+ {This window demonstrates how to use the tagging facilities in text
130
+ widgets to implement a searching mechanism. First, type a file name
131
+ in the top entry, then type <Return> or click on "Load File". Then
132
+ type a string in the lower entry and type <Return> or click on
133
+ "Load File". This will cause all of the instances of the string to
134
+ be tagged with the tag "search", and it will arrange for the tag's
135
+ display attributes to change to make all of the strings blink.}
136
+ $w.text mark set insert 0.0
137
+
138
+ set fileName ""
139
+ set searchString ""