@simplexai/localmodels-darwin-arm64 0.1.0-dev.31.build.gitb5579b4b26f273bf03468c6aedf61b327fa6c245 → 0.1.0-dev.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (583) hide show
  1. package/bootstrap.identity +1 -1
  2. package/bootstrap.sha256 +10 -582
  3. package/modules/localmodels/__init__.py +1 -1
  4. package/modules/{simplex_localmodels-0.1.0.dev31.dist-info → simplex_localmodels-0.1.0.dev32.dist-info}/METADATA +1 -1
  5. package/modules/{simplex_localmodels-0.1.0.dev31.dist-info → simplex_localmodels-0.1.0.dev32.dist-info}/RECORD +7 -7
  6. package/package.json +1 -1
  7. package/tool.json +1 -1
  8. package/python/bin/2to3 +0 -7
  9. package/python/bin/2to3-3.12 +0 -7
  10. package/python/bin/idle3 +0 -7
  11. package/python/bin/idle3.12 +0 -7
  12. package/python/bin/pip +0 -8
  13. package/python/bin/pip3 +0 -8
  14. package/python/bin/pip3.12 +0 -8
  15. package/python/bin/pydoc3 +0 -7
  16. package/python/bin/pydoc3.12 +0 -7
  17. package/python/bin/python +0 -0
  18. package/python/bin/python3 +0 -0
  19. package/python/bin/python3-config +0 -76
  20. package/python/bin/python3.12-config +0 -76
  21. package/python/include/python3.12/Python.h +0 -109
  22. package/python/include/python3.12/abstract.h +0 -899
  23. package/python/include/python3.12/bltinmodule.h +0 -14
  24. package/python/include/python3.12/boolobject.h +0 -42
  25. package/python/include/python3.12/bytearrayobject.h +0 -44
  26. package/python/include/python3.12/bytesobject.h +0 -69
  27. package/python/include/python3.12/ceval.h +0 -168
  28. package/python/include/python3.12/codecs.h +0 -248
  29. package/python/include/python3.12/compile.h +0 -22
  30. package/python/include/python3.12/complexobject.h +0 -30
  31. package/python/include/python3.12/cpython/abstract.h +0 -206
  32. package/python/include/python3.12/cpython/bytearrayobject.h +0 -34
  33. package/python/include/python3.12/cpython/bytesobject.h +0 -133
  34. package/python/include/python3.12/cpython/cellobject.h +0 -44
  35. package/python/include/python3.12/cpython/ceval.h +0 -35
  36. package/python/include/python3.12/cpython/classobject.h +0 -71
  37. package/python/include/python3.12/cpython/code.h +0 -389
  38. package/python/include/python3.12/cpython/compile.h +0 -69
  39. package/python/include/python3.12/cpython/complexobject.h +0 -44
  40. package/python/include/python3.12/cpython/context.h +0 -78
  41. package/python/include/python3.12/cpython/descrobject.h +0 -64
  42. package/python/include/python3.12/cpython/dictobject.h +0 -118
  43. package/python/include/python3.12/cpython/fileobject.h +0 -19
  44. package/python/include/python3.12/cpython/fileutils.h +0 -8
  45. package/python/include/python3.12/cpython/floatobject.h +0 -27
  46. package/python/include/python3.12/cpython/frameobject.h +0 -29
  47. package/python/include/python3.12/cpython/funcobject.h +0 -190
  48. package/python/include/python3.12/cpython/genobject.h +0 -89
  49. package/python/include/python3.12/cpython/import.h +0 -46
  50. package/python/include/python3.12/cpython/initconfig.h +0 -256
  51. package/python/include/python3.12/cpython/interpreteridobject.h +0 -11
  52. package/python/include/python3.12/cpython/listobject.h +0 -47
  53. package/python/include/python3.12/cpython/longintrepr.h +0 -133
  54. package/python/include/python3.12/cpython/longobject.h +0 -100
  55. package/python/include/python3.12/cpython/memoryobject.h +0 -52
  56. package/python/include/python3.12/cpython/methodobject.h +0 -66
  57. package/python/include/python3.12/cpython/modsupport.h +0 -109
  58. package/python/include/python3.12/cpython/object.h +0 -575
  59. package/python/include/python3.12/cpython/objimpl.h +0 -95
  60. package/python/include/python3.12/cpython/odictobject.h +0 -43
  61. package/python/include/python3.12/cpython/picklebufobject.h +0 -31
  62. package/python/include/python3.12/cpython/pthread_stubs.h +0 -88
  63. package/python/include/python3.12/cpython/pyctype.h +0 -39
  64. package/python/include/python3.12/cpython/pydebug.h +0 -38
  65. package/python/include/python3.12/cpython/pyerrors.h +0 -178
  66. package/python/include/python3.12/cpython/pyfpe.h +0 -15
  67. package/python/include/python3.12/cpython/pyframe.h +0 -35
  68. package/python/include/python3.12/cpython/pylifecycle.h +0 -111
  69. package/python/include/python3.12/cpython/pymem.h +0 -98
  70. package/python/include/python3.12/cpython/pystate.h +0 -456
  71. package/python/include/python3.12/cpython/pythonrun.h +0 -121
  72. package/python/include/python3.12/cpython/pythread.h +0 -42
  73. package/python/include/python3.12/cpython/pytime.h +0 -331
  74. package/python/include/python3.12/cpython/setobject.h +0 -72
  75. package/python/include/python3.12/cpython/sysmodule.h +0 -16
  76. package/python/include/python3.12/cpython/traceback.h +0 -16
  77. package/python/include/python3.12/cpython/tupleobject.h +0 -39
  78. package/python/include/python3.12/cpython/unicodeobject.h +0 -976
  79. package/python/include/python3.12/cpython/warnings.h +0 -20
  80. package/python/include/python3.12/cpython/weakrefobject.h +0 -56
  81. package/python/include/python3.12/datetime.h +0 -267
  82. package/python/include/python3.12/descrobject.h +0 -100
  83. package/python/include/python3.12/dictobject.h +0 -97
  84. package/python/include/python3.12/dynamic_annotations.h +0 -499
  85. package/python/include/python3.12/enumobject.h +0 -17
  86. package/python/include/python3.12/errcode.h +0 -38
  87. package/python/include/python3.12/exports.h +0 -36
  88. package/python/include/python3.12/fileobject.h +0 -49
  89. package/python/include/python3.12/fileutils.h +0 -26
  90. package/python/include/python3.12/floatobject.h +0 -54
  91. package/python/include/python3.12/frameobject.h +0 -20
  92. package/python/include/python3.12/genericaliasobject.h +0 -14
  93. package/python/include/python3.12/import.h +0 -98
  94. package/python/include/python3.12/internal/pycore_abstract.h +0 -25
  95. package/python/include/python3.12/internal/pycore_asdl.h +0 -112
  96. package/python/include/python3.12/internal/pycore_ast.h +0 -922
  97. package/python/include/python3.12/internal/pycore_ast_state.h +0 -265
  98. package/python/include/python3.12/internal/pycore_atexit.h +0 -57
  99. package/python/include/python3.12/internal/pycore_atomic.h +0 -557
  100. package/python/include/python3.12/internal/pycore_atomic_funcs.h +0 -94
  101. package/python/include/python3.12/internal/pycore_bitutils.h +0 -186
  102. package/python/include/python3.12/internal/pycore_blocks_output_buffer.h +0 -317
  103. package/python/include/python3.12/internal/pycore_bytes_methods.h +0 -73
  104. package/python/include/python3.12/internal/pycore_bytesobject.h +0 -47
  105. package/python/include/python3.12/internal/pycore_call.h +0 -133
  106. package/python/include/python3.12/internal/pycore_ceval.h +0 -164
  107. package/python/include/python3.12/internal/pycore_ceval_state.h +0 -103
  108. package/python/include/python3.12/internal/pycore_code.h +0 -496
  109. package/python/include/python3.12/internal/pycore_compile.h +0 -118
  110. package/python/include/python3.12/internal/pycore_condvar.h +0 -99
  111. package/python/include/python3.12/internal/pycore_context.h +0 -71
  112. package/python/include/python3.12/internal/pycore_descrobject.h +0 -26
  113. package/python/include/python3.12/internal/pycore_dict.h +0 -199
  114. package/python/include/python3.12/internal/pycore_dict_state.h +0 -50
  115. package/python/include/python3.12/internal/pycore_dtoa.h +0 -69
  116. package/python/include/python3.12/internal/pycore_emscripten_signal.h +0 -25
  117. package/python/include/python3.12/internal/pycore_exceptions.h +0 -37
  118. package/python/include/python3.12/internal/pycore_faulthandler.h +0 -99
  119. package/python/include/python3.12/internal/pycore_fileutils.h +0 -292
  120. package/python/include/python3.12/internal/pycore_fileutils_windows.h +0 -98
  121. package/python/include/python3.12/internal/pycore_floatobject.h +0 -71
  122. package/python/include/python3.12/internal/pycore_flowgraph.h +0 -120
  123. package/python/include/python3.12/internal/pycore_format.h +0 -27
  124. package/python/include/python3.12/internal/pycore_frame.h +0 -283
  125. package/python/include/python3.12/internal/pycore_function.h +0 -26
  126. package/python/include/python3.12/internal/pycore_gc.h +0 -211
  127. package/python/include/python3.12/internal/pycore_genobject.h +0 -49
  128. package/python/include/python3.12/internal/pycore_getopt.h +0 -22
  129. package/python/include/python3.12/internal/pycore_gil.h +0 -50
  130. package/python/include/python3.12/internal/pycore_global_objects.h +0 -105
  131. package/python/include/python3.12/internal/pycore_global_objects_fini_generated.h +0 -1517
  132. package/python/include/python3.12/internal/pycore_global_strings.h +0 -777
  133. package/python/include/python3.12/internal/pycore_hamt.h +0 -134
  134. package/python/include/python3.12/internal/pycore_hashtable.h +0 -149
  135. package/python/include/python3.12/internal/pycore_import.h +0 -183
  136. package/python/include/python3.12/internal/pycore_initconfig.h +0 -179
  137. package/python/include/python3.12/internal/pycore_instruments.h +0 -106
  138. package/python/include/python3.12/internal/pycore_interp.h +0 -275
  139. package/python/include/python3.12/internal/pycore_intrinsics.h +0 -32
  140. package/python/include/python3.12/internal/pycore_list.h +0 -83
  141. package/python/include/python3.12/internal/pycore_long.h +0 -258
  142. package/python/include/python3.12/internal/pycore_memoryobject.h +0 -18
  143. package/python/include/python3.12/internal/pycore_moduleobject.h +0 -45
  144. package/python/include/python3.12/internal/pycore_namespace.h +0 -20
  145. package/python/include/python3.12/internal/pycore_object.h +0 -455
  146. package/python/include/python3.12/internal/pycore_object_state.h +0 -42
  147. package/python/include/python3.12/internal/pycore_obmalloc.h +0 -700
  148. package/python/include/python3.12/internal/pycore_obmalloc_init.h +0 -73
  149. package/python/include/python3.12/internal/pycore_opcode.h +0 -587
  150. package/python/include/python3.12/internal/pycore_opcode_utils.h +0 -92
  151. package/python/include/python3.12/internal/pycore_parser.h +0 -66
  152. package/python/include/python3.12/internal/pycore_pathconfig.h +0 -24
  153. package/python/include/python3.12/internal/pycore_pyarena.h +0 -64
  154. package/python/include/python3.12/internal/pycore_pyerrors.h +0 -129
  155. package/python/include/python3.12/internal/pycore_pyhash.h +0 -40
  156. package/python/include/python3.12/internal/pycore_pylifecycle.h +0 -99
  157. package/python/include/python3.12/internal/pycore_pymath.h +0 -205
  158. package/python/include/python3.12/internal/pycore_pymem.h +0 -98
  159. package/python/include/python3.12/internal/pycore_pymem_init.h +0 -85
  160. package/python/include/python3.12/internal/pycore_pystate.h +0 -180
  161. package/python/include/python3.12/internal/pycore_pythread.h +0 -81
  162. package/python/include/python3.12/internal/pycore_range.h +0 -21
  163. package/python/include/python3.12/internal/pycore_runtime.h +0 -235
  164. package/python/include/python3.12/internal/pycore_runtime_init.h +0 -188
  165. package/python/include/python3.12/internal/pycore_runtime_init_generated.h +0 -1511
  166. package/python/include/python3.12/internal/pycore_signal.h +0 -98
  167. package/python/include/python3.12/internal/pycore_sliceobject.h +0 -22
  168. package/python/include/python3.12/internal/pycore_strhex.h +0 -36
  169. package/python/include/python3.12/internal/pycore_structseq.h +0 -39
  170. package/python/include/python3.12/internal/pycore_symtable.h +0 -160
  171. package/python/include/python3.12/internal/pycore_sysmodule.h +0 -34
  172. package/python/include/python3.12/internal/pycore_time.h +0 -25
  173. package/python/include/python3.12/internal/pycore_token.h +0 -108
  174. package/python/include/python3.12/internal/pycore_traceback.h +0 -101
  175. package/python/include/python3.12/internal/pycore_tracemalloc.h +0 -123
  176. package/python/include/python3.12/internal/pycore_tuple.h +0 -79
  177. package/python/include/python3.12/internal/pycore_typeobject.h +0 -151
  178. package/python/include/python3.12/internal/pycore_typevarobject.h +0 -24
  179. package/python/include/python3.12/internal/pycore_ucnhash.h +0 -34
  180. package/python/include/python3.12/internal/pycore_unicodeobject.h +0 -86
  181. package/python/include/python3.12/internal/pycore_unicodeobject_generated.h +0 -2832
  182. package/python/include/python3.12/internal/pycore_unionobject.h +0 -23
  183. package/python/include/python3.12/internal/pycore_warnings.h +0 -29
  184. package/python/include/python3.12/interpreteridobject.h +0 -17
  185. package/python/include/python3.12/intrcheck.h +0 -30
  186. package/python/include/python3.12/iterobject.h +0 -27
  187. package/python/include/python3.12/listobject.h +0 -52
  188. package/python/include/python3.12/longobject.h +0 -108
  189. package/python/include/python3.12/marshal.h +0 -31
  190. package/python/include/python3.12/memoryobject.h +0 -34
  191. package/python/include/python3.12/methodobject.h +0 -132
  192. package/python/include/python3.12/modsupport.h +0 -168
  193. package/python/include/python3.12/moduleobject.h +0 -119
  194. package/python/include/python3.12/object.h +0 -993
  195. package/python/include/python3.12/objimpl.h +0 -234
  196. package/python/include/python3.12/opcode.h +0 -271
  197. package/python/include/python3.12/osdefs.h +0 -51
  198. package/python/include/python3.12/osmodule.h +0 -17
  199. package/python/include/python3.12/patchlevel.h +0 -35
  200. package/python/include/python3.12/py_curses.h +0 -99
  201. package/python/include/python3.12/pybuffer.h +0 -145
  202. package/python/include/python3.12/pycapsule.h +0 -59
  203. package/python/include/python3.12/pyconfig.h +0 -1943
  204. package/python/include/python3.12/pydtrace.h +0 -59
  205. package/python/include/python3.12/pyerrors.h +0 -337
  206. package/python/include/python3.12/pyexpat.h +0 -70
  207. package/python/include/python3.12/pyframe.h +0 -26
  208. package/python/include/python3.12/pyhash.h +0 -146
  209. package/python/include/python3.12/pylifecycle.h +0 -78
  210. package/python/include/python3.12/pymacconfig.h +0 -99
  211. package/python/include/python3.12/pymacro.h +0 -172
  212. package/python/include/python3.12/pymath.h +0 -62
  213. package/python/include/python3.12/pymem.h +0 -104
  214. package/python/include/python3.12/pyport.h +0 -782
  215. package/python/include/python3.12/pystate.h +0 -132
  216. package/python/include/python3.12/pystats.h +0 -110
  217. package/python/include/python3.12/pystrcmp.h +0 -23
  218. package/python/include/python3.12/pystrtod.h +0 -46
  219. package/python/include/python3.12/pythonrun.h +0 -49
  220. package/python/include/python3.12/pythread.h +0 -135
  221. package/python/include/python3.12/pytypedefs.h +0 -30
  222. package/python/include/python3.12/rangeobject.h +0 -27
  223. package/python/include/python3.12/setobject.h +0 -49
  224. package/python/include/python3.12/sliceobject.h +0 -65
  225. package/python/include/python3.12/structmember.h +0 -56
  226. package/python/include/python3.12/structseq.h +0 -49
  227. package/python/include/python3.12/sysmodule.h +0 -54
  228. package/python/include/python3.12/traceback.h +0 -26
  229. package/python/include/python3.12/tracemalloc.h +0 -77
  230. package/python/include/python3.12/tupleobject.h +0 -46
  231. package/python/include/python3.12/typeslots.h +0 -88
  232. package/python/include/python3.12/unicodeobject.h +0 -1020
  233. package/python/include/python3.12/warnings.h +0 -45
  234. package/python/include/python3.12/weakrefobject.h +0 -42
  235. package/python/lib/itcl4.3.8/itcl.tcl +0 -151
  236. package/python/lib/itcl4.3.8/itclConfig.sh +0 -67
  237. package/python/lib/itcl4.3.8/itclHullCmds.tcl +0 -562
  238. package/python/lib/itcl4.3.8/itclWidget.tcl +0 -447
  239. package/python/lib/itcl4.3.8/libitcl4.3.8.dylib +0 -0
  240. package/python/lib/itcl4.3.8/libitclstub.a +0 -0
  241. package/python/lib/itcl4.3.8/libitclstub4.3.8.a +0 -0
  242. package/python/lib/itcl4.3.8/libtcl9itcl4.3.8.dylib +0 -0
  243. package/python/lib/itcl4.3.8/pkgIndex.tcl +0 -14
  244. package/python/lib/libpython3.12.dylib +0 -0
  245. package/python/lib/libtcl9.0.dylib +0 -0
  246. package/python/lib/libtcl9tk9.0.dylib +0 -0
  247. package/python/lib/pkgconfig/python-3.12-embed.pc +0 -13
  248. package/python/lib/pkgconfig/python-3.12.pc +0 -13
  249. package/python/lib/pkgconfig/python3-embed.pc +0 -13
  250. package/python/lib/pkgconfig/python3.pc +0 -13
  251. package/python/lib/python3.12/config-3.12-darwin/Makefile +0 -3273
  252. package/python/lib/python3.12/config-3.12-darwin/Setup +0 -303
  253. package/python/lib/python3.12/config-3.12-darwin/Setup.bootstrap +0 -36
  254. package/python/lib/python3.12/config-3.12-darwin/Setup.local +0 -19
  255. package/python/lib/python3.12/config-3.12-darwin/Setup.stdlib +0 -183
  256. package/python/lib/python3.12/config-3.12-darwin/config.c +0 -246
  257. package/python/lib/python3.12/config-3.12-darwin/config.c.in +0 -71
  258. package/python/lib/python3.12/config-3.12-darwin/install-sh +0 -541
  259. package/python/lib/python3.12/config-3.12-darwin/makesetup +0 -353
  260. package/python/lib/python3.12/config-3.12-darwin/python-config.py +0 -76
  261. package/python/lib/python3.12/config-3.12-darwin/python.o +0 -0
  262. package/python/lib/python3.12/idlelib/CREDITS.txt +0 -47
  263. package/python/lib/python3.12/idlelib/ChangeLog +0 -1591
  264. package/python/lib/python3.12/idlelib/HISTORY.txt +0 -296
  265. package/python/lib/python3.12/idlelib/Icons/README.txt +0 -51
  266. package/python/lib/python3.12/idlelib/Icons/folder.gif +0 -0
  267. package/python/lib/python3.12/idlelib/Icons/idle.ico +0 -0
  268. package/python/lib/python3.12/idlelib/Icons/idle_16.gif +0 -0
  269. package/python/lib/python3.12/idlelib/Icons/idle_16.png +0 -0
  270. package/python/lib/python3.12/idlelib/Icons/idle_256.png +0 -0
  271. package/python/lib/python3.12/idlelib/Icons/idle_32.gif +0 -0
  272. package/python/lib/python3.12/idlelib/Icons/idle_32.png +0 -0
  273. package/python/lib/python3.12/idlelib/Icons/idle_48.gif +0 -0
  274. package/python/lib/python3.12/idlelib/Icons/idle_48.png +0 -0
  275. package/python/lib/python3.12/idlelib/Icons/minusnode.gif +0 -0
  276. package/python/lib/python3.12/idlelib/Icons/openfolder.gif +0 -0
  277. package/python/lib/python3.12/idlelib/Icons/plusnode.gif +0 -0
  278. package/python/lib/python3.12/idlelib/Icons/python.gif +0 -0
  279. package/python/lib/python3.12/idlelib/Icons/tk.gif +0 -0
  280. package/python/lib/python3.12/idlelib/NEWS2x.txt +0 -660
  281. package/python/lib/python3.12/idlelib/News3.txt +0 -1390
  282. package/python/lib/python3.12/idlelib/README.txt +0 -290
  283. package/python/lib/python3.12/idlelib/TODO.txt +0 -210
  284. package/python/lib/python3.12/idlelib/__init__.py +0 -10
  285. package/python/lib/python3.12/idlelib/__main__.py +0 -7
  286. package/python/lib/python3.12/idlelib/autocomplete.py +0 -228
  287. package/python/lib/python3.12/idlelib/autocomplete_w.py +0 -498
  288. package/python/lib/python3.12/idlelib/autoexpand.py +0 -96
  289. package/python/lib/python3.12/idlelib/browser.py +0 -260
  290. package/python/lib/python3.12/idlelib/calltip.py +0 -205
  291. package/python/lib/python3.12/idlelib/calltip_w.py +0 -202
  292. package/python/lib/python3.12/idlelib/codecontext.py +0 -270
  293. package/python/lib/python3.12/idlelib/colorizer.py +0 -384
  294. package/python/lib/python3.12/idlelib/config-extensions.def +0 -62
  295. package/python/lib/python3.12/idlelib/config-highlight.def +0 -105
  296. package/python/lib/python3.12/idlelib/config-keys.def +0 -309
  297. package/python/lib/python3.12/idlelib/config-main.def +0 -93
  298. package/python/lib/python3.12/idlelib/config.py +0 -917
  299. package/python/lib/python3.12/idlelib/config_key.py +0 -354
  300. package/python/lib/python3.12/idlelib/configdialog.py +0 -2408
  301. package/python/lib/python3.12/idlelib/debugger.py +0 -602
  302. package/python/lib/python3.12/idlelib/debugger_r.py +0 -390
  303. package/python/lib/python3.12/idlelib/debugobj.py +0 -146
  304. package/python/lib/python3.12/idlelib/debugobj_r.py +0 -41
  305. package/python/lib/python3.12/idlelib/delegator.py +0 -34
  306. package/python/lib/python3.12/idlelib/dynoption.py +0 -57
  307. package/python/lib/python3.12/idlelib/editor.py +0 -1767
  308. package/python/lib/python3.12/idlelib/extend.txt +0 -83
  309. package/python/lib/python3.12/idlelib/filelist.py +0 -132
  310. package/python/lib/python3.12/idlelib/format.py +0 -426
  311. package/python/lib/python3.12/idlelib/grep.py +0 -223
  312. package/python/lib/python3.12/idlelib/help.html +0 -805
  313. package/python/lib/python3.12/idlelib/help.py +0 -297
  314. package/python/lib/python3.12/idlelib/help_about.py +0 -211
  315. package/python/lib/python3.12/idlelib/history.py +0 -106
  316. package/python/lib/python3.12/idlelib/hyperparser.py +0 -312
  317. package/python/lib/python3.12/idlelib/idle.bat +0 -4
  318. package/python/lib/python3.12/idlelib/idle.py +0 -14
  319. package/python/lib/python3.12/idlelib/idle.pyw +0 -17
  320. package/python/lib/python3.12/idlelib/iomenu.py +0 -441
  321. package/python/lib/python3.12/idlelib/macosx.py +0 -278
  322. package/python/lib/python3.12/idlelib/mainmenu.py +0 -126
  323. package/python/lib/python3.12/idlelib/multicall.py +0 -451
  324. package/python/lib/python3.12/idlelib/outwin.py +0 -188
  325. package/python/lib/python3.12/idlelib/parenmatch.py +0 -183
  326. package/python/lib/python3.12/idlelib/pathbrowser.py +0 -107
  327. package/python/lib/python3.12/idlelib/percolator.py +0 -120
  328. package/python/lib/python3.12/idlelib/pyparse.py +0 -589
  329. package/python/lib/python3.12/idlelib/pyshell.py +0 -1694
  330. package/python/lib/python3.12/idlelib/query.py +0 -392
  331. package/python/lib/python3.12/idlelib/redirector.py +0 -173
  332. package/python/lib/python3.12/idlelib/replace.py +0 -300
  333. package/python/lib/python3.12/idlelib/rpc.py +0 -635
  334. package/python/lib/python3.12/idlelib/run.py +0 -646
  335. package/python/lib/python3.12/idlelib/runscript.py +0 -213
  336. package/python/lib/python3.12/idlelib/scrolledlist.py +0 -151
  337. package/python/lib/python3.12/idlelib/search.py +0 -165
  338. package/python/lib/python3.12/idlelib/searchbase.py +0 -210
  339. package/python/lib/python3.12/idlelib/searchengine.py +0 -235
  340. package/python/lib/python3.12/idlelib/sidebar.py +0 -544
  341. package/python/lib/python3.12/idlelib/squeezer.py +0 -345
  342. package/python/lib/python3.12/idlelib/stackviewer.py +0 -134
  343. package/python/lib/python3.12/idlelib/statusbar.py +0 -52
  344. package/python/lib/python3.12/idlelib/textview.py +0 -193
  345. package/python/lib/python3.12/idlelib/tooltip.py +0 -190
  346. package/python/lib/python3.12/idlelib/tree.py +0 -509
  347. package/python/lib/python3.12/idlelib/undo.py +0 -367
  348. package/python/lib/python3.12/idlelib/util.py +0 -37
  349. package/python/lib/python3.12/idlelib/window.py +0 -98
  350. package/python/lib/python3.12/idlelib/zoomheight.py +0 -124
  351. package/python/lib/python3.12/idlelib/zzdummy.py +0 -73
  352. package/python/lib/python3.12/lib-dynload/_tkinter.cpython-312-darwin.so +0 -0
  353. package/python/lib/python3.12/tkinter/__init__.py +0 -4682
  354. package/python/lib/python3.12/tkinter/__main__.py +0 -7
  355. package/python/lib/python3.12/tkinter/colorchooser.py +0 -86
  356. package/python/lib/python3.12/tkinter/commondialog.py +0 -53
  357. package/python/lib/python3.12/tkinter/constants.py +0 -110
  358. package/python/lib/python3.12/tkinter/dialog.py +0 -49
  359. package/python/lib/python3.12/tkinter/dnd.py +0 -324
  360. package/python/lib/python3.12/tkinter/filedialog.py +0 -492
  361. package/python/lib/python3.12/tkinter/font.py +0 -239
  362. package/python/lib/python3.12/tkinter/messagebox.py +0 -146
  363. package/python/lib/python3.12/tkinter/scrolledtext.py +0 -56
  364. package/python/lib/python3.12/tkinter/simpledialog.py +0 -441
  365. package/python/lib/python3.12/tkinter/tix.py +0 -1948
  366. package/python/lib/python3.12/tkinter/ttk.py +0 -1640
  367. package/python/lib/python3.12/turtle.py +0 -4207
  368. package/python/lib/python3.12/turtledemo/__init__.py +0 -14
  369. package/python/lib/python3.12/turtledemo/__main__.py +0 -404
  370. package/python/lib/python3.12/turtledemo/bytedesign.py +0 -161
  371. package/python/lib/python3.12/turtledemo/chaos.py +0 -59
  372. package/python/lib/python3.12/turtledemo/clock.py +0 -138
  373. package/python/lib/python3.12/turtledemo/colormixer.py +0 -58
  374. package/python/lib/python3.12/turtledemo/forest.py +0 -108
  375. package/python/lib/python3.12/turtledemo/fractalcurves.py +0 -138
  376. package/python/lib/python3.12/turtledemo/lindenmayer.py +0 -119
  377. package/python/lib/python3.12/turtledemo/minimal_hanoi.py +0 -79
  378. package/python/lib/python3.12/turtledemo/nim.py +0 -226
  379. package/python/lib/python3.12/turtledemo/paint.py +0 -54
  380. package/python/lib/python3.12/turtledemo/peace.py +0 -61
  381. package/python/lib/python3.12/turtledemo/penrose.py +0 -175
  382. package/python/lib/python3.12/turtledemo/planet_and_moon.py +0 -111
  383. package/python/lib/python3.12/turtledemo/rosette.py +0 -65
  384. package/python/lib/python3.12/turtledemo/round_dance.py +0 -86
  385. package/python/lib/python3.12/turtledemo/sorting_animate.py +0 -204
  386. package/python/lib/python3.12/turtledemo/tree.py +0 -62
  387. package/python/lib/python3.12/turtledemo/turtle.cfg +0 -10
  388. package/python/lib/python3.12/turtledemo/two_canvases.py +0 -54
  389. package/python/lib/python3.12/turtledemo/yinyang.py +0 -49
  390. package/python/lib/tcl9/9.0/http-2.10.2.tm +0 -5451
  391. package/python/lib/tcl9/9.0/msgcat-1.7.1.tm +0 -1349
  392. package/python/lib/tcl9/9.0/platform/shell-1.1.4.tm +0 -241
  393. package/python/lib/tcl9/9.0/platform-1.1.0.tm +0 -442
  394. package/python/lib/tcl9/9.0/tcltest-2.5.11.tm +0 -3600
  395. package/python/lib/tcl9.0/auto.tcl +0 -710
  396. package/python/lib/tcl9.0/clock.tcl +0 -2110
  397. package/python/lib/tcl9.0/cookiejar0.2/cookiejar.tcl +0 -746
  398. package/python/lib/tcl9.0/cookiejar0.2/idna.tcl +0 -292
  399. package/python/lib/tcl9.0/cookiejar0.2/pkgIndex.tcl +0 -3
  400. package/python/lib/tcl9.0/cookiejar0.2/public_suffix_list.dat.gz +0 -0
  401. package/python/lib/tcl9.0/encoding/ascii.enc +0 -20
  402. package/python/lib/tcl9.0/encoding/big5.enc +0 -1516
  403. package/python/lib/tcl9.0/encoding/cns11643.enc +0 -1584
  404. package/python/lib/tcl9.0/encoding/cp1250.enc +0 -20
  405. package/python/lib/tcl9.0/encoding/cp1251.enc +0 -20
  406. package/python/lib/tcl9.0/encoding/cp1252.enc +0 -20
  407. package/python/lib/tcl9.0/encoding/cp1253.enc +0 -20
  408. package/python/lib/tcl9.0/encoding/cp1254.enc +0 -20
  409. package/python/lib/tcl9.0/encoding/cp1255.enc +0 -20
  410. package/python/lib/tcl9.0/encoding/cp1256.enc +0 -20
  411. package/python/lib/tcl9.0/encoding/cp1257.enc +0 -20
  412. package/python/lib/tcl9.0/encoding/cp1258.enc +0 -20
  413. package/python/lib/tcl9.0/encoding/cp165.enc +0 -20
  414. package/python/lib/tcl9.0/encoding/cp437.enc +0 -20
  415. package/python/lib/tcl9.0/encoding/cp737.enc +0 -20
  416. package/python/lib/tcl9.0/encoding/cp775.enc +0 -20
  417. package/python/lib/tcl9.0/encoding/cp850.enc +0 -20
  418. package/python/lib/tcl9.0/encoding/cp852.enc +0 -20
  419. package/python/lib/tcl9.0/encoding/cp855.enc +0 -20
  420. package/python/lib/tcl9.0/encoding/cp857.enc +0 -20
  421. package/python/lib/tcl9.0/encoding/cp860.enc +0 -20
  422. package/python/lib/tcl9.0/encoding/cp861.enc +0 -20
  423. package/python/lib/tcl9.0/encoding/cp862.enc +0 -20
  424. package/python/lib/tcl9.0/encoding/cp863.enc +0 -20
  425. package/python/lib/tcl9.0/encoding/cp864.enc +0 -20
  426. package/python/lib/tcl9.0/encoding/cp865.enc +0 -20
  427. package/python/lib/tcl9.0/encoding/cp866.enc +0 -20
  428. package/python/lib/tcl9.0/encoding/cp869.enc +0 -20
  429. package/python/lib/tcl9.0/encoding/cp874.enc +0 -20
  430. package/python/lib/tcl9.0/encoding/cp932.enc +0 -801
  431. package/python/lib/tcl9.0/encoding/cp936.enc +0 -2162
  432. package/python/lib/tcl9.0/encoding/cp949.enc +0 -2128
  433. package/python/lib/tcl9.0/encoding/cp950.enc +0 -1499
  434. package/python/lib/tcl9.0/encoding/dingbats.enc +0 -20
  435. package/python/lib/tcl9.0/encoding/ebcdic.enc +0 -20
  436. package/python/lib/tcl9.0/encoding/euc-cn.enc +0 -1397
  437. package/python/lib/tcl9.0/encoding/euc-jp.enc +0 -1353
  438. package/python/lib/tcl9.0/encoding/euc-kr.enc +0 -1533
  439. package/python/lib/tcl9.0/encoding/gb12345.enc +0 -1414
  440. package/python/lib/tcl9.0/encoding/gb1988.enc +0 -20
  441. package/python/lib/tcl9.0/encoding/gb2312-raw.enc +0 -1380
  442. package/python/lib/tcl9.0/encoding/gb2312.enc +0 -1397
  443. package/python/lib/tcl9.0/encoding/iso2022-jp.enc +0 -12
  444. package/python/lib/tcl9.0/encoding/iso2022-kr.enc +0 -7
  445. package/python/lib/tcl9.0/encoding/iso2022.enc +0 -14
  446. package/python/lib/tcl9.0/encoding/iso8859-1.enc +0 -20
  447. package/python/lib/tcl9.0/encoding/iso8859-10.enc +0 -20
  448. package/python/lib/tcl9.0/encoding/iso8859-11.enc +0 -20
  449. package/python/lib/tcl9.0/encoding/iso8859-13.enc +0 -20
  450. package/python/lib/tcl9.0/encoding/iso8859-14.enc +0 -20
  451. package/python/lib/tcl9.0/encoding/iso8859-15.enc +0 -20
  452. package/python/lib/tcl9.0/encoding/iso8859-16.enc +0 -20
  453. package/python/lib/tcl9.0/encoding/iso8859-2.enc +0 -20
  454. package/python/lib/tcl9.0/encoding/iso8859-3.enc +0 -20
  455. package/python/lib/tcl9.0/encoding/iso8859-4.enc +0 -20
  456. package/python/lib/tcl9.0/encoding/iso8859-5.enc +0 -20
  457. package/python/lib/tcl9.0/encoding/iso8859-6.enc +0 -20
  458. package/python/lib/tcl9.0/encoding/iso8859-7.enc +0 -20
  459. package/python/lib/tcl9.0/encoding/iso8859-8.enc +0 -20
  460. package/python/lib/tcl9.0/encoding/iso8859-9.enc +0 -20
  461. package/python/lib/tcl9.0/encoding/jis0201.enc +0 -20
  462. package/python/lib/tcl9.0/encoding/jis0208.enc +0 -1319
  463. package/python/lib/tcl9.0/encoding/jis0212.enc +0 -1159
  464. package/python/lib/tcl9.0/encoding/koi8-r.enc +0 -20
  465. package/python/lib/tcl9.0/encoding/koi8-ru.enc +0 -20
  466. package/python/lib/tcl9.0/encoding/koi8-t.enc +0 -20
  467. package/python/lib/tcl9.0/encoding/koi8-u.enc +0 -20
  468. package/python/lib/tcl9.0/encoding/ksc5601.enc +0 -1516
  469. package/python/lib/tcl9.0/encoding/macCentEuro.enc +0 -20
  470. package/python/lib/tcl9.0/encoding/macCroatian.enc +0 -20
  471. package/python/lib/tcl9.0/encoding/macCyrillic.enc +0 -20
  472. package/python/lib/tcl9.0/encoding/macDingbats.enc +0 -20
  473. package/python/lib/tcl9.0/encoding/macGreek.enc +0 -20
  474. package/python/lib/tcl9.0/encoding/macIceland.enc +0 -20
  475. package/python/lib/tcl9.0/encoding/macJapan.enc +0 -785
  476. package/python/lib/tcl9.0/encoding/macRoman.enc +0 -20
  477. package/python/lib/tcl9.0/encoding/macRomania.enc +0 -20
  478. package/python/lib/tcl9.0/encoding/macThai.enc +0 -20
  479. package/python/lib/tcl9.0/encoding/macTurkish.enc +0 -20
  480. package/python/lib/tcl9.0/encoding/macUkraine.enc +0 -20
  481. package/python/lib/tcl9.0/encoding/shiftjis.enc +0 -690
  482. package/python/lib/tcl9.0/encoding/symbol.enc +0 -20
  483. package/python/lib/tcl9.0/encoding/tis-620.enc +0 -20
  484. package/python/lib/tcl9.0/foreachline.tcl +0 -25
  485. package/python/lib/tcl9.0/history.tcl +0 -335
  486. package/python/lib/tcl9.0/icu.tcl +0 -145
  487. package/python/lib/tcl9.0/init.tcl +0 -772
  488. package/python/lib/tcl9.0/install.tcl +0 -274
  489. package/python/lib/tcl9.0/opt0.4/optparse.tcl +0 -1060
  490. package/python/lib/tcl9.0/opt0.4/pkgIndex.tcl +0 -12
  491. package/python/lib/tcl9.0/package.tcl +0 -776
  492. package/python/lib/tcl9.0/parray.tcl +0 -28
  493. package/python/lib/tcl9.0/readfile.tcl +0 -23
  494. package/python/lib/tcl9.0/safe.tcl +0 -1459
  495. package/python/lib/tcl9.0/tclAppInit.c +0 -183
  496. package/python/lib/tcl9.0/tclIndex +0 -112
  497. package/python/lib/tcl9.0/tm.tcl +0 -378
  498. package/python/lib/tcl9.0/word.tcl +0 -155
  499. package/python/lib/tcl9.0/writefile.tcl +0 -37
  500. package/python/lib/thread3.0.6/libtcl9thread3.0.6.dylib +0 -0
  501. package/python/lib/thread3.0.6/libthread3.0.6.dylib +0 -0
  502. package/python/lib/thread3.0.6/pkgIndex.tcl +0 -52
  503. package/python/lib/thread3.0.6/ttrace.tcl +0 -943
  504. package/python/lib/tk9.0/bgerror.tcl +0 -282
  505. package/python/lib/tk9.0/button.tcl +0 -782
  506. package/python/lib/tk9.0/choosedir.tcl +0 -310
  507. package/python/lib/tk9.0/clrpick.tcl +0 -696
  508. package/python/lib/tk9.0/comdlg.tcl +0 -322
  509. package/python/lib/tk9.0/console.tcl +0 -1148
  510. package/python/lib/tk9.0/dialog.tcl +0 -175
  511. package/python/lib/tk9.0/entry.tcl +0 -721
  512. package/python/lib/tk9.0/focus.tcl +0 -178
  513. package/python/lib/tk9.0/fontchooser.tcl +0 -512
  514. package/python/lib/tk9.0/iconbadges.tcl +0 -253
  515. package/python/lib/tk9.0/iconlist.tcl +0 -705
  516. package/python/lib/tk9.0/icons.tcl +0 -54
  517. package/python/lib/tk9.0/images/README +0 -7
  518. package/python/lib/tk9.0/images/logo.eps +0 -2091
  519. package/python/lib/tk9.0/images/logo100.gif +0 -0
  520. package/python/lib/tk9.0/images/logo64.gif +0 -0
  521. package/python/lib/tk9.0/images/logoLarge.gif +0 -0
  522. package/python/lib/tk9.0/images/logoMed.gif +0 -0
  523. package/python/lib/tk9.0/images/pwrdLogo.eps +0 -1897
  524. package/python/lib/tk9.0/images/pwrdLogo100.gif +0 -0
  525. package/python/lib/tk9.0/images/pwrdLogo150.gif +0 -0
  526. package/python/lib/tk9.0/images/pwrdLogo175.gif +0 -0
  527. package/python/lib/tk9.0/images/pwrdLogo200.gif +0 -0
  528. package/python/lib/tk9.0/images/pwrdLogo75.gif +0 -0
  529. package/python/lib/tk9.0/images/tai-ku.gif +0 -0
  530. package/python/lib/tk9.0/listbox.tcl +0 -522
  531. package/python/lib/tk9.0/megawidget.tcl +0 -297
  532. package/python/lib/tk9.0/menu.tcl +0 -1376
  533. package/python/lib/tk9.0/mkpsenc.tcl +0 -1488
  534. package/python/lib/tk9.0/msgbox.tcl +0 -454
  535. package/python/lib/tk9.0/optMenu.tcl +0 -43
  536. package/python/lib/tk9.0/palette.tcl +0 -283
  537. package/python/lib/tk9.0/panedwindow.tcl +0 -194
  538. package/python/lib/tk9.0/pkgIndex.tcl +0 -3
  539. package/python/lib/tk9.0/print.tcl +0 -1460
  540. package/python/lib/tk9.0/safetk.tcl +0 -262
  541. package/python/lib/tk9.0/scale.tcl +0 -299
  542. package/python/lib/tk9.0/scaling.tcl +0 -232
  543. package/python/lib/tk9.0/scrlbar.tcl +0 -506
  544. package/python/lib/tk9.0/spinbox.tcl +0 -590
  545. package/python/lib/tk9.0/systray.tcl +0 -483
  546. package/python/lib/tk9.0/tclIndex +0 -252
  547. package/python/lib/tk9.0/tearoff.tcl +0 -155
  548. package/python/lib/tk9.0/text.tcl +0 -1295
  549. package/python/lib/tk9.0/tk.tcl +0 -853
  550. package/python/lib/tk9.0/tkAppInit.c +0 -200
  551. package/python/lib/tk9.0/tkfbox.tcl +0 -1251
  552. package/python/lib/tk9.0/ttk/altTheme.tcl +0 -158
  553. package/python/lib/tk9.0/ttk/aquaTheme.tcl +0 -254
  554. package/python/lib/tk9.0/ttk/button.tcl +0 -83
  555. package/python/lib/tk9.0/ttk/clamTheme.tcl +0 -200
  556. package/python/lib/tk9.0/ttk/classicTheme.tcl +0 -165
  557. package/python/lib/tk9.0/ttk/combobox.tcl +0 -555
  558. package/python/lib/tk9.0/ttk/cursors.tcl +0 -205
  559. package/python/lib/tk9.0/ttk/defaults.tcl +0 -250
  560. package/python/lib/tk9.0/ttk/entry.tcl +0 -678
  561. package/python/lib/tk9.0/ttk/fonts.tcl +0 -152
  562. package/python/lib/tk9.0/ttk/menubutton.tcl +0 -237
  563. package/python/lib/tk9.0/ttk/notebook.tcl +0 -261
  564. package/python/lib/tk9.0/ttk/panedwindow.tcl +0 -89
  565. package/python/lib/tk9.0/ttk/progress.tcl +0 -55
  566. package/python/lib/tk9.0/ttk/scale.tcl +0 -94
  567. package/python/lib/tk9.0/ttk/scrollbar.tcl +0 -119
  568. package/python/lib/tk9.0/ttk/sizegrip.tcl +0 -102
  569. package/python/lib/tk9.0/ttk/spinbox.tcl +0 -204
  570. package/python/lib/tk9.0/ttk/treeview.tcl +0 -464
  571. package/python/lib/tk9.0/ttk/ttk.tcl +0 -220
  572. package/python/lib/tk9.0/ttk/utils.tcl +0 -317
  573. package/python/lib/tk9.0/ttk/vistaTheme.tcl +0 -260
  574. package/python/lib/tk9.0/ttk/winTheme.tcl +0 -123
  575. package/python/lib/tk9.0/ttk/xpTheme.tcl +0 -99
  576. package/python/lib/tk9.0/xmfbox.tcl +0 -982
  577. package/python/share/man/man1/python.1 +0 -630
  578. package/python/share/man/man1/python3.1 +0 -630
  579. package/python/share/man/man1/python3.12.1 +0 -630
  580. /package/modules/{simplex_localmodels-0.1.0.dev31.dist-info → simplex_localmodels-0.1.0.dev32.dist-info}/WHEEL +0 -0
  581. /package/modules/{simplex_localmodels-0.1.0.dev31.dist-info → simplex_localmodels-0.1.0.dev32.dist-info}/entry_points.txt +0 -0
  582. /package/modules/{simplex_localmodels-0.1.0.dev31.dist-info → simplex_localmodels-0.1.0.dev32.dist-info}/licenses/NOTICE +0 -0
  583. /package/modules/{simplex_localmodels-0.1.0.dev31.dist-info → simplex_localmodels-0.1.0.dev32.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -1,1640 +0,0 @@
1
- """Ttk wrapper.
2
-
3
- This module provides classes to allow using Tk themed widget set.
4
-
5
- Ttk is based on a revised and enhanced version of
6
- TIP #48 (http://tip.tcl.tk/48) specified style engine.
7
-
8
- Its basic idea is to separate, to the extent possible, the code
9
- implementing a widget's behavior from the code implementing its
10
- appearance. Widget class bindings are primarily responsible for
11
- maintaining the widget state and invoking callbacks, all aspects
12
- of the widgets appearance lies at Themes.
13
- """
14
-
15
- __version__ = "0.3.1"
16
-
17
- __author__ = "Guilherme Polo <ggpolo@gmail.com>"
18
-
19
- __all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label",
20
- "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow",
21
- "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar",
22
- "Separator", "Sizegrip", "Spinbox", "Style", "Treeview",
23
- # Extensions
24
- "LabeledScale", "OptionMenu",
25
- # functions
26
- "tclobjs_to_py", "setup_master"]
27
-
28
- import tkinter
29
- from tkinter import _flatten, _join, _stringify, _splitdict
30
-
31
-
32
- def _format_optvalue(value, script=False):
33
- """Internal function."""
34
- if script:
35
- # if caller passes a Tcl script to tk.call, all the values need to
36
- # be grouped into words (arguments to a command in Tcl dialect)
37
- value = _stringify(value)
38
- elif isinstance(value, (list, tuple)):
39
- value = _join(value)
40
- return value
41
-
42
- def _format_optdict(optdict, script=False, ignore=None):
43
- """Formats optdict to a tuple to pass it to tk.call.
44
-
45
- E.g. (script=False):
46
- {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns:
47
- ('-foreground', 'blue', '-padding', '1 2 3 4')"""
48
-
49
- opts = []
50
- for opt, value in optdict.items():
51
- if not ignore or opt not in ignore:
52
- opts.append("-%s" % opt)
53
- if value is not None:
54
- opts.append(_format_optvalue(value, script))
55
-
56
- return _flatten(opts)
57
-
58
- def _mapdict_values(items):
59
- # each value in mapdict is expected to be a sequence, where each item
60
- # is another sequence containing a state (or several) and a value
61
- # E.g. (script=False):
62
- # [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]
63
- # returns:
64
- # ['active selected', 'grey', 'focus', [1, 2, 3, 4]]
65
- opt_val = []
66
- for *state, val in items:
67
- if len(state) == 1:
68
- # if it is empty (something that evaluates to False), then
69
- # format it to Tcl code to denote the "normal" state
70
- state = state[0] or ''
71
- else:
72
- # group multiple states
73
- state = ' '.join(state) # raise TypeError if not str
74
- opt_val.append(state)
75
- if val is not None:
76
- opt_val.append(val)
77
- return opt_val
78
-
79
- def _format_mapdict(mapdict, script=False):
80
- """Formats mapdict to pass it to tk.call.
81
-
82
- E.g. (script=False):
83
- {'expand': [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]}
84
-
85
- returns:
86
-
87
- ('-expand', '{active selected} grey focus {1, 2, 3, 4}')"""
88
-
89
- opts = []
90
- for opt, value in mapdict.items():
91
- opts.extend(("-%s" % opt,
92
- _format_optvalue(_mapdict_values(value), script)))
93
-
94
- return _flatten(opts)
95
-
96
- def _format_elemcreate(etype, script=False, *args, **kw):
97
- """Formats args and kw according to the given element factory etype."""
98
- spec = None
99
- opts = ()
100
- if etype in ("image", "vsapi"):
101
- if etype == "image": # define an element based on an image
102
- # first arg should be the default image name
103
- iname = args[0]
104
- # next args, if any, are statespec/value pairs which is almost
105
- # a mapdict, but we just need the value
106
- imagespec = _join(_mapdict_values(args[1:]))
107
- spec = "%s %s" % (iname, imagespec)
108
-
109
- else:
110
- # define an element whose visual appearance is drawn using the
111
- # Microsoft Visual Styles API which is responsible for the
112
- # themed styles on Windows XP and Vista.
113
- # Availability: Tk 8.6, Windows XP and Vista.
114
- class_name, part_id = args[:2]
115
- statemap = _join(_mapdict_values(args[2:]))
116
- spec = "%s %s %s" % (class_name, part_id, statemap)
117
-
118
- opts = _format_optdict(kw, script)
119
-
120
- elif etype == "from": # clone an element
121
- # it expects a themename and optionally an element to clone from,
122
- # otherwise it will clone {} (empty element)
123
- spec = args[0] # theme name
124
- if len(args) > 1: # elementfrom specified
125
- opts = (_format_optvalue(args[1], script),)
126
-
127
- if script:
128
- spec = '{%s}' % spec
129
- opts = ' '.join(opts)
130
-
131
- return spec, opts
132
-
133
- def _format_layoutlist(layout, indent=0, indent_size=2):
134
- """Formats a layout list so we can pass the result to ttk::style
135
- layout and ttk::style settings. Note that the layout doesn't have to
136
- be a list necessarily.
137
-
138
- E.g.:
139
- [("Menubutton.background", None),
140
- ("Menubutton.button", {"children":
141
- [("Menubutton.focus", {"children":
142
- [("Menubutton.padding", {"children":
143
- [("Menubutton.label", {"side": "left", "expand": 1})]
144
- })]
145
- })]
146
- }),
147
- ("Menubutton.indicator", {"side": "right"})
148
- ]
149
-
150
- returns:
151
-
152
- Menubutton.background
153
- Menubutton.button -children {
154
- Menubutton.focus -children {
155
- Menubutton.padding -children {
156
- Menubutton.label -side left -expand 1
157
- }
158
- }
159
- }
160
- Menubutton.indicator -side right"""
161
- script = []
162
-
163
- for layout_elem in layout:
164
- elem, opts = layout_elem
165
- opts = opts or {}
166
- fopts = ' '.join(_format_optdict(opts, True, ("children",)))
167
- head = "%s%s%s" % (' ' * indent, elem, (" %s" % fopts) if fopts else '')
168
-
169
- if "children" in opts:
170
- script.append(head + " -children {")
171
- indent += indent_size
172
- newscript, indent = _format_layoutlist(opts['children'], indent,
173
- indent_size)
174
- script.append(newscript)
175
- indent -= indent_size
176
- script.append('%s}' % (' ' * indent))
177
- else:
178
- script.append(head)
179
-
180
- return '\n'.join(script), indent
181
-
182
- def _script_from_settings(settings):
183
- """Returns an appropriate script, based on settings, according to
184
- theme_settings definition to be used by theme_settings and
185
- theme_create."""
186
- script = []
187
- # a script will be generated according to settings passed, which
188
- # will then be evaluated by Tcl
189
- for name, opts in settings.items():
190
- # will format specific keys according to Tcl code
191
- if opts.get('configure'): # format 'configure'
192
- s = ' '.join(_format_optdict(opts['configure'], True))
193
- script.append("ttk::style configure %s %s;" % (name, s))
194
-
195
- if opts.get('map'): # format 'map'
196
- s = ' '.join(_format_mapdict(opts['map'], True))
197
- script.append("ttk::style map %s %s;" % (name, s))
198
-
199
- if 'layout' in opts: # format 'layout' which may be empty
200
- if not opts['layout']:
201
- s = 'null' # could be any other word, but this one makes sense
202
- else:
203
- s, _ = _format_layoutlist(opts['layout'])
204
- script.append("ttk::style layout %s {\n%s\n}" % (name, s))
205
-
206
- if opts.get('element create'): # format 'element create'
207
- eopts = opts['element create']
208
- etype = eopts[0]
209
-
210
- # find where args end, and where kwargs start
211
- argc = 1 # etype was the first one
212
- while argc < len(eopts) and not hasattr(eopts[argc], 'items'):
213
- argc += 1
214
-
215
- elemargs = eopts[1:argc]
216
- elemkw = eopts[argc] if argc < len(eopts) and eopts[argc] else {}
217
- spec, opts = _format_elemcreate(etype, True, *elemargs, **elemkw)
218
-
219
- script.append("ttk::style element create %s %s %s %s" % (
220
- name, etype, spec, opts))
221
-
222
- return '\n'.join(script)
223
-
224
- def _list_from_statespec(stuple):
225
- """Construct a list from the given statespec tuple according to the
226
- accepted statespec accepted by _format_mapdict."""
227
- if isinstance(stuple, str):
228
- return stuple
229
- result = []
230
- it = iter(stuple)
231
- for state, val in zip(it, it):
232
- if hasattr(state, 'typename'): # this is a Tcl object
233
- state = str(state).split()
234
- elif isinstance(state, str):
235
- state = state.split()
236
- elif not isinstance(state, (tuple, list)):
237
- state = (state,)
238
- if hasattr(val, 'typename'):
239
- val = str(val)
240
- result.append((*state, val))
241
-
242
- return result
243
-
244
- def _list_from_layouttuple(tk, ltuple):
245
- """Construct a list from the tuple returned by ttk::layout, this is
246
- somewhat the reverse of _format_layoutlist."""
247
- ltuple = tk.splitlist(ltuple)
248
- res = []
249
-
250
- indx = 0
251
- while indx < len(ltuple):
252
- name = ltuple[indx]
253
- opts = {}
254
- res.append((name, opts))
255
- indx += 1
256
-
257
- while indx < len(ltuple): # grab name's options
258
- opt, val = ltuple[indx:indx + 2]
259
- if not opt.startswith('-'): # found next name
260
- break
261
-
262
- opt = opt[1:] # remove the '-' from the option
263
- indx += 2
264
-
265
- if opt == 'children':
266
- val = _list_from_layouttuple(tk, val)
267
-
268
- opts[opt] = val
269
-
270
- return res
271
-
272
- def _val_or_dict(tk, options, *args):
273
- """Format options then call Tk command with args and options and return
274
- the appropriate result.
275
-
276
- If no option is specified, a dict is returned. If an option is
277
- specified with the None value, the value for that option is returned.
278
- Otherwise, the function just sets the passed options and the caller
279
- shouldn't be expecting a return value anyway."""
280
- options = _format_optdict(options)
281
- res = tk.call(*(args + options))
282
-
283
- if len(options) % 2: # option specified without a value, return its value
284
- return res
285
-
286
- return _splitdict(tk, res, conv=_tclobj_to_py)
287
-
288
- def _convert_stringval(value):
289
- """Converts a value to, hopefully, a more appropriate Python object."""
290
- value = str(value)
291
- try:
292
- value = int(value)
293
- except (ValueError, TypeError):
294
- pass
295
-
296
- return value
297
-
298
- def _to_number(x):
299
- if isinstance(x, str):
300
- if '.' in x:
301
- x = float(x)
302
- else:
303
- x = int(x)
304
- return x
305
-
306
- def _tclobj_to_py(val):
307
- """Return value converted from Tcl object to Python object."""
308
- if val and hasattr(val, '__len__') and not isinstance(val, str):
309
- if getattr(val[0], 'typename', None) == 'StateSpec':
310
- val = _list_from_statespec(val)
311
- else:
312
- val = list(map(_convert_stringval, val))
313
-
314
- elif hasattr(val, 'typename'): # some other (single) Tcl object
315
- val = _convert_stringval(val)
316
-
317
- return val
318
-
319
- def tclobjs_to_py(adict):
320
- """Returns adict with its values converted from Tcl objects to Python
321
- objects."""
322
- for opt, val in adict.items():
323
- adict[opt] = _tclobj_to_py(val)
324
-
325
- return adict
326
-
327
- def setup_master(master=None):
328
- """If master is not None, itself is returned. If master is None,
329
- the default master is returned if there is one, otherwise a new
330
- master is created and returned.
331
-
332
- If it is not allowed to use the default root and master is None,
333
- RuntimeError is raised."""
334
- if master is None:
335
- master = tkinter._get_default_root()
336
- return master
337
-
338
-
339
- class Style(object):
340
- """Manipulate style database."""
341
-
342
- _name = "ttk::style"
343
-
344
- def __init__(self, master=None):
345
- master = setup_master(master)
346
- self.master = master
347
- self.tk = self.master.tk
348
-
349
-
350
- def configure(self, style, query_opt=None, **kw):
351
- """Query or sets the default value of the specified option(s) in
352
- style.
353
-
354
- Each key in kw is an option and each value is either a string or
355
- a sequence identifying the value for that option."""
356
- if query_opt is not None:
357
- kw[query_opt] = None
358
- result = _val_or_dict(self.tk, kw, self._name, "configure", style)
359
- if result or query_opt:
360
- return result
361
-
362
-
363
- def map(self, style, query_opt=None, **kw):
364
- """Query or sets dynamic values of the specified option(s) in
365
- style.
366
-
367
- Each key in kw is an option and each value should be a list or a
368
- tuple (usually) containing statespecs grouped in tuples, or list,
369
- or something else of your preference. A statespec is compound of
370
- one or more states and then a value."""
371
- if query_opt is not None:
372
- result = self.tk.call(self._name, "map", style, '-%s' % query_opt)
373
- return _list_from_statespec(self.tk.splitlist(result))
374
-
375
- result = self.tk.call(self._name, "map", style, *_format_mapdict(kw))
376
- return {k: _list_from_statespec(self.tk.splitlist(v))
377
- for k, v in _splitdict(self.tk, result).items()}
378
-
379
-
380
- def lookup(self, style, option, state=None, default=None):
381
- """Returns the value specified for option in style.
382
-
383
- If state is specified it is expected to be a sequence of one
384
- or more states. If the default argument is set, it is used as
385
- a fallback value in case no specification for option is found."""
386
- state = ' '.join(state) if state else ''
387
-
388
- return self.tk.call(self._name, "lookup", style, '-%s' % option,
389
- state, default)
390
-
391
-
392
- def layout(self, style, layoutspec=None):
393
- """Define the widget layout for given style. If layoutspec is
394
- omitted, return the layout specification for given style.
395
-
396
- layoutspec is expected to be a list or an object different than
397
- None that evaluates to False if you want to "turn off" that style.
398
- If it is a list (or tuple, or something else), each item should be
399
- a tuple where the first item is the layout name and the second item
400
- should have the format described below:
401
-
402
- LAYOUTS
403
-
404
- A layout can contain the value None, if takes no options, or
405
- a dict of options specifying how to arrange the element.
406
- The layout mechanism uses a simplified version of the pack
407
- geometry manager: given an initial cavity, each element is
408
- allocated a parcel. Valid options/values are:
409
-
410
- side: whichside
411
- Specifies which side of the cavity to place the
412
- element; one of top, right, bottom or left. If
413
- omitted, the element occupies the entire cavity.
414
-
415
- sticky: nswe
416
- Specifies where the element is placed inside its
417
- allocated parcel.
418
-
419
- children: [sublayout... ]
420
- Specifies a list of elements to place inside the
421
- element. Each element is a tuple (or other sequence)
422
- where the first item is the layout name, and the other
423
- is a LAYOUT."""
424
- lspec = None
425
- if layoutspec:
426
- lspec = _format_layoutlist(layoutspec)[0]
427
- elif layoutspec is not None: # will disable the layout ({}, '', etc)
428
- lspec = "null" # could be any other word, but this may make sense
429
- # when calling layout(style) later
430
-
431
- return _list_from_layouttuple(self.tk,
432
- self.tk.call(self._name, "layout", style, lspec))
433
-
434
-
435
- def element_create(self, elementname, etype, *args, **kw):
436
- """Create a new element in the current theme of given etype."""
437
- spec, opts = _format_elemcreate(etype, False, *args, **kw)
438
- self.tk.call(self._name, "element", "create", elementname, etype,
439
- spec, *opts)
440
-
441
-
442
- def element_names(self):
443
- """Returns the list of elements defined in the current theme."""
444
- return tuple(n.lstrip('-') for n in self.tk.splitlist(
445
- self.tk.call(self._name, "element", "names")))
446
-
447
-
448
- def element_options(self, elementname):
449
- """Return the list of elementname's options."""
450
- return tuple(o.lstrip('-') for o in self.tk.splitlist(
451
- self.tk.call(self._name, "element", "options", elementname)))
452
-
453
-
454
- def theme_create(self, themename, parent=None, settings=None):
455
- """Creates a new theme.
456
-
457
- It is an error if themename already exists. If parent is
458
- specified, the new theme will inherit styles, elements and
459
- layouts from the specified parent theme. If settings are present,
460
- they are expected to have the same syntax used for theme_settings."""
461
- script = _script_from_settings(settings) if settings else ''
462
-
463
- if parent:
464
- self.tk.call(self._name, "theme", "create", themename,
465
- "-parent", parent, "-settings", script)
466
- else:
467
- self.tk.call(self._name, "theme", "create", themename,
468
- "-settings", script)
469
-
470
-
471
- def theme_settings(self, themename, settings):
472
- """Temporarily sets the current theme to themename, apply specified
473
- settings and then restore the previous theme.
474
-
475
- Each key in settings is a style and each value may contain the
476
- keys 'configure', 'map', 'layout' and 'element create' and they
477
- are expected to have the same format as specified by the methods
478
- configure, map, layout and element_create respectively."""
479
- script = _script_from_settings(settings)
480
- self.tk.call(self._name, "theme", "settings", themename, script)
481
-
482
-
483
- def theme_names(self):
484
- """Returns a list of all known themes."""
485
- return self.tk.splitlist(self.tk.call(self._name, "theme", "names"))
486
-
487
-
488
- def theme_use(self, themename=None):
489
- """If themename is None, returns the theme in use, otherwise, set
490
- the current theme to themename, refreshes all widgets and emits
491
- a <<ThemeChanged>> event."""
492
- if themename is None:
493
- # Starting on Tk 8.6, checking this global is no longer needed
494
- # since it allows doing self.tk.call(self._name, "theme", "use")
495
- return self.tk.eval("return $ttk::currentTheme")
496
-
497
- # using "ttk::setTheme" instead of "ttk::style theme use" causes
498
- # the variable currentTheme to be updated, also, ttk::setTheme calls
499
- # "ttk::style theme use" in order to change theme.
500
- self.tk.call("ttk::setTheme", themename)
501
-
502
-
503
- class Widget(tkinter.Widget):
504
- """Base class for Tk themed widgets."""
505
-
506
- def __init__(self, master, widgetname, kw=None):
507
- """Constructs a Ttk Widget with the parent master.
508
-
509
- STANDARD OPTIONS
510
-
511
- class, cursor, takefocus, style
512
-
513
- SCROLLABLE WIDGET OPTIONS
514
-
515
- xscrollcommand, yscrollcommand
516
-
517
- LABEL WIDGET OPTIONS
518
-
519
- text, textvariable, underline, image, compound, width
520
-
521
- WIDGET STATES
522
-
523
- active, disabled, focus, pressed, selected, background,
524
- readonly, alternate, invalid
525
- """
526
- master = setup_master(master)
527
- tkinter.Widget.__init__(self, master, widgetname, kw=kw)
528
-
529
-
530
- def identify(self, x, y):
531
- """Returns the name of the element at position x, y, or the empty
532
- string if the point does not lie within any element.
533
-
534
- x and y are pixel coordinates relative to the widget."""
535
- return self.tk.call(self._w, "identify", x, y)
536
-
537
-
538
- def instate(self, statespec, callback=None, *args, **kw):
539
- """Test the widget's state.
540
-
541
- If callback is not specified, returns True if the widget state
542
- matches statespec and False otherwise. If callback is specified,
543
- then it will be invoked with *args, **kw if the widget state
544
- matches statespec. statespec is expected to be a sequence."""
545
- ret = self.tk.getboolean(
546
- self.tk.call(self._w, "instate", ' '.join(statespec)))
547
- if ret and callback is not None:
548
- return callback(*args, **kw)
549
-
550
- return ret
551
-
552
-
553
- def state(self, statespec=None):
554
- """Modify or inquire widget state.
555
-
556
- Widget state is returned if statespec is None, otherwise it is
557
- set according to the statespec flags and then a new state spec
558
- is returned indicating which flags were changed. statespec is
559
- expected to be a sequence."""
560
- if statespec is not None:
561
- statespec = ' '.join(statespec)
562
-
563
- return self.tk.splitlist(str(self.tk.call(self._w, "state", statespec)))
564
-
565
-
566
- class Button(Widget):
567
- """Ttk Button widget, displays a textual label and/or image, and
568
- evaluates a command when pressed."""
569
-
570
- def __init__(self, master=None, **kw):
571
- """Construct a Ttk Button widget with the parent master.
572
-
573
- STANDARD OPTIONS
574
-
575
- class, compound, cursor, image, state, style, takefocus,
576
- text, textvariable, underline, width
577
-
578
- WIDGET-SPECIFIC OPTIONS
579
-
580
- command, default, width
581
- """
582
- Widget.__init__(self, master, "ttk::button", kw)
583
-
584
-
585
- def invoke(self):
586
- """Invokes the command associated with the button."""
587
- return self.tk.call(self._w, "invoke")
588
-
589
-
590
- class Checkbutton(Widget):
591
- """Ttk Checkbutton widget which is either in on- or off-state."""
592
-
593
- def __init__(self, master=None, **kw):
594
- """Construct a Ttk Checkbutton widget with the parent master.
595
-
596
- STANDARD OPTIONS
597
-
598
- class, compound, cursor, image, state, style, takefocus,
599
- text, textvariable, underline, width
600
-
601
- WIDGET-SPECIFIC OPTIONS
602
-
603
- command, offvalue, onvalue, variable
604
- """
605
- Widget.__init__(self, master, "ttk::checkbutton", kw)
606
-
607
-
608
- def invoke(self):
609
- """Toggles between the selected and deselected states and
610
- invokes the associated command. If the widget is currently
611
- selected, sets the option variable to the offvalue option
612
- and deselects the widget; otherwise, sets the option variable
613
- to the option onvalue.
614
-
615
- Returns the result of the associated command."""
616
- return self.tk.call(self._w, "invoke")
617
-
618
-
619
- class Entry(Widget, tkinter.Entry):
620
- """Ttk Entry widget displays a one-line text string and allows that
621
- string to be edited by the user."""
622
-
623
- def __init__(self, master=None, widget=None, **kw):
624
- """Constructs a Ttk Entry widget with the parent master.
625
-
626
- STANDARD OPTIONS
627
-
628
- class, cursor, style, takefocus, xscrollcommand
629
-
630
- WIDGET-SPECIFIC OPTIONS
631
-
632
- exportselection, invalidcommand, justify, show, state,
633
- textvariable, validate, validatecommand, width
634
-
635
- VALIDATION MODES
636
-
637
- none, key, focus, focusin, focusout, all
638
- """
639
- Widget.__init__(self, master, widget or "ttk::entry", kw)
640
-
641
-
642
- def bbox(self, index):
643
- """Return a tuple of (x, y, width, height) which describes the
644
- bounding box of the character given by index."""
645
- return self._getints(self.tk.call(self._w, "bbox", index))
646
-
647
-
648
- def identify(self, x, y):
649
- """Returns the name of the element at position x, y, or the
650
- empty string if the coordinates are outside the window."""
651
- return self.tk.call(self._w, "identify", x, y)
652
-
653
-
654
- def validate(self):
655
- """Force revalidation, independent of the conditions specified
656
- by the validate option. Returns False if validation fails, True
657
- if it succeeds. Sets or clears the invalid state accordingly."""
658
- return self.tk.getboolean(self.tk.call(self._w, "validate"))
659
-
660
-
661
- class Combobox(Entry):
662
- """Ttk Combobox widget combines a text field with a pop-down list of
663
- values."""
664
-
665
- def __init__(self, master=None, **kw):
666
- """Construct a Ttk Combobox widget with the parent master.
667
-
668
- STANDARD OPTIONS
669
-
670
- class, cursor, style, takefocus
671
-
672
- WIDGET-SPECIFIC OPTIONS
673
-
674
- exportselection, justify, height, postcommand, state,
675
- textvariable, values, width
676
- """
677
- Entry.__init__(self, master, "ttk::combobox", **kw)
678
-
679
-
680
- def current(self, newindex=None):
681
- """If newindex is supplied, sets the combobox value to the
682
- element at position newindex in the list of values. Otherwise,
683
- returns the index of the current value in the list of values
684
- or -1 if the current value does not appear in the list."""
685
- if newindex is None:
686
- res = self.tk.call(self._w, "current")
687
- if res == '':
688
- return -1
689
- return self.tk.getint(res)
690
- return self.tk.call(self._w, "current", newindex)
691
-
692
-
693
- def set(self, value):
694
- """Sets the value of the combobox to value."""
695
- self.tk.call(self._w, "set", value)
696
-
697
-
698
- class Frame(Widget):
699
- """Ttk Frame widget is a container, used to group other widgets
700
- together."""
701
-
702
- def __init__(self, master=None, **kw):
703
- """Construct a Ttk Frame with parent master.
704
-
705
- STANDARD OPTIONS
706
-
707
- class, cursor, style, takefocus
708
-
709
- WIDGET-SPECIFIC OPTIONS
710
-
711
- borderwidth, relief, padding, width, height
712
- """
713
- Widget.__init__(self, master, "ttk::frame", kw)
714
-
715
-
716
- class Label(Widget):
717
- """Ttk Label widget displays a textual label and/or image."""
718
-
719
- def __init__(self, master=None, **kw):
720
- """Construct a Ttk Label with parent master.
721
-
722
- STANDARD OPTIONS
723
-
724
- class, compound, cursor, image, style, takefocus, text,
725
- textvariable, underline, width
726
-
727
- WIDGET-SPECIFIC OPTIONS
728
-
729
- anchor, background, font, foreground, justify, padding,
730
- relief, text, wraplength
731
- """
732
- Widget.__init__(self, master, "ttk::label", kw)
733
-
734
-
735
- class Labelframe(Widget):
736
- """Ttk Labelframe widget is a container used to group other widgets
737
- together. It has an optional label, which may be a plain text string
738
- or another widget."""
739
-
740
- def __init__(self, master=None, **kw):
741
- """Construct a Ttk Labelframe with parent master.
742
-
743
- STANDARD OPTIONS
744
-
745
- class, cursor, style, takefocus
746
-
747
- WIDGET-SPECIFIC OPTIONS
748
- labelanchor, text, underline, padding, labelwidget, width,
749
- height
750
- """
751
- Widget.__init__(self, master, "ttk::labelframe", kw)
752
-
753
- LabelFrame = Labelframe # tkinter name compatibility
754
-
755
-
756
- class Menubutton(Widget):
757
- """Ttk Menubutton widget displays a textual label and/or image, and
758
- displays a menu when pressed."""
759
-
760
- def __init__(self, master=None, **kw):
761
- """Construct a Ttk Menubutton with parent master.
762
-
763
- STANDARD OPTIONS
764
-
765
- class, compound, cursor, image, state, style, takefocus,
766
- text, textvariable, underline, width
767
-
768
- WIDGET-SPECIFIC OPTIONS
769
-
770
- direction, menu
771
- """
772
- Widget.__init__(self, master, "ttk::menubutton", kw)
773
-
774
-
775
- class Notebook(Widget):
776
- """Ttk Notebook widget manages a collection of windows and displays
777
- a single one at a time. Each child window is associated with a tab,
778
- which the user may select to change the currently-displayed window."""
779
-
780
- def __init__(self, master=None, **kw):
781
- """Construct a Ttk Notebook with parent master.
782
-
783
- STANDARD OPTIONS
784
-
785
- class, cursor, style, takefocus
786
-
787
- WIDGET-SPECIFIC OPTIONS
788
-
789
- height, padding, width
790
-
791
- TAB OPTIONS
792
-
793
- state, sticky, padding, text, image, compound, underline
794
-
795
- TAB IDENTIFIERS (tab_id)
796
-
797
- The tab_id argument found in several methods may take any of
798
- the following forms:
799
-
800
- * An integer between zero and the number of tabs
801
- * The name of a child window
802
- * A positional specification of the form "@x,y", which
803
- defines the tab
804
- * The string "current", which identifies the
805
- currently-selected tab
806
- * The string "end", which returns the number of tabs (only
807
- valid for method index)
808
- """
809
- Widget.__init__(self, master, "ttk::notebook", kw)
810
-
811
-
812
- def add(self, child, **kw):
813
- """Adds a new tab to the notebook.
814
-
815
- If window is currently managed by the notebook but hidden, it is
816
- restored to its previous position."""
817
- self.tk.call(self._w, "add", child, *(_format_optdict(kw)))
818
-
819
-
820
- def forget(self, tab_id):
821
- """Removes the tab specified by tab_id, unmaps and unmanages the
822
- associated window."""
823
- self.tk.call(self._w, "forget", tab_id)
824
-
825
-
826
- def hide(self, tab_id):
827
- """Hides the tab specified by tab_id.
828
-
829
- The tab will not be displayed, but the associated window remains
830
- managed by the notebook and its configuration remembered. Hidden
831
- tabs may be restored with the add command."""
832
- self.tk.call(self._w, "hide", tab_id)
833
-
834
-
835
- def identify(self, x, y):
836
- """Returns the name of the tab element at position x, y, or the
837
- empty string if none."""
838
- return self.tk.call(self._w, "identify", x, y)
839
-
840
-
841
- def index(self, tab_id):
842
- """Returns the numeric index of the tab specified by tab_id, or
843
- the total number of tabs if tab_id is the string "end"."""
844
- return self.tk.getint(self.tk.call(self._w, "index", tab_id))
845
-
846
-
847
- def insert(self, pos, child, **kw):
848
- """Inserts a pane at the specified position.
849
-
850
- pos is either the string end, an integer index, or the name of
851
- a managed child. If child is already managed by the notebook,
852
- moves it to the specified position."""
853
- self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw)))
854
-
855
-
856
- def select(self, tab_id=None):
857
- """Selects the specified tab.
858
-
859
- The associated child window will be displayed, and the
860
- previously-selected window (if different) is unmapped. If tab_id
861
- is omitted, returns the widget name of the currently selected
862
- pane."""
863
- return self.tk.call(self._w, "select", tab_id)
864
-
865
-
866
- def tab(self, tab_id, option=None, **kw):
867
- """Query or modify the options of the specific tab_id.
868
-
869
- If kw is not given, returns a dict of the tab option values. If option
870
- is specified, returns the value of that option. Otherwise, sets the
871
- options to the corresponding values."""
872
- if option is not None:
873
- kw[option] = None
874
- return _val_or_dict(self.tk, kw, self._w, "tab", tab_id)
875
-
876
-
877
- def tabs(self):
878
- """Returns a list of windows managed by the notebook."""
879
- return self.tk.splitlist(self.tk.call(self._w, "tabs") or ())
880
-
881
-
882
- def enable_traversal(self):
883
- """Enable keyboard traversal for a toplevel window containing
884
- this notebook.
885
-
886
- This will extend the bindings for the toplevel window containing
887
- this notebook as follows:
888
-
889
- Control-Tab: selects the tab following the currently selected
890
- one
891
-
892
- Shift-Control-Tab: selects the tab preceding the currently
893
- selected one
894
-
895
- Alt-K: where K is the mnemonic (underlined) character of any
896
- tab, will select that tab.
897
-
898
- Multiple notebooks in a single toplevel may be enabled for
899
- traversal, including nested notebooks. However, notebook traversal
900
- only works properly if all panes are direct children of the
901
- notebook."""
902
- # The only, and good, difference I see is about mnemonics, which works
903
- # after calling this method. Control-Tab and Shift-Control-Tab always
904
- # works (here at least).
905
- self.tk.call("ttk::notebook::enableTraversal", self._w)
906
-
907
-
908
- class Panedwindow(Widget, tkinter.PanedWindow):
909
- """Ttk Panedwindow widget displays a number of subwindows, stacked
910
- either vertically or horizontally."""
911
-
912
- def __init__(self, master=None, **kw):
913
- """Construct a Ttk Panedwindow with parent master.
914
-
915
- STANDARD OPTIONS
916
-
917
- class, cursor, style, takefocus
918
-
919
- WIDGET-SPECIFIC OPTIONS
920
-
921
- orient, width, height
922
-
923
- PANE OPTIONS
924
-
925
- weight
926
- """
927
- Widget.__init__(self, master, "ttk::panedwindow", kw)
928
-
929
-
930
- forget = tkinter.PanedWindow.forget # overrides Pack.forget
931
-
932
-
933
- def insert(self, pos, child, **kw):
934
- """Inserts a pane at the specified positions.
935
-
936
- pos is either the string end, and integer index, or the name
937
- of a child. If child is already managed by the paned window,
938
- moves it to the specified position."""
939
- self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw)))
940
-
941
-
942
- def pane(self, pane, option=None, **kw):
943
- """Query or modify the options of the specified pane.
944
-
945
- pane is either an integer index or the name of a managed subwindow.
946
- If kw is not given, returns a dict of the pane option values. If
947
- option is specified then the value for that option is returned.
948
- Otherwise, sets the options to the corresponding values."""
949
- if option is not None:
950
- kw[option] = None
951
- return _val_or_dict(self.tk, kw, self._w, "pane", pane)
952
-
953
-
954
- def sashpos(self, index, newpos=None):
955
- """If newpos is specified, sets the position of sash number index.
956
-
957
- May adjust the positions of adjacent sashes to ensure that
958
- positions are monotonically increasing. Sash positions are further
959
- constrained to be between 0 and the total size of the widget.
960
-
961
- Returns the new position of sash number index."""
962
- return self.tk.getint(self.tk.call(self._w, "sashpos", index, newpos))
963
-
964
- PanedWindow = Panedwindow # tkinter name compatibility
965
-
966
-
967
- class Progressbar(Widget):
968
- """Ttk Progressbar widget shows the status of a long-running
969
- operation. They can operate in two modes: determinate mode shows the
970
- amount completed relative to the total amount of work to be done, and
971
- indeterminate mode provides an animated display to let the user know
972
- that something is happening."""
973
-
974
- def __init__(self, master=None, **kw):
975
- """Construct a Ttk Progressbar with parent master.
976
-
977
- STANDARD OPTIONS
978
-
979
- class, cursor, style, takefocus
980
-
981
- WIDGET-SPECIFIC OPTIONS
982
-
983
- orient, length, mode, maximum, value, variable, phase
984
- """
985
- Widget.__init__(self, master, "ttk::progressbar", kw)
986
-
987
-
988
- def start(self, interval=None):
989
- """Begin autoincrement mode: schedules a recurring timer event
990
- that calls method step every interval milliseconds.
991
-
992
- interval defaults to 50 milliseconds (20 steps/second) if omitted."""
993
- self.tk.call(self._w, "start", interval)
994
-
995
-
996
- def step(self, amount=None):
997
- """Increments the value option by amount.
998
-
999
- amount defaults to 1.0 if omitted."""
1000
- self.tk.call(self._w, "step", amount)
1001
-
1002
-
1003
- def stop(self):
1004
- """Stop autoincrement mode: cancels any recurring timer event
1005
- initiated by start."""
1006
- self.tk.call(self._w, "stop")
1007
-
1008
-
1009
- class Radiobutton(Widget):
1010
- """Ttk Radiobutton widgets are used in groups to show or change a
1011
- set of mutually-exclusive options."""
1012
-
1013
- def __init__(self, master=None, **kw):
1014
- """Construct a Ttk Radiobutton with parent master.
1015
-
1016
- STANDARD OPTIONS
1017
-
1018
- class, compound, cursor, image, state, style, takefocus,
1019
- text, textvariable, underline, width
1020
-
1021
- WIDGET-SPECIFIC OPTIONS
1022
-
1023
- command, value, variable
1024
- """
1025
- Widget.__init__(self, master, "ttk::radiobutton", kw)
1026
-
1027
-
1028
- def invoke(self):
1029
- """Sets the option variable to the option value, selects the
1030
- widget, and invokes the associated command.
1031
-
1032
- Returns the result of the command, or an empty string if
1033
- no command is specified."""
1034
- return self.tk.call(self._w, "invoke")
1035
-
1036
-
1037
- class Scale(Widget, tkinter.Scale):
1038
- """Ttk Scale widget is typically used to control the numeric value of
1039
- a linked variable that varies uniformly over some range."""
1040
-
1041
- def __init__(self, master=None, **kw):
1042
- """Construct a Ttk Scale with parent master.
1043
-
1044
- STANDARD OPTIONS
1045
-
1046
- class, cursor, style, takefocus
1047
-
1048
- WIDGET-SPECIFIC OPTIONS
1049
-
1050
- command, from, length, orient, to, value, variable
1051
- """
1052
- Widget.__init__(self, master, "ttk::scale", kw)
1053
-
1054
-
1055
- def configure(self, cnf=None, **kw):
1056
- """Modify or query scale options.
1057
-
1058
- Setting a value for any of the "from", "from_" or "to" options
1059
- generates a <<RangeChanged>> event."""
1060
- retval = Widget.configure(self, cnf, **kw)
1061
- if not isinstance(cnf, (type(None), str)):
1062
- kw.update(cnf)
1063
- if any(['from' in kw, 'from_' in kw, 'to' in kw]):
1064
- self.event_generate('<<RangeChanged>>')
1065
- return retval
1066
-
1067
-
1068
- def get(self, x=None, y=None):
1069
- """Get the current value of the value option, or the value
1070
- corresponding to the coordinates x, y if they are specified.
1071
-
1072
- x and y are pixel coordinates relative to the scale widget
1073
- origin."""
1074
- return self.tk.call(self._w, 'get', x, y)
1075
-
1076
-
1077
- class Scrollbar(Widget, tkinter.Scrollbar):
1078
- """Ttk Scrollbar controls the viewport of a scrollable widget."""
1079
-
1080
- def __init__(self, master=None, **kw):
1081
- """Construct a Ttk Scrollbar with parent master.
1082
-
1083
- STANDARD OPTIONS
1084
-
1085
- class, cursor, style, takefocus
1086
-
1087
- WIDGET-SPECIFIC OPTIONS
1088
-
1089
- command, orient
1090
- """
1091
- Widget.__init__(self, master, "ttk::scrollbar", kw)
1092
-
1093
-
1094
- class Separator(Widget):
1095
- """Ttk Separator widget displays a horizontal or vertical separator
1096
- bar."""
1097
-
1098
- def __init__(self, master=None, **kw):
1099
- """Construct a Ttk Separator with parent master.
1100
-
1101
- STANDARD OPTIONS
1102
-
1103
- class, cursor, style, takefocus
1104
-
1105
- WIDGET-SPECIFIC OPTIONS
1106
-
1107
- orient
1108
- """
1109
- Widget.__init__(self, master, "ttk::separator", kw)
1110
-
1111
-
1112
- class Sizegrip(Widget):
1113
- """Ttk Sizegrip allows the user to resize the containing toplevel
1114
- window by pressing and dragging the grip."""
1115
-
1116
- def __init__(self, master=None, **kw):
1117
- """Construct a Ttk Sizegrip with parent master.
1118
-
1119
- STANDARD OPTIONS
1120
-
1121
- class, cursor, state, style, takefocus
1122
- """
1123
- Widget.__init__(self, master, "ttk::sizegrip", kw)
1124
-
1125
-
1126
- class Spinbox(Entry):
1127
- """Ttk Spinbox is an Entry with increment and decrement arrows
1128
-
1129
- It is commonly used for number entry or to select from a list of
1130
- string values.
1131
- """
1132
-
1133
- def __init__(self, master=None, **kw):
1134
- """Construct a Ttk Spinbox widget with the parent master.
1135
-
1136
- STANDARD OPTIONS
1137
-
1138
- class, cursor, style, takefocus, validate,
1139
- validatecommand, xscrollcommand, invalidcommand
1140
-
1141
- WIDGET-SPECIFIC OPTIONS
1142
-
1143
- to, from_, increment, values, wrap, format, command
1144
- """
1145
- Entry.__init__(self, master, "ttk::spinbox", **kw)
1146
-
1147
-
1148
- def set(self, value):
1149
- """Sets the value of the Spinbox to value."""
1150
- self.tk.call(self._w, "set", value)
1151
-
1152
-
1153
- class Treeview(Widget, tkinter.XView, tkinter.YView):
1154
- """Ttk Treeview widget displays a hierarchical collection of items.
1155
-
1156
- Each item has a textual label, an optional image, and an optional list
1157
- of data values. The data values are displayed in successive columns
1158
- after the tree label."""
1159
-
1160
- def __init__(self, master=None, **kw):
1161
- """Construct a Ttk Treeview with parent master.
1162
-
1163
- STANDARD OPTIONS
1164
-
1165
- class, cursor, style, takefocus, xscrollcommand,
1166
- yscrollcommand
1167
-
1168
- WIDGET-SPECIFIC OPTIONS
1169
-
1170
- columns, displaycolumns, height, padding, selectmode, show
1171
-
1172
- ITEM OPTIONS
1173
-
1174
- text, image, values, open, tags
1175
-
1176
- TAG OPTIONS
1177
-
1178
- foreground, background, font, image
1179
- """
1180
- Widget.__init__(self, master, "ttk::treeview", kw)
1181
-
1182
-
1183
- def bbox(self, item, column=None):
1184
- """Returns the bounding box (relative to the treeview widget's
1185
- window) of the specified item in the form x y width height.
1186
-
1187
- If column is specified, returns the bounding box of that cell.
1188
- If the item is not visible (i.e., if it is a descendant of a
1189
- closed item or is scrolled offscreen), returns an empty string."""
1190
- return self._getints(self.tk.call(self._w, "bbox", item, column)) or ''
1191
-
1192
-
1193
- def get_children(self, item=None):
1194
- """Returns a tuple of children belonging to item.
1195
-
1196
- If item is not specified, returns root children."""
1197
- return self.tk.splitlist(
1198
- self.tk.call(self._w, "children", item or '') or ())
1199
-
1200
-
1201
- def set_children(self, item, *newchildren):
1202
- """Replaces item's child with newchildren.
1203
-
1204
- Children present in item that are not present in newchildren
1205
- are detached from tree. No items in newchildren may be an
1206
- ancestor of item."""
1207
- self.tk.call(self._w, "children", item, newchildren)
1208
-
1209
-
1210
- def column(self, column, option=None, **kw):
1211
- """Query or modify the options for the specified column.
1212
-
1213
- If kw is not given, returns a dict of the column option values. If
1214
- option is specified then the value for that option is returned.
1215
- Otherwise, sets the options to the corresponding values."""
1216
- if option is not None:
1217
- kw[option] = None
1218
- return _val_or_dict(self.tk, kw, self._w, "column", column)
1219
-
1220
-
1221
- def delete(self, *items):
1222
- """Delete all specified items and all their descendants. The root
1223
- item may not be deleted."""
1224
- self.tk.call(self._w, "delete", items)
1225
-
1226
-
1227
- def detach(self, *items):
1228
- """Unlinks all of the specified items from the tree.
1229
-
1230
- The items and all of their descendants are still present, and may
1231
- be reinserted at another point in the tree, but will not be
1232
- displayed. The root item may not be detached."""
1233
- self.tk.call(self._w, "detach", items)
1234
-
1235
-
1236
- def exists(self, item):
1237
- """Returns True if the specified item is present in the tree,
1238
- False otherwise."""
1239
- return self.tk.getboolean(self.tk.call(self._w, "exists", item))
1240
-
1241
-
1242
- def focus(self, item=None):
1243
- """If item is specified, sets the focus item to item. Otherwise,
1244
- returns the current focus item, or '' if there is none."""
1245
- return self.tk.call(self._w, "focus", item)
1246
-
1247
-
1248
- def heading(self, column, option=None, **kw):
1249
- """Query or modify the heading options for the specified column.
1250
-
1251
- If kw is not given, returns a dict of the heading option values. If
1252
- option is specified then the value for that option is returned.
1253
- Otherwise, sets the options to the corresponding values.
1254
-
1255
- Valid options/values are:
1256
- text: text
1257
- The text to display in the column heading
1258
- image: image_name
1259
- Specifies an image to display to the right of the column
1260
- heading
1261
- anchor: anchor
1262
- Specifies how the heading text should be aligned. One of
1263
- the standard Tk anchor values
1264
- command: callback
1265
- A callback to be invoked when the heading label is
1266
- pressed.
1267
-
1268
- To configure the tree column heading, call this with column = "#0" """
1269
- cmd = kw.get('command')
1270
- if cmd and not isinstance(cmd, str):
1271
- # callback not registered yet, do it now
1272
- kw['command'] = self.master.register(cmd, self._substitute)
1273
-
1274
- if option is not None:
1275
- kw[option] = None
1276
-
1277
- return _val_or_dict(self.tk, kw, self._w, 'heading', column)
1278
-
1279
-
1280
- def identify(self, component, x, y):
1281
- """Returns a description of the specified component under the
1282
- point given by x and y, or the empty string if no such component
1283
- is present at that position."""
1284
- return self.tk.call(self._w, "identify", component, x, y)
1285
-
1286
-
1287
- def identify_row(self, y):
1288
- """Returns the item ID of the item at position y."""
1289
- return self.identify("row", 0, y)
1290
-
1291
-
1292
- def identify_column(self, x):
1293
- """Returns the data column identifier of the cell at position x.
1294
-
1295
- The tree column has ID #0."""
1296
- return self.identify("column", x, 0)
1297
-
1298
-
1299
- def identify_region(self, x, y):
1300
- """Returns one of:
1301
-
1302
- heading: Tree heading area.
1303
- separator: Space between two columns headings;
1304
- tree: The tree area.
1305
- cell: A data cell.
1306
-
1307
- * Availability: Tk 8.6"""
1308
- return self.identify("region", x, y)
1309
-
1310
-
1311
- def identify_element(self, x, y):
1312
- """Returns the element at position x, y.
1313
-
1314
- * Availability: Tk 8.6"""
1315
- return self.identify("element", x, y)
1316
-
1317
-
1318
- def index(self, item):
1319
- """Returns the integer index of item within its parent's list
1320
- of children."""
1321
- return self.tk.getint(self.tk.call(self._w, "index", item))
1322
-
1323
-
1324
- def insert(self, parent, index, iid=None, **kw):
1325
- """Creates a new item and return the item identifier of the newly
1326
- created item.
1327
-
1328
- parent is the item ID of the parent item, or the empty string
1329
- to create a new top-level item. index is an integer, or the value
1330
- end, specifying where in the list of parent's children to insert
1331
- the new item. If index is less than or equal to zero, the new node
1332
- is inserted at the beginning, if index is greater than or equal to
1333
- the current number of children, it is inserted at the end. If iid
1334
- is specified, it is used as the item identifier, iid must not
1335
- already exist in the tree. Otherwise, a new unique identifier
1336
- is generated."""
1337
- opts = _format_optdict(kw)
1338
- if iid is not None:
1339
- res = self.tk.call(self._w, "insert", parent, index,
1340
- "-id", iid, *opts)
1341
- else:
1342
- res = self.tk.call(self._w, "insert", parent, index, *opts)
1343
-
1344
- return res
1345
-
1346
-
1347
- def item(self, item, option=None, **kw):
1348
- """Query or modify the options for the specified item.
1349
-
1350
- If no options are given, a dict with options/values for the item
1351
- is returned. If option is specified then the value for that option
1352
- is returned. Otherwise, sets the options to the corresponding
1353
- values as given by kw."""
1354
- if option is not None:
1355
- kw[option] = None
1356
- return _val_or_dict(self.tk, kw, self._w, "item", item)
1357
-
1358
-
1359
- def move(self, item, parent, index):
1360
- """Moves item to position index in parent's list of children.
1361
-
1362
- It is illegal to move an item under one of its descendants. If
1363
- index is less than or equal to zero, item is moved to the
1364
- beginning, if greater than or equal to the number of children,
1365
- it is moved to the end. If item was detached it is reattached."""
1366
- self.tk.call(self._w, "move", item, parent, index)
1367
-
1368
- reattach = move # A sensible method name for reattaching detached items
1369
-
1370
-
1371
- def next(self, item):
1372
- """Returns the identifier of item's next sibling, or '' if item
1373
- is the last child of its parent."""
1374
- return self.tk.call(self._w, "next", item)
1375
-
1376
-
1377
- def parent(self, item):
1378
- """Returns the ID of the parent of item, or '' if item is at the
1379
- top level of the hierarchy."""
1380
- return self.tk.call(self._w, "parent", item)
1381
-
1382
-
1383
- def prev(self, item):
1384
- """Returns the identifier of item's previous sibling, or '' if
1385
- item is the first child of its parent."""
1386
- return self.tk.call(self._w, "prev", item)
1387
-
1388
-
1389
- def see(self, item):
1390
- """Ensure that item is visible.
1391
-
1392
- Sets all of item's ancestors open option to True, and scrolls
1393
- the widget if necessary so that item is within the visible
1394
- portion of the tree."""
1395
- self.tk.call(self._w, "see", item)
1396
-
1397
-
1398
- def selection(self):
1399
- """Returns the tuple of selected items."""
1400
- return self.tk.splitlist(self.tk.call(self._w, "selection"))
1401
-
1402
-
1403
- def _selection(self, selop, items):
1404
- if len(items) == 1 and isinstance(items[0], (tuple, list)):
1405
- items = items[0]
1406
-
1407
- self.tk.call(self._w, "selection", selop, items)
1408
-
1409
-
1410
- def selection_set(self, *items):
1411
- """The specified items becomes the new selection."""
1412
- self._selection("set", items)
1413
-
1414
-
1415
- def selection_add(self, *items):
1416
- """Add all of the specified items to the selection."""
1417
- self._selection("add", items)
1418
-
1419
-
1420
- def selection_remove(self, *items):
1421
- """Remove all of the specified items from the selection."""
1422
- self._selection("remove", items)
1423
-
1424
-
1425
- def selection_toggle(self, *items):
1426
- """Toggle the selection state of each specified item."""
1427
- self._selection("toggle", items)
1428
-
1429
-
1430
- def set(self, item, column=None, value=None):
1431
- """Query or set the value of given item.
1432
-
1433
- With one argument, return a dictionary of column/value pairs
1434
- for the specified item. With two arguments, return the current
1435
- value of the specified column. With three arguments, set the
1436
- value of given column in given item to the specified value."""
1437
- res = self.tk.call(self._w, "set", item, column, value)
1438
- if column is None and value is None:
1439
- return _splitdict(self.tk, res,
1440
- cut_minus=False, conv=_tclobj_to_py)
1441
- else:
1442
- return res
1443
-
1444
-
1445
- def tag_bind(self, tagname, sequence=None, callback=None):
1446
- """Bind a callback for the given event sequence to the tag tagname.
1447
- When an event is delivered to an item, the callbacks for each
1448
- of the item's tags option are called."""
1449
- self._bind((self._w, "tag", "bind", tagname), sequence, callback, add=0)
1450
-
1451
-
1452
- def tag_configure(self, tagname, option=None, **kw):
1453
- """Query or modify the options for the specified tagname.
1454
-
1455
- If kw is not given, returns a dict of the option settings for tagname.
1456
- If option is specified, returns the value for that option for the
1457
- specified tagname. Otherwise, sets the options to the corresponding
1458
- values for the given tagname."""
1459
- if option is not None:
1460
- kw[option] = None
1461
- return _val_or_dict(self.tk, kw, self._w, "tag", "configure",
1462
- tagname)
1463
-
1464
-
1465
- def tag_has(self, tagname, item=None):
1466
- """If item is specified, returns 1 or 0 depending on whether the
1467
- specified item has the given tagname. Otherwise, returns a list of
1468
- all items which have the specified tag.
1469
-
1470
- * Availability: Tk 8.6"""
1471
- if item is None:
1472
- return self.tk.splitlist(
1473
- self.tk.call(self._w, "tag", "has", tagname))
1474
- else:
1475
- return self.tk.getboolean(
1476
- self.tk.call(self._w, "tag", "has", tagname, item))
1477
-
1478
-
1479
- # Extensions
1480
-
1481
- class LabeledScale(Frame):
1482
- """A Ttk Scale widget with a Ttk Label widget indicating its
1483
- current value.
1484
-
1485
- The Ttk Scale can be accessed through instance.scale, and Ttk Label
1486
- can be accessed through instance.label"""
1487
-
1488
- def __init__(self, master=None, variable=None, from_=0, to=10, **kw):
1489
- """Construct a horizontal LabeledScale with parent master, a
1490
- variable to be associated with the Ttk Scale widget and its range.
1491
- If variable is not specified, a tkinter.IntVar is created.
1492
-
1493
- WIDGET-SPECIFIC OPTIONS
1494
-
1495
- compound: 'top' or 'bottom'
1496
- Specifies how to display the label relative to the scale.
1497
- Defaults to 'top'.
1498
- """
1499
- self._label_top = kw.pop('compound', 'top') == 'top'
1500
-
1501
- Frame.__init__(self, master, **kw)
1502
- self._variable = variable or tkinter.IntVar(master)
1503
- self._variable.set(from_)
1504
- self._last_valid = from_
1505
-
1506
- self.label = Label(self)
1507
- self.scale = Scale(self, variable=self._variable, from_=from_, to=to)
1508
- self.scale.bind('<<RangeChanged>>', self._adjust)
1509
-
1510
- # position scale and label according to the compound option
1511
- scale_side = 'bottom' if self._label_top else 'top'
1512
- label_side = 'top' if scale_side == 'bottom' else 'bottom'
1513
- self.scale.pack(side=scale_side, fill='x')
1514
- # Dummy required to make frame correct height
1515
- dummy = Label(self)
1516
- dummy.pack(side=label_side)
1517
- dummy.lower()
1518
- self.label.place(anchor='n' if label_side == 'top' else 's')
1519
-
1520
- # update the label as scale or variable changes
1521
- self.__tracecb = self._variable.trace_add('write', self._adjust)
1522
- self.bind('<Configure>', self._adjust)
1523
- self.bind('<Map>', self._adjust)
1524
-
1525
-
1526
- def destroy(self):
1527
- """Destroy this widget and possibly its associated variable."""
1528
- try:
1529
- self._variable.trace_remove('write', self.__tracecb)
1530
- except AttributeError:
1531
- pass
1532
- else:
1533
- del self._variable
1534
- super().destroy()
1535
- self.label = None
1536
- self.scale = None
1537
-
1538
-
1539
- def _adjust(self, *args):
1540
- """Adjust the label position according to the scale."""
1541
- def adjust_label():
1542
- self.update_idletasks() # "force" scale redraw
1543
-
1544
- x, y = self.scale.coords()
1545
- if self._label_top:
1546
- y = self.scale.winfo_y() - self.label.winfo_reqheight()
1547
- else:
1548
- y = self.scale.winfo_reqheight() + self.label.winfo_reqheight()
1549
-
1550
- self.label.place_configure(x=x, y=y)
1551
-
1552
- from_ = _to_number(self.scale['from'])
1553
- to = _to_number(self.scale['to'])
1554
- if to < from_:
1555
- from_, to = to, from_
1556
- newval = self._variable.get()
1557
- if not from_ <= newval <= to:
1558
- # value outside range, set value back to the last valid one
1559
- self.value = self._last_valid
1560
- return
1561
-
1562
- self._last_valid = newval
1563
- self.label['text'] = newval
1564
- self.after_idle(adjust_label)
1565
-
1566
- @property
1567
- def value(self):
1568
- """Return current scale value."""
1569
- return self._variable.get()
1570
-
1571
- @value.setter
1572
- def value(self, val):
1573
- """Set new scale value."""
1574
- self._variable.set(val)
1575
-
1576
-
1577
- class OptionMenu(Menubutton):
1578
- """Themed OptionMenu, based after tkinter's OptionMenu, which allows
1579
- the user to select a value from a menu."""
1580
-
1581
- def __init__(self, master, variable, default=None, *values, **kwargs):
1582
- """Construct a themed OptionMenu widget with master as the parent,
1583
- the resource textvariable set to variable, the initially selected
1584
- value specified by the default parameter, the menu values given by
1585
- *values and additional keywords.
1586
-
1587
- WIDGET-SPECIFIC OPTIONS
1588
-
1589
- style: stylename
1590
- Menubutton style.
1591
- direction: 'above', 'below', 'left', 'right', or 'flush'
1592
- Menubutton direction.
1593
- command: callback
1594
- A callback that will be invoked after selecting an item.
1595
- """
1596
- kw = {'textvariable': variable, 'style': kwargs.pop('style', None),
1597
- 'direction': kwargs.pop('direction', None)}
1598
- Menubutton.__init__(self, master, **kw)
1599
- self['menu'] = tkinter.Menu(self, tearoff=False)
1600
-
1601
- self._variable = variable
1602
- self._callback = kwargs.pop('command', None)
1603
- if kwargs:
1604
- raise tkinter.TclError('unknown option -%s' % (
1605
- next(iter(kwargs.keys()))))
1606
-
1607
- self.set_menu(default, *values)
1608
-
1609
-
1610
- def __getitem__(self, item):
1611
- if item == 'menu':
1612
- return self.nametowidget(Menubutton.__getitem__(self, item))
1613
-
1614
- return Menubutton.__getitem__(self, item)
1615
-
1616
-
1617
- def set_menu(self, default=None, *values):
1618
- """Build a new menu of radiobuttons with *values and optionally
1619
- a default value."""
1620
- menu = self['menu']
1621
- menu.delete(0, 'end')
1622
- for val in values:
1623
- menu.add_radiobutton(label=val,
1624
- command=(
1625
- None if self._callback is None
1626
- else lambda val=val: self._callback(val)
1627
- ),
1628
- variable=self._variable)
1629
-
1630
- if default:
1631
- self._variable.set(default)
1632
-
1633
-
1634
- def destroy(self):
1635
- """Destroy this widget and its associated variable."""
1636
- try:
1637
- del self._variable
1638
- except AttributeError:
1639
- pass
1640
- super().destroy()