wxPython 4.3.2__cp315-cp315-win_amd64.whl

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 (472) hide show
  1. wx/WebView2Loader.dll +0 -0
  2. wx/__init__.py +22 -0
  3. wx/__init__.pyi +10 -0
  4. wx/__version__.py +9 -0
  5. wx/__version__.pyi +15 -0
  6. wx/_adv.cp315-win_amd64.pyd +0 -0
  7. wx/_aui.cp315-win_amd64.pyd +0 -0
  8. wx/_core.cp315-win_amd64.pyd +0 -0
  9. wx/_dataview.cp315-win_amd64.pyd +0 -0
  10. wx/_glcanvas.cp315-win_amd64.pyd +0 -0
  11. wx/_grid.cp315-win_amd64.pyd +0 -0
  12. wx/_html.cp315-win_amd64.pyd +0 -0
  13. wx/_html2.cp315-win_amd64.pyd +0 -0
  14. wx/_media.cp315-win_amd64.pyd +0 -0
  15. wx/_msw.cp315-win_amd64.pyd +0 -0
  16. wx/_propgrid.cp315-win_amd64.pyd +0 -0
  17. wx/_ribbon.cp315-win_amd64.pyd +0 -0
  18. wx/_richtext.cp315-win_amd64.pyd +0 -0
  19. wx/_stc.cp315-win_amd64.pyd +0 -0
  20. wx/_xml.cp315-win_amd64.pyd +0 -0
  21. wx/_xrc.cp315-win_amd64.pyd +0 -0
  22. wx/adv.py +127 -0
  23. wx/adv.pyi +5931 -0
  24. wx/aui.py +70 -0
  25. wx/aui.pyi +4805 -0
  26. wx/core.py +3417 -0
  27. wx/core.pyi +62949 -0
  28. wx/dataview.py +176 -0
  29. wx/dataview.pyi +3828 -0
  30. wx/gizmos.py +18 -0
  31. wx/glcanvas.py +13 -0
  32. wx/glcanvas.pyi +544 -0
  33. wx/grid.py +237 -0
  34. wx/grid.pyi +5678 -0
  35. wx/html.py +38 -0
  36. wx/html.pyi +3283 -0
  37. wx/html2.py +46 -0
  38. wx/html2.pyi +1301 -0
  39. wx/include/wxPython/sip.h +1938 -0
  40. wx/include/wxPython/wxpy_api.h +418 -0
  41. wx/lib/CDate.py +201 -0
  42. wx/lib/ClickableHtmlWindow.py +57 -0
  43. wx/lib/__init__.py +0 -0
  44. wx/lib/activex.py +178 -0
  45. wx/lib/activexwrapper.py +153 -0
  46. wx/lib/agw/__init__.py +128 -0
  47. wx/lib/agw/advancedsplash.py +563 -0
  48. wx/lib/agw/aquabutton.py +1127 -0
  49. wx/lib/agw/artmanager.py +2110 -0
  50. wx/lib/agw/aui/__init__.py +295 -0
  51. wx/lib/agw/aui/aui_constants.py +2616 -0
  52. wx/lib/agw/aui/aui_switcherdialog.py +1232 -0
  53. wx/lib/agw/aui/aui_utilities.py +648 -0
  54. wx/lib/agw/aui/auibar.py +4045 -0
  55. wx/lib/agw/aui/auibook.py +6288 -0
  56. wx/lib/agw/aui/dockart.py +1198 -0
  57. wx/lib/agw/aui/framemanager.py +10485 -0
  58. wx/lib/agw/aui/tabart.py +2749 -0
  59. wx/lib/agw/aui/tabmdi.py +679 -0
  60. wx/lib/agw/balloontip.py +1157 -0
  61. wx/lib/agw/buttonpanel.py +2787 -0
  62. wx/lib/agw/cubecolourdialog.py +3529 -0
  63. wx/lib/agw/customtreectrl.py +9908 -0
  64. wx/lib/agw/data/ShortcutEditor_1.png +0 -0
  65. wx/lib/agw/data/ShortcutEditor_1_thumb.png +0 -0
  66. wx/lib/agw/data/ShortcutEditor_2.png +0 -0
  67. wx/lib/agw/data/ShortcutEditor_2_thumb.png +0 -0
  68. wx/lib/agw/data/ShortcutEditor_3.png +0 -0
  69. wx/lib/agw/data/ShortcutEditor_3_thumb.png +0 -0
  70. wx/lib/agw/data/ShortcutEditor_4.png +0 -0
  71. wx/lib/agw/data/ShortcutEditor_4_thumb.png +0 -0
  72. wx/lib/agw/data/default_help_text.html +105 -0
  73. wx/lib/agw/flatmenu.py +7392 -0
  74. wx/lib/agw/flatnotebook.py +6669 -0
  75. wx/lib/agw/floatspin.py +1820 -0
  76. wx/lib/agw/fmcustomizedlg.py +535 -0
  77. wx/lib/agw/fmresources.py +407 -0
  78. wx/lib/agw/foldpanelbar.py +2282 -0
  79. wx/lib/agw/fourwaysplitter.py +1130 -0
  80. wx/lib/agw/genericmessagedialog.py +1549 -0
  81. wx/lib/agw/gradientbutton.py +731 -0
  82. wx/lib/agw/hyperlink.py +664 -0
  83. wx/lib/agw/hypertreelist.py +5756 -0
  84. wx/lib/agw/infobar.py +885 -0
  85. wx/lib/agw/knobctrl.py +944 -0
  86. wx/lib/agw/labelbook.py +3028 -0
  87. wx/lib/agw/multidirdialog.py +581 -0
  88. wx/lib/agw/peakmeter.py +1028 -0
  89. wx/lib/agw/persist/__init__.py +188 -0
  90. wx/lib/agw/persist/persist_constants.py +283 -0
  91. wx/lib/agw/persist/persist_handlers.py +2614 -0
  92. wx/lib/agw/persist/persistencemanager.py +863 -0
  93. wx/lib/agw/piectrl.py +1082 -0
  94. wx/lib/agw/pybusyinfo.py +399 -0
  95. wx/lib/agw/pycollapsiblepane.py +940 -0
  96. wx/lib/agw/pygauge.py +570 -0
  97. wx/lib/agw/pyprogress.py +916 -0
  98. wx/lib/agw/ribbon/__init__.py +198 -0
  99. wx/lib/agw/ribbon/art.py +219 -0
  100. wx/lib/agw/ribbon/art_aui.py +1283 -0
  101. wx/lib/agw/ribbon/art_default.py +81 -0
  102. wx/lib/agw/ribbon/art_internal.py +248 -0
  103. wx/lib/agw/ribbon/art_msw.py +2735 -0
  104. wx/lib/agw/ribbon/art_osx.py +52 -0
  105. wx/lib/agw/ribbon/bar.py +1259 -0
  106. wx/lib/agw/ribbon/buttonbar.py +1317 -0
  107. wx/lib/agw/ribbon/control.py +205 -0
  108. wx/lib/agw/ribbon/gallery.py +973 -0
  109. wx/lib/agw/ribbon/page.py +946 -0
  110. wx/lib/agw/ribbon/panel.py +1170 -0
  111. wx/lib/agw/ribbon/toolbar.py +1441 -0
  112. wx/lib/agw/rulerctrl.py +1885 -0
  113. wx/lib/agw/scrolledthumbnail.py +2116 -0
  114. wx/lib/agw/shapedbutton.py +1809 -0
  115. wx/lib/agw/shortcuteditor.py +2642 -0
  116. wx/lib/agw/speedmeter.py +1800 -0
  117. wx/lib/agw/supertooltip.py +1443 -0
  118. wx/lib/agw/thumbnailctrl.py +529 -0
  119. wx/lib/agw/toasterbox.py +1327 -0
  120. wx/lib/agw/ultimatelistctrl.py +13671 -0
  121. wx/lib/agw/xlsgrid.py +2111 -0
  122. wx/lib/agw/zoombar.py +1336 -0
  123. wx/lib/analogclock/__init__.py +140 -0
  124. wx/lib/analogclock/analogclock.py +630 -0
  125. wx/lib/analogclock/helpers.py +986 -0
  126. wx/lib/analogclock/lib_setup/__init__.py +0 -0
  127. wx/lib/analogclock/lib_setup/buttontreectrlpanel.py +297 -0
  128. wx/lib/analogclock/lib_setup/fontselect.py +57 -0
  129. wx/lib/analogclock/setup.py +490 -0
  130. wx/lib/analogclock/styles.py +47 -0
  131. wx/lib/anchors.py +103 -0
  132. wx/lib/art/__init__.py +4 -0
  133. wx/lib/art/flagart.py +1583 -0
  134. wx/lib/art/img2pyartprov.py +56 -0
  135. wx/lib/busy.py +152 -0
  136. wx/lib/buttons.py +1140 -0
  137. wx/lib/calendar.py +1596 -0
  138. wx/lib/checkbox.py +837 -0
  139. wx/lib/colourchooser/__init__.py +36 -0
  140. wx/lib/colourchooser/canvas.py +145 -0
  141. wx/lib/colourchooser/intl.py +24 -0
  142. wx/lib/colourchooser/pycolourbox.py +89 -0
  143. wx/lib/colourchooser/pycolourchooser.py +626 -0
  144. wx/lib/colourchooser/pycolourslider.py +98 -0
  145. wx/lib/colourchooser/pypalette.py +208 -0
  146. wx/lib/colourdb.py +740 -0
  147. wx/lib/colourselect.py +385 -0
  148. wx/lib/colourutils.py +118 -0
  149. wx/lib/combotreebox.py +944 -0
  150. wx/lib/delayedresult.py +420 -0
  151. wx/lib/dialogs.py +510 -0
  152. wx/lib/docview.py +3210 -0
  153. wx/lib/dragscroller.py +79 -0
  154. wx/lib/editor/README.txt +77 -0
  155. wx/lib/editor/__init__.py +24 -0
  156. wx/lib/editor/editor.py +974 -0
  157. wx/lib/editor/images.py +15 -0
  158. wx/lib/editor/selection.py +44 -0
  159. wx/lib/embeddedimage.py +76 -0
  160. wx/lib/eventStack.py +136 -0
  161. wx/lib/eventwatcher.py +440 -0
  162. wx/lib/evtmgr.py +521 -0
  163. wx/lib/expando.py +393 -0
  164. wx/lib/fancytext.py +494 -0
  165. wx/lib/filebrowsebutton.py +461 -0
  166. wx/lib/flashwin.py +262 -0
  167. wx/lib/flashwin_old.py +651 -0
  168. wx/lib/floatcanvas/FCEvents.py +53 -0
  169. wx/lib/floatcanvas/FCObjects.py +2910 -0
  170. wx/lib/floatcanvas/FloatCanvas.py +1025 -0
  171. wx/lib/floatcanvas/GUIMode.py +396 -0
  172. wx/lib/floatcanvas/NavCanvas.py +162 -0
  173. wx/lib/floatcanvas/Resources.py +319 -0
  174. wx/lib/floatcanvas/ScreenShot.py +1788 -0
  175. wx/lib/floatcanvas/Utilities/BBox.py +313 -0
  176. wx/lib/floatcanvas/Utilities/Colors.py +137 -0
  177. wx/lib/floatcanvas/Utilities/GUI.py +91 -0
  178. wx/lib/floatcanvas/Utilities/__init__.py +7 -0
  179. wx/lib/floatcanvas/__init__.py +124 -0
  180. wx/lib/foldmenu.py +89 -0
  181. wx/lib/gestures.py +310 -0
  182. wx/lib/gizmos/__init__.py +18 -0
  183. wx/lib/gizmos/dynamicsash.py +1202 -0
  184. wx/lib/gizmos/ledctrl.py +299 -0
  185. wx/lib/gizmos/treelistctrl.py +87 -0
  186. wx/lib/graphics.py +1942 -0
  187. wx/lib/gridmovers.py +516 -0
  188. wx/lib/iewin.py +249 -0
  189. wx/lib/iewin_old.py +894 -0
  190. wx/lib/imagebrowser.py +853 -0
  191. wx/lib/imageutils.py +163 -0
  192. wx/lib/infoframe.py +490 -0
  193. wx/lib/inspection.py +1254 -0
  194. wx/lib/intctrl.py +990 -0
  195. wx/lib/itemspicker.py +256 -0
  196. wx/lib/langlistctrl.py +480 -0
  197. wx/lib/layoutf.py +271 -0
  198. wx/lib/masked/__init__.py +27 -0
  199. wx/lib/masked/combobox.py +839 -0
  200. wx/lib/masked/ctrl.py +108 -0
  201. wx/lib/masked/ipaddrctrl.py +241 -0
  202. wx/lib/masked/maskededit.py +7262 -0
  203. wx/lib/masked/numctrl.py +2000 -0
  204. wx/lib/masked/textctrl.py +465 -0
  205. wx/lib/masked/timectrl.py +1465 -0
  206. wx/lib/mixins/__init__.py +17 -0
  207. wx/lib/mixins/grid.py +47 -0
  208. wx/lib/mixins/gridlabelrenderer.py +277 -0
  209. wx/lib/mixins/imagelist.py +77 -0
  210. wx/lib/mixins/inspection.py +184 -0
  211. wx/lib/mixins/listctrl.py +893 -0
  212. wx/lib/mixins/rubberband.py +403 -0
  213. wx/lib/mixins/treemixin.py +678 -0
  214. wx/lib/msgpanel.py +95 -0
  215. wx/lib/multisash.py +746 -0
  216. wx/lib/myole4ax.idl +178 -0
  217. wx/lib/myole4ax.tlb +0 -0
  218. wx/lib/newevent.py +229 -0
  219. wx/lib/newevent.pyi +25 -0
  220. wx/lib/nvdlg.py +156 -0
  221. wx/lib/ogl/__init__.py +13 -0
  222. wx/lib/ogl/basic.py +3989 -0
  223. wx/lib/ogl/bmpshape.py +86 -0
  224. wx/lib/ogl/canvas.py +467 -0
  225. wx/lib/ogl/composit.py +1576 -0
  226. wx/lib/ogl/diagram.py +230 -0
  227. wx/lib/ogl/divided.py +482 -0
  228. wx/lib/ogl/drawn.py +898 -0
  229. wx/lib/ogl/lines.py +1809 -0
  230. wx/lib/ogl/oglmisc.py +607 -0
  231. wx/lib/pdfviewer/__init__.py +113 -0
  232. wx/lib/pdfviewer/bitmaps/ArrowLeft.png +0 -0
  233. wx/lib/pdfviewer/bitmaps/ArrowRight.png +0 -0
  234. wx/lib/pdfviewer/bitmaps/DirectionH.png +0 -0
  235. wx/lib/pdfviewer/bitmaps/DirectionV.png +0 -0
  236. wx/lib/pdfviewer/bitmaps/PlayerFirst.png +0 -0
  237. wx/lib/pdfviewer/bitmaps/PlayerLast.png +0 -0
  238. wx/lib/pdfviewer/bitmaps/PlayerNext.png +0 -0
  239. wx/lib/pdfviewer/bitmaps/PlayerPrev.png +0 -0
  240. wx/lib/pdfviewer/bitmaps/Printer.png +0 -0
  241. wx/lib/pdfviewer/bitmaps/ReadMe.txt +28 -0
  242. wx/lib/pdfviewer/bitmaps/Save.png +0 -0
  243. wx/lib/pdfviewer/bitmaps/ZoomIn.png +0 -0
  244. wx/lib/pdfviewer/bitmaps/ZoomOut.png +0 -0
  245. wx/lib/pdfviewer/bitmaps/encode_bitmaps.py +37 -0
  246. wx/lib/pdfviewer/buttonpanel.py +285 -0
  247. wx/lib/pdfviewer/images.py +240 -0
  248. wx/lib/pdfviewer/viewer.py +1118 -0
  249. wx/lib/pdfwin.py +295 -0
  250. wx/lib/pdfwin_old.py +789 -0
  251. wx/lib/platebtn.py +789 -0
  252. wx/lib/plot/CHANGELOG.md +150 -0
  253. wx/lib/plot/README.md +16 -0
  254. wx/lib/plot/__init__.py +46 -0
  255. wx/lib/plot/__main__.py +5 -0
  256. wx/lib/plot/examples/__init__.py +0 -0
  257. wx/lib/plot/examples/demo.py +1010 -0
  258. wx/lib/plot/examples/simple_example.py +56 -0
  259. wx/lib/plot/plotcanvas.py +2985 -0
  260. wx/lib/plot/polyobjects.py +1524 -0
  261. wx/lib/plot/utils.py +334 -0
  262. wx/lib/popupctl.py +251 -0
  263. wx/lib/printout.py +1155 -0
  264. wx/lib/progressindicator.py +151 -0
  265. wx/lib/pubsub/LICENSE_BSD_Simple.txt +23 -0
  266. wx/lib/pubsub/README_WxPython.txt +22 -0
  267. wx/lib/pubsub/RELEASE_NOTES.txt +71 -0
  268. wx/lib/pubsub/__init__.py +25 -0
  269. wx/lib/pubsub/core/__init__.py +92 -0
  270. wx/lib/pubsub/core/arg1/__init__.py +16 -0
  271. wx/lib/pubsub/core/arg1/listenerimpl.py +97 -0
  272. wx/lib/pubsub/core/arg1/publisher.py +40 -0
  273. wx/lib/pubsub/core/arg1/publishermixin.py +34 -0
  274. wx/lib/pubsub/core/arg1/topicargspecimpl.py +66 -0
  275. wx/lib/pubsub/core/arg1/topicmgrimpl.py +19 -0
  276. wx/lib/pubsub/core/callables.py +198 -0
  277. wx/lib/pubsub/core/imp2.py +62 -0
  278. wx/lib/pubsub/core/itopicdefnprovider.py +0 -0
  279. wx/lib/pubsub/core/kwargs/__init__.py +16 -0
  280. wx/lib/pubsub/core/kwargs/datamsg.py +27 -0
  281. wx/lib/pubsub/core/kwargs/listenerimpl.py +93 -0
  282. wx/lib/pubsub/core/kwargs/publisher.py +77 -0
  283. wx/lib/pubsub/core/kwargs/publishermixin.py +65 -0
  284. wx/lib/pubsub/core/kwargs/topicargspecimpl.py +216 -0
  285. wx/lib/pubsub/core/kwargs/topicmgrimpl.py +13 -0
  286. wx/lib/pubsub/core/listener.py +40 -0
  287. wx/lib/pubsub/core/listenerbase.py +185 -0
  288. wx/lib/pubsub/core/notificationmgr.py +185 -0
  289. wx/lib/pubsub/core/publisherbase.py +189 -0
  290. wx/lib/pubsub/core/topicargspec.py +77 -0
  291. wx/lib/pubsub/core/topicdefnprovider.py +631 -0
  292. wx/lib/pubsub/core/topicexc.py +72 -0
  293. wx/lib/pubsub/core/topicmgr.py +454 -0
  294. wx/lib/pubsub/core/topicobj.py +472 -0
  295. wx/lib/pubsub/core/topictreetraverser.py +143 -0
  296. wx/lib/pubsub/core/topicutils.py +119 -0
  297. wx/lib/pubsub/core/treeconfig.py +21 -0
  298. wx/lib/pubsub/core/validatedefnargs.py +29 -0
  299. wx/lib/pubsub/core/weakmethod.py +102 -0
  300. wx/lib/pubsub/policies.py +24 -0
  301. wx/lib/pubsub/pub.py +199 -0
  302. wx/lib/pubsub/setuparg1.py +47 -0
  303. wx/lib/pubsub/setupkwargs.py +29 -0
  304. wx/lib/pubsub/utils/__init__.py +27 -0
  305. wx/lib/pubsub/utils/exchandling.py +100 -0
  306. wx/lib/pubsub/utils/misc.py +99 -0
  307. wx/lib/pubsub/utils/notification.py +331 -0
  308. wx/lib/pubsub/utils/topictreeprinter.py +195 -0
  309. wx/lib/pubsub/utils/xmltopicdefnprovider.py +286 -0
  310. wx/lib/pydocview.py +3300 -0
  311. wx/lib/rcsizer.py +227 -0
  312. wx/lib/resizewidget.py +357 -0
  313. wx/lib/scrolledpanel.py +243 -0
  314. wx/lib/sheet.py +350 -0
  315. wx/lib/sized_controls.py +691 -0
  316. wx/lib/softwareupdate.py +355 -0
  317. wx/lib/splitter.py +925 -0
  318. wx/lib/statbmp.py +199 -0
  319. wx/lib/stattext.py +321 -0
  320. wx/lib/throbber.py +424 -0
  321. wx/lib/ticker.py +306 -0
  322. wx/lib/ticker_xrc.py +48 -0
  323. wx/lib/utils.py +89 -0
  324. wx/lib/wordwrap.py +97 -0
  325. wx/lib/wxcairo/__init__.py +139 -0
  326. wx/lib/wxcairo/wx_cairocffi.py +200 -0
  327. wx/lib/wxcairo/wx_pycairo.py +455 -0
  328. wx/lib/wxpTag.py +274 -0
  329. wx/libcairo-2.dll +0 -0
  330. wx/locale/af/LC_MESSAGES/wxstd.mo +0 -0
  331. wx/locale/an/LC_MESSAGES/wxstd.mo +0 -0
  332. wx/locale/ar/LC_MESSAGES/wxstd.mo +0 -0
  333. wx/locale/ca/LC_MESSAGES/wxstd.mo +0 -0
  334. wx/locale/ca@valencia/LC_MESSAGES/wxstd.mo +0 -0
  335. wx/locale/co/LC_MESSAGES/wxstd.mo +0 -0
  336. wx/locale/cs/LC_MESSAGES/wxstd.mo +0 -0
  337. wx/locale/da/LC_MESSAGES/wxstd.mo +0 -0
  338. wx/locale/de/LC_MESSAGES/wxstd.mo +0 -0
  339. wx/locale/el/LC_MESSAGES/wxstd.mo +0 -0
  340. wx/locale/es/LC_MESSAGES/wxstd.mo +0 -0
  341. wx/locale/eu/LC_MESSAGES/wxstd.mo +0 -0
  342. wx/locale/fa_IR/LC_MESSAGES/wxstd.mo +0 -0
  343. wx/locale/fi/LC_MESSAGES/wxstd.mo +0 -0
  344. wx/locale/fr/LC_MESSAGES/wxstd.mo +0 -0
  345. wx/locale/gl_ES/LC_MESSAGES/wxstd.mo +0 -0
  346. wx/locale/hi/LC_MESSAGES/wxstd.mo +0 -0
  347. wx/locale/hr/LC_MESSAGES/wxstd.mo +0 -0
  348. wx/locale/hu/LC_MESSAGES/wxstd.mo +0 -0
  349. wx/locale/id/LC_MESSAGES/wxstd.mo +0 -0
  350. wx/locale/it/LC_MESSAGES/wxstd.mo +0 -0
  351. wx/locale/ja/LC_MESSAGES/wxstd.mo +0 -0
  352. wx/locale/ka/LC_MESSAGES/wxstd.mo +0 -0
  353. wx/locale/ko_KR/LC_MESSAGES/wxstd.mo +0 -0
  354. wx/locale/lt/LC_MESSAGES/wxstd.mo +0 -0
  355. wx/locale/lv/LC_MESSAGES/wxstd.mo +0 -0
  356. wx/locale/ms/LC_MESSAGES/wxstd.mo +0 -0
  357. wx/locale/nb/LC_MESSAGES/wxstd.mo +0 -0
  358. wx/locale/ne/LC_MESSAGES/wxstd.mo +0 -0
  359. wx/locale/nl/LC_MESSAGES/wxstd.mo +0 -0
  360. wx/locale/pl/LC_MESSAGES/wxstd.mo +0 -0
  361. wx/locale/pt/LC_MESSAGES/wxstd.mo +0 -0
  362. wx/locale/pt_BR/LC_MESSAGES/wxstd.mo +0 -0
  363. wx/locale/ro/LC_MESSAGES/wxstd.mo +0 -0
  364. wx/locale/ru/LC_MESSAGES/wxstd.mo +0 -0
  365. wx/locale/sk/LC_MESSAGES/wxstd.mo +0 -0
  366. wx/locale/sl/LC_MESSAGES/wxstd.mo +0 -0
  367. wx/locale/sq/LC_MESSAGES/wxstd.mo +0 -0
  368. wx/locale/sr/LC_MESSAGES/wxstd.mo +0 -0
  369. wx/locale/sv/LC_MESSAGES/wxstd.mo +0 -0
  370. wx/locale/ta/LC_MESSAGES/wxstd.mo +0 -0
  371. wx/locale/tr/LC_MESSAGES/wxstd.mo +0 -0
  372. wx/locale/uk/LC_MESSAGES/wxstd.mo +0 -0
  373. wx/locale/vi/LC_MESSAGES/wxstd.mo +0 -0
  374. wx/locale/zh_CN/LC_MESSAGES/wxstd.mo +0 -0
  375. wx/locale/zh_TW/LC_MESSAGES/wxstd.mo +0 -0
  376. wx/media.py +30 -0
  377. wx/media.pyi +272 -0
  378. wx/msw.py +16 -0
  379. wx/msw.pyi +91 -0
  380. wx/propgrid.py +498 -0
  381. wx/propgrid.pyi +7427 -0
  382. wx/py/CHANGES.txt +796 -0
  383. wx/py/Py.ico +0 -0
  384. wx/py/PyAlaCarte.py +34 -0
  385. wx/py/PyAlaMode.py +34 -0
  386. wx/py/PyAlaModeTest.py +33 -0
  387. wx/py/PyCrust.ico +0 -0
  388. wx/py/PyCrust.py +78 -0
  389. wx/py/PyCrust_16.png +0 -0
  390. wx/py/PyCrust_32.png +0 -0
  391. wx/py/PyFilling.py +35 -0
  392. wx/py/PyShell.py +78 -0
  393. wx/py/PySlices.ico +0 -0
  394. wx/py/PySlices.py +98 -0
  395. wx/py/PySlicesShell.py +94 -0
  396. wx/py/PySlices_16.png +0 -0
  397. wx/py/PySlices_32.png +0 -0
  398. wx/py/PyWrap.py +52 -0
  399. wx/py/README.txt +77 -0
  400. wx/py/__init__.py +20 -0
  401. wx/py/buffer.py +136 -0
  402. wx/py/crust.py +403 -0
  403. wx/py/crustslices.py +403 -0
  404. wx/py/dispatcher.py +259 -0
  405. wx/py/document.py +37 -0
  406. wx/py/editor.py +844 -0
  407. wx/py/editwindow.py +316 -0
  408. wx/py/filling.py +358 -0
  409. wx/py/frame.py +976 -0
  410. wx/py/images.py +212 -0
  411. wx/py/interpreter.py +161 -0
  412. wx/py/introspect.py +402 -0
  413. wx/py/magic.py +98 -0
  414. wx/py/parse.py +134 -0
  415. wx/py/path.py +36 -0
  416. wx/py/pseudo.py +99 -0
  417. wx/py/shell.py +1579 -0
  418. wx/py/sliceshell.py +3805 -0
  419. wx/py/tests/test_interpreter.py +71 -0
  420. wx/py/tests/test_introspect.py +810 -0
  421. wx/py/tests/test_pseudo.py +70 -0
  422. wx/py/tests/test_version.py +36 -0
  423. wx/py/tests/testall.py +22 -0
  424. wx/py/version.py +7 -0
  425. wx/py.typed +0 -0
  426. wx/ribbon.py +48 -0
  427. wx/ribbon.pyi +3099 -0
  428. wx/richtext.py +141 -0
  429. wx/richtext.pyi +13581 -0
  430. wx/siplib.cp315-win_amd64.pyd +0 -0
  431. wx/siplib.pyi +19 -0
  432. wx/stc.py +59 -0
  433. wx/stc.pyi +9918 -0
  434. wx/svg/__init__.py +363 -0
  435. wx/svg/_nanosvg.cp315-win_amd64.pyd +0 -0
  436. wx/tools/__init__.py +18 -0
  437. wx/tools/dbg.py +268 -0
  438. wx/tools/genaxmodule.py +50 -0
  439. wx/tools/helpviewer.py +92 -0
  440. wx/tools/img2img.py +85 -0
  441. wx/tools/img2png.py +54 -0
  442. wx/tools/img2py.py +306 -0
  443. wx/tools/img2xpm.py +54 -0
  444. wx/tools/pywxrc.py +951 -0
  445. wx/tools/wxget.py +254 -0
  446. wx/tools/wxget_docs_demo.py +183 -0
  447. wx/wxbase334u_net_vc140_x64.dll +0 -0
  448. wx/wxbase334u_vc140_x64.dll +0 -0
  449. wx/wxbase334u_xml_vc140_x64.dll +0 -0
  450. wx/wxmsw334u_adv_vc140_x64.dll +0 -0
  451. wx/wxmsw334u_aui_vc140_x64.dll +0 -0
  452. wx/wxmsw334u_core_vc140_x64.dll +0 -0
  453. wx/wxmsw334u_gl_vc140_x64.dll +0 -0
  454. wx/wxmsw334u_html_vc140_x64.dll +0 -0
  455. wx/wxmsw334u_media_vc140_x64.dll +0 -0
  456. wx/wxmsw334u_propgrid_vc140_x64.dll +0 -0
  457. wx/wxmsw334u_qa_vc140_x64.dll +0 -0
  458. wx/wxmsw334u_ribbon_vc140_x64.dll +0 -0
  459. wx/wxmsw334u_richtext_vc140_x64.dll +0 -0
  460. wx/wxmsw334u_stc_vc140_x64.dll +0 -0
  461. wx/wxmsw334u_webview_vc140_x64.dll +0 -0
  462. wx/wxmsw334u_xrc_vc140_x64.dll +0 -0
  463. wx/xml.py +18 -0
  464. wx/xml.pyi +728 -0
  465. wx/xrc.py +68 -0
  466. wx/xrc.pyi +896 -0
  467. wxpython-4.3.2.dist-info/METADATA +71 -0
  468. wxpython-4.3.2.dist-info/RECORD +472 -0
  469. wxpython-4.3.2.dist-info/WHEEL +5 -0
  470. wxpython-4.3.2.dist-info/entry_points.txt +13 -0
  471. wxpython-4.3.2.dist-info/licenses/LICENSE.txt +610 -0
  472. wxpython-4.3.2.dist-info/top_level.txt +1 -0
wx/core.py ADDED
@@ -0,0 +1,3417 @@
1
+ # This file is generated by wxPython's SIP generator. Do not edit by hand.
2
+ #
3
+ # Copyright: (c) 2020 by Total Control Software
4
+ # License: wxWindows License
5
+
6
+ """
7
+ The classes in this module are the most commonly used classes for wxPython,
8
+ which is why they have been made visible in the core `wx` namespace.
9
+ Everything you need for building typical GUI applications is here.
10
+ """
11
+
12
+ from ._core import *
13
+
14
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
15
+ # This code block was included from src/core_ex.py
16
+ import sys as _sys
17
+
18
+ # These come from the extension module, this is just their types
19
+ Port: str
20
+ Platform: str
21
+ PlatformInfo: tuple
22
+
23
+ # Load version numbers from __version__ and some other initialization tasks...
24
+ if 'wxEVT_NULL' in dir():
25
+ from wx.__version__ import *
26
+ import wx._core
27
+ __version__ = VERSION_STRING
28
+
29
+ # Add the build type to PlatformInfo
30
+ PlatformInfo = PlatformInfo + ('build-type: ' + BUILD_TYPE, )
31
+
32
+ # Register a function to be called when Python terminates that will clean
33
+ # up and release all system resources that wxWidgets allocated.
34
+ import atexit
35
+ atexit.register(wx._core._wxPyCleanup)
36
+ del atexit
37
+
38
+ else:
39
+ Port = ''
40
+ Platform = ''
41
+ PlatformInfo = ()
42
+
43
+ # A little trick to make 'wx' be a reference to this module so wx.Names can
44
+ # be used in the python code here.
45
+ wx = _sys.modules[__name__]
46
+
47
+
48
+ import warnings
49
+ class wxPyDeprecationWarning(DeprecationWarning):
50
+ pass
51
+
52
+ warnings.simplefilter('default', wxPyDeprecationWarning)
53
+ del warnings
54
+
55
+
56
+ def deprecated(item, msg='', useName=False):
57
+ """
58
+ Create a delegating wrapper that raises a deprecation warning. Can be
59
+ used with callable objects (functions, methods, classes) or with
60
+ properties.
61
+ """
62
+ import warnings
63
+
64
+ name = ''
65
+ if useName:
66
+ try:
67
+ name = ' ' + item.__name__
68
+ except AttributeError:
69
+ pass
70
+
71
+ if isinstance(item, type):
72
+ # It is a class. Make a subclass that raises a warning.
73
+ class DeprecatedClassProxy(item):
74
+ def __init__(*args, **kw):
75
+ warnings.warn("Using deprecated class%s. %s" % (name, msg),
76
+ wxPyDeprecationWarning, stacklevel=2)
77
+ item.__init__(*args, **kw)
78
+ DeprecatedClassProxy.__name__ = item.__name__
79
+ return DeprecatedClassProxy
80
+
81
+ elif callable(item):
82
+ # wrap a new function around the callable
83
+ def deprecated_func(*args, **kw):
84
+ warnings.warn("Call to deprecated item%s. %s" % (name, msg),
85
+ wxPyDeprecationWarning, stacklevel=2)
86
+ if not kw:
87
+ return item(*args)
88
+ return item(*args, **kw)
89
+ deprecated_func.__name__ = item.__name__
90
+ deprecated_func.__doc__ = item.__doc__
91
+ if hasattr(item, '__dict__'):
92
+ deprecated_func.__dict__.update(item.__dict__)
93
+ return deprecated_func
94
+
95
+ elif hasattr(item, '__get__'):
96
+ # it should be a property if there is a getter
97
+ class DepGetProp(object):
98
+ def __init__(self, item, msg):
99
+ self.item = item
100
+ self.msg = msg
101
+ def __get__(self, inst, klass):
102
+ warnings.warn("Accessing deprecated property. %s" % msg,
103
+ wxPyDeprecationWarning, stacklevel=2)
104
+ return self.item.__get__(inst, klass)
105
+ class DepGetSetProp(DepGetProp):
106
+ def __set__(self, inst, val):
107
+ warnings.warn("Accessing deprecated property. %s" % msg,
108
+ wxPyDeprecationWarning, stacklevel=2)
109
+ return self.item.__set__(inst, val)
110
+ class DepGetSetDelProp(DepGetSetProp):
111
+ def __delete__(self, inst):
112
+ warnings.warn("Accessing deprecated property. %s" % msg,
113
+ wxPyDeprecationWarning, stacklevel=2)
114
+ return self.item.__delete__(inst)
115
+
116
+ if hasattr(item, '__set__') and hasattr(item, '__delete__'):
117
+ return DepGetSetDelProp(item, msg)
118
+ elif hasattr(item, '__set__'):
119
+ return DepGetSetProp(item, msg)
120
+ else:
121
+ return DepGetProp(item, msg)
122
+ else:
123
+ raise TypeError("unsupported type %s" % type(item))
124
+
125
+
126
+ def deprecatedMsg(msg):
127
+ """
128
+ A wrapper for the deprecated decorator that makes it easier to attach a
129
+ custom message to the warning that is raised if the item is used. This
130
+ can also be used in the @decorator role since it returns the real
131
+ decorator when called.
132
+ """
133
+ import functools
134
+ return functools.partial(deprecated, msg=msg, useName=True)
135
+
136
+ #----------------------------------------------------------------------------
137
+
138
+ EmptyString = ""
139
+
140
+ #----------------------------------------------------------------------------
141
+
142
+ # End of included code block
143
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
144
+
145
+ import typing
146
+
147
+ BG_STYLE_CUSTOM = BG_STYLE_PAINT
148
+
149
+ ADJUST_MINSIZE = 0
150
+
151
+ WS_EX_VALIDATE_RECURSIVELY = 0
152
+
153
+ def _ClientDataContainer_GetClientObject(self):
154
+ """
155
+ Alias for :meth:`GetClientData`
156
+ """
157
+ return self.GetClientData()
158
+ ClientDataContainer.GetClientObject = _ClientDataContainer_GetClientObject
159
+ del _ClientDataContainer_GetClientObject
160
+ def _ClientDataContainer_SetClientObject(self, data):
161
+ """
162
+ Alias for :meth:`SetClientData`
163
+ """
164
+ self.SetClientData(data)
165
+ ClientDataContainer.SetClientObject = _ClientDataContainer_SetClientObject
166
+ del _ClientDataContainer_SetClientObject
167
+ ClientDataContainer.ClientData = property(ClientDataContainer.GetClientData, ClientDataContainer.SetClientData)
168
+ def _initStockObjects():
169
+ import wx
170
+ wx.NORMAL_FONT._copyFrom( StockGDI.instance().GetFont(StockGDI.FONT_NORMAL))
171
+ wx.SMALL_FONT._copyFrom( StockGDI.instance().GetFont(StockGDI.FONT_SMALL))
172
+ wx.SWISS_FONT._copyFrom( StockGDI.instance().GetFont(StockGDI.FONT_SWISS))
173
+ wx.ITALIC_FONT._copyFrom( StockGDI.instance().GetFont(StockGDI.FONT_ITALIC))
174
+
175
+ wx.BLACK_DASHED_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_BLACKDASHED))
176
+ wx.BLACK_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_BLACK))
177
+ wx.BLUE_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_BLUE))
178
+ wx.CYAN_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_CYAN))
179
+ wx.GREEN_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_GREEN))
180
+ wx.YELLOW_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_YELLOW))
181
+ wx.GREY_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_GREY))
182
+ wx.LIGHT_GREY_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_LIGHTGREY))
183
+ wx.MEDIUM_GREY_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_MEDIUMGREY))
184
+ wx.RED_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_RED))
185
+ wx.TRANSPARENT_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_TRANSPARENT))
186
+ wx.WHITE_PEN._copyFrom( StockGDI.GetPen(StockGDI.PEN_WHITE))
187
+
188
+ wx.BLACK_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_BLACK))
189
+ wx.BLUE_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_BLUE))
190
+ wx.CYAN_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_CYAN))
191
+ wx.GREEN_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_GREEN))
192
+ wx.YELLOW_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_YELLOW))
193
+ wx.GREY_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_GREY))
194
+ wx.LIGHT_GREY_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_LIGHTGREY))
195
+ wx.MEDIUM_GREY_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_MEDIUMGREY))
196
+ wx.RED_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_RED))
197
+ wx.TRANSPARENT_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_TRANSPARENT))
198
+ wx.WHITE_BRUSH._copyFrom( StockGDI.GetBrush(StockGDI.BRUSH_WHITE))
199
+
200
+ wx.BLACK._copyFrom( StockGDI.GetColour(StockGDI.COLOUR_BLACK))
201
+ wx.BLUE._copyFrom( StockGDI.GetColour(StockGDI.COLOUR_BLUE))
202
+ wx.CYAN._copyFrom( StockGDI.GetColour(StockGDI.COLOUR_CYAN))
203
+ wx.GREEN._copyFrom( StockGDI.GetColour(StockGDI.COLOUR_GREEN))
204
+ wx.YELLOW._copyFrom( StockGDI.GetColour(StockGDI.COLOUR_YELLOW))
205
+ wx.LIGHT_GREY._copyFrom( StockGDI.GetColour(StockGDI.COLOUR_LIGHTGREY))
206
+ wx.RED._copyFrom( StockGDI.GetColour(StockGDI.COLOUR_RED))
207
+ wx.WHITE._copyFrom( StockGDI.GetColour(StockGDI.COLOUR_WHITE))
208
+
209
+ wx.CROSS_CURSOR._copyFrom( StockGDI.GetCursor(StockGDI.CURSOR_CROSS))
210
+ wx.HOURGLASS_CURSOR._copyFrom( StockGDI.GetCursor(StockGDI.CURSOR_HOURGLASS))
211
+ wx.STANDARD_CURSOR._copyFrom( StockGDI.GetCursor(StockGDI.CURSOR_STANDARD))
212
+
213
+ wx.TheFontList = StockGDI._getTheFontList()
214
+ wx.ThePenList = StockGDI._getThePenList()
215
+ wx.TheBrushList = StockGDI._getTheBrushList()
216
+ wx.TheColourDatabase = StockGDI._getTheColourDatabase()
217
+
218
+
219
+ StockGDI._initStockObjects = staticmethod(_initStockObjects)
220
+ def _DateTime___repr__(self):
221
+ if self.IsValid():
222
+ f = self.Format()
223
+ return '<wx.DateTime: "%s">' % f
224
+ else:
225
+ return '<wx.DateTime: "INVALID">'
226
+ DateTime.__repr__ = _DateTime___repr__
227
+ del _DateTime___repr__
228
+ def _DateTime___str__(self):
229
+ if self.IsValid():
230
+ f = self.Format()
231
+ return f
232
+ else:
233
+ return "INVALID DateTime"
234
+ DateTime.__str__ = _DateTime___str__
235
+ del _DateTime___str__
236
+ InvalidDateTime = DefaultDateTime
237
+
238
+ @wx.deprecatedMsg("Use :meth:`DateTime.FromTimeT` instead.")
239
+ def DateTimeFromTimeT(timet):
240
+ """
241
+ Compatibility wrapper for :meth:`DateTime.FromTimeT`
242
+ """
243
+ return DateTime.FromTimeT(timet)
244
+
245
+ @wx.deprecatedMsg("Use :meth:`DateTime.FromJDN` instead.")
246
+ def DateTimeFromJDN(jdn):
247
+ """
248
+ Compatibility wrapper for :meth:`DateTime.FromJDN`
249
+ """
250
+ return DateTime.FromJDN(jdn)
251
+
252
+ @wx.deprecatedMsg("Use :meth:`DateTime.FromHMS` instead.")
253
+ def DateTimeFromHMS(hour, minute=0, second=0, millisecond=0):
254
+ """
255
+ Compatibility wrapper for :meth:`DateTime.FromHMS`
256
+ """
257
+ return DateTime.FromHMS(hour, minute, second, millisecond)
258
+
259
+ @wx.deprecatedMsg("Use :meth:`DateTime.FromDMY` instead.")
260
+ def DateTimeFromDMY(day, month, year=DateTime.Inv_Year, hour=0, minute=0, second=0, millisecond=0):
261
+ """
262
+ Compatibility wrapper for :meth:`DateTime.FromDMY`
263
+ """
264
+ return DateTime.FromDMY(day, month, year, hour, minute, second, millisecond)
265
+
266
+ def pydate2wxdate(date):
267
+ """
268
+ Convert a Python date or datetime to a :class:`DateTime` object
269
+ """
270
+ import datetime
271
+ assert isinstance(date, (datetime.datetime, datetime.date))
272
+ return DateTime(date) # the built-in typemap will convert it for us
273
+
274
+ def wxdate2pydate(date):
275
+ """
276
+ Convert a :class:`DateTime` object to a Python datetime.
277
+ """
278
+ import datetime
279
+ assert isinstance(date, DateTime)
280
+ if date.IsValid():
281
+ return datetime.datetime(date.year, date.month+1, date.day,
282
+ date.hour, date.minute, date.second, date.millisecond*1000)
283
+ else:
284
+ return None
285
+
286
+ def _WindowIDRef___repr__(self):
287
+ return "WindowIDRef: {}".format(self.GetId())
288
+ WindowIDRef.__repr__ = _WindowIDRef___repr__
289
+ del _WindowIDRef___repr__
290
+ def _WindowIDRef___hash__(self):
291
+ return hash(self.GetValue())
292
+ WindowIDRef.__hash__ = _WindowIDRef___hash__
293
+ del _WindowIDRef___hash__
294
+ def NewIdRef(count=1):
295
+ """
296
+ Reserves a new Window ID (or range of WindowIDs) and returns a
297
+ :class:`wx.WindowIDRef` object (or list of them) that will help
298
+ manage the reservation of that ID.
299
+
300
+ This function is intended to be a drop-in replacement of the old
301
+ and deprecated :func:`wx.NewId` function, with the added benefit
302
+ that the ID should never conflict with an in-use ID or other IDs
303
+ generated by this function.
304
+ """
305
+ if count == 1:
306
+ return WindowIDRef(IdManager.ReserveId())
307
+ else:
308
+ start = IdManager.ReserveId(count)
309
+ IDRefs = []
310
+ for id in range(start, start+count):
311
+ IDRefs.append(WindowIDRef(id))
312
+ return IDRefs
313
+
314
+ def _ArrayVideoModes___repr__(self):
315
+ return "ArrayVideoModes: " + repr(list(self))
316
+ ArrayVideoModes.__repr__ = _ArrayVideoModes___repr__
317
+ del _ArrayVideoModes___repr__
318
+ #----------------------------------------------------------------------------
319
+ # Add the directory where the wxWidgets catalogs were installed
320
+ # to the default catalog path, if they were put in the package dir.
321
+ import os
322
+ _localedir = os.path.join(os.path.dirname(__file__), "locale")
323
+ if os.path.exists(_localedir):
324
+ if isinstance(_localedir, (bytes, bytearray)):
325
+ _localedir = _localedir.decode(_sys.getfilesystemencoding())
326
+ Locale.AddCatalogLookupPathPrefix(_localedir)
327
+ del os
328
+ #----------------------------------------------------------------------------
329
+
330
+ def _PrintPageRanges___repr__(self):
331
+ return "PrintPageRanges: " + repr(list(self))
332
+ PrintPageRanges.__repr__ = _PrintPageRanges___repr__
333
+ del _PrintPageRanges___repr__
334
+ def _Point_GetIM(self):
335
+ """
336
+ Returns an immutable representation of the ``wx.Point`` object, based on ``namedtuple``.
337
+
338
+ This new object is hashable and can be used as a dictionary key,
339
+ be added to sets, etc. It can be converted back into a real ``wx.Point``
340
+ with a simple statement like this: ``obj = wx.Point(imObj)``.
341
+ """
342
+ return _im_Point(*self.Get())
343
+ Point.GetIM = _Point_GetIM
344
+ del _Point_GetIM
345
+ def _Point___str__(self):
346
+ return str(self.Get())
347
+ Point.__str__ = _Point___str__
348
+ del _Point___str__
349
+ def _Point___repr__(self):
350
+ return "wx.Point"+str(self.Get())
351
+ Point.__repr__ = _Point___repr__
352
+ del _Point___repr__
353
+ def _Point___len__(self):
354
+ return len(self.Get())
355
+ Point.__len__ = _Point___len__
356
+ del _Point___len__
357
+ def _Point___reduce__(self):
358
+ return (Point, self.Get())
359
+ Point.__reduce__ = _Point___reduce__
360
+ del _Point___reduce__
361
+ def _Point___getitem__(self, idx):
362
+ return self.Get()[idx]
363
+ Point.__getitem__ = _Point___getitem__
364
+ del _Point___getitem__
365
+ def _Point___setitem__(self, idx, val):
366
+ if idx == 0: self.x = val
367
+ elif idx == 1: self.y = val
368
+ else: raise IndexError
369
+ Point.__setitem__ = _Point___setitem__
370
+ del _Point___setitem__
371
+ Point.__safe_for_unpickling__ = True
372
+
373
+ Point.IM = property(Point.GetIM)
374
+ def _Size_GetIM(self):
375
+ """
376
+ Returns an immutable representation of the ``wx.Size`` object, based on ``namedtuple``.
377
+
378
+ This new object is hashable and can be used as a dictionary key,
379
+ be added to sets, etc. It can be converted back into a real ``wx.Size``
380
+ with a simple statement like this: ``obj = wx.Size(imObj)``.
381
+ """
382
+ return _im_Size(*self.Get())
383
+ Size.GetIM = _Size_GetIM
384
+ del _Size_GetIM
385
+ def _Size___str__(self):
386
+ return str(self.Get())
387
+ Size.__str__ = _Size___str__
388
+ del _Size___str__
389
+ def _Size___repr__(self):
390
+ return "wx.Size"+str(self.Get())
391
+ Size.__repr__ = _Size___repr__
392
+ del _Size___repr__
393
+ def _Size___len__(self):
394
+ return len(self.Get())
395
+ Size.__len__ = _Size___len__
396
+ del _Size___len__
397
+ def _Size___nonzero__(self):
398
+ return self.Get() != (0,0)
399
+ Size.__nonzero__ = _Size___nonzero__
400
+ del _Size___nonzero__
401
+ def _Size___bool__(self):
402
+ return self.Get() != (0,0)
403
+ Size.__bool__ = _Size___bool__
404
+ del _Size___bool__
405
+ def _Size___reduce__(self):
406
+ return (Size, self.Get())
407
+ Size.__reduce__ = _Size___reduce__
408
+ del _Size___reduce__
409
+ def _Size___getitem__(self, idx):
410
+ return self.Get()[idx]
411
+ Size.__getitem__ = _Size___getitem__
412
+ del _Size___getitem__
413
+ def _Size___setitem__(self, idx, val):
414
+ if idx == 0: self.width = val
415
+ elif idx == 1: self.height = val
416
+ else: raise IndexError
417
+ Size.__setitem__ = _Size___setitem__
418
+ del _Size___setitem__
419
+ Size.__safe_for_unpickling__ = True
420
+
421
+ def _Rect_GetIM(self):
422
+ """
423
+ Returns an immutable representation of the ``wx.Rect`` object, based on ``namedtuple``.
424
+
425
+ This new object is hashable and can be used as a dictionary key,
426
+ be added to sets, etc. It can be converted back into a real ``wx.Rect``
427
+ with a simple statement like this: ``obj = wx.Rect(imObj)``.
428
+ """
429
+ return _im_Rect(*self.Get())
430
+ Rect.GetIM = _Rect_GetIM
431
+ del _Rect_GetIM
432
+ def _Rect___str__(self):
433
+ return str(self.Get())
434
+ Rect.__str__ = _Rect___str__
435
+ del _Rect___str__
436
+ def _Rect___repr__(self):
437
+ return "wx.Rect"+str(self.Get())
438
+ Rect.__repr__ = _Rect___repr__
439
+ del _Rect___repr__
440
+ def _Rect___len__(self):
441
+ return len(self.Get())
442
+ Rect.__len__ = _Rect___len__
443
+ del _Rect___len__
444
+ def _Rect___nonzero__(self):
445
+ return self.Get() != (0,0,0,0)
446
+ Rect.__nonzero__ = _Rect___nonzero__
447
+ del _Rect___nonzero__
448
+ def _Rect___bool__(self):
449
+ return self.Get() != (0,0,0,0)
450
+ Rect.__bool__ = _Rect___bool__
451
+ del _Rect___bool__
452
+ def _Rect___reduce__(self):
453
+ return (Rect, self.Get())
454
+ Rect.__reduce__ = _Rect___reduce__
455
+ del _Rect___reduce__
456
+ def _Rect___getitem__(self, idx):
457
+ return self.Get()[idx]
458
+ Rect.__getitem__ = _Rect___getitem__
459
+ del _Rect___getitem__
460
+ def _Rect___setitem__(self, idx, val):
461
+ if idx == 0: self.x = val
462
+ elif idx == 1: self.y = val
463
+ elif idx == 2: self.width = val
464
+ elif idx == 3: self.height = val
465
+ else: raise IndexError
466
+ Rect.__setitem__ = _Rect___setitem__
467
+ del _Rect___setitem__
468
+ Rect.__safe_for_unpickling__ = True
469
+
470
+ def _RealPoint_GetIM(self):
471
+ """
472
+ Returns an immutable representation of the ``wx.RealPoint`` object, based on ``namedtuple``.
473
+
474
+ This new object is hashable and can be used as a dictionary key,
475
+ be added to sets, etc. It can be converted back into a real ``wx.RealPoint``
476
+ with a simple statement like this: ``obj = wx.RealPoint(imObj)``.
477
+ """
478
+ return _im_RealPoint(*self.Get())
479
+ RealPoint.GetIM = _RealPoint_GetIM
480
+ del _RealPoint_GetIM
481
+ def _RealPoint___str__(self):
482
+ return str(self.Get())
483
+ RealPoint.__str__ = _RealPoint___str__
484
+ del _RealPoint___str__
485
+ def _RealPoint___repr__(self):
486
+ return "wx.RealPoint"+str(self.Get())
487
+ RealPoint.__repr__ = _RealPoint___repr__
488
+ del _RealPoint___repr__
489
+ def _RealPoint___len__(self):
490
+ return len(self.Get())
491
+ RealPoint.__len__ = _RealPoint___len__
492
+ del _RealPoint___len__
493
+ def _RealPoint___nonzero__(self):
494
+ return self.Get() != (0,0)
495
+ RealPoint.__nonzero__ = _RealPoint___nonzero__
496
+ del _RealPoint___nonzero__
497
+ def _RealPoint___bool__(self):
498
+ return self.Get() != (0,0)
499
+ RealPoint.__bool__ = _RealPoint___bool__
500
+ del _RealPoint___bool__
501
+ def _RealPoint___reduce__(self):
502
+ return (RealPoint, self.Get())
503
+ RealPoint.__reduce__ = _RealPoint___reduce__
504
+ del _RealPoint___reduce__
505
+ def _RealPoint___getitem__(self, idx):
506
+ return self.Get()[idx]
507
+ RealPoint.__getitem__ = _RealPoint___getitem__
508
+ del _RealPoint___getitem__
509
+ def _RealPoint___setitem__(self, idx, val):
510
+ if idx == 0: self.x = val
511
+ elif idx == 1: self.y = val
512
+ else: raise IndexError
513
+ RealPoint.__setitem__ = _RealPoint___setitem__
514
+ del _RealPoint___setitem__
515
+ RealPoint.__safe_for_unpickling__ = True
516
+
517
+ RealPoint.IM = property(RealPoint.GetIM)
518
+ def _ColourDatabase_FindColour(self, colour):
519
+ return self.Find(colour)
520
+ ColourDatabase.FindColour = _ColourDatabase_FindColour
521
+ del _ColourDatabase_FindColour
522
+ from collections import namedtuple
523
+ _im_Point = namedtuple('_im_Point', ['x', 'y'])
524
+ del namedtuple
525
+
526
+ def _PointList___repr__(self):
527
+ return "PointList: " + repr(list(self))
528
+ PointList.__repr__ = _PointList___repr__
529
+ del _PointList___repr__
530
+ from collections import namedtuple
531
+ _im_Size = namedtuple('_im_Size', ['width', 'height'])
532
+ del namedtuple
533
+
534
+ from collections import namedtuple
535
+ _im_Rect = namedtuple('_im_Rect', ['x', 'y', 'width', 'height'])
536
+ del namedtuple
537
+
538
+ from collections import namedtuple
539
+ _im_RealPoint = namedtuple('_im_RealPoint', ['x', 'y'])
540
+ del namedtuple
541
+
542
+ def _Point2D_GetIM(self):
543
+ """
544
+ Returns an immutable representation of the ``wx.Point2D`` object, based on ``namedtuple``.
545
+
546
+ This new object is hashable and can be used as a dictionary key,
547
+ be added to sets, etc. It can be converted back into a real ``wx.Point2D``
548
+ with a simple statement like this: ``obj = wx.Point2D(imObj)``.
549
+ """
550
+ return _im_Point2D(*self.Get())
551
+ Point2D.GetIM = _Point2D_GetIM
552
+ del _Point2D_GetIM
553
+ def _Point2D___str__(self):
554
+ return str(self.Get())
555
+ Point2D.__str__ = _Point2D___str__
556
+ del _Point2D___str__
557
+ def _Point2D___repr__(self):
558
+ return "wx.Point2D"+str(self.Get())
559
+ Point2D.__repr__ = _Point2D___repr__
560
+ del _Point2D___repr__
561
+ def _Point2D___len__(self):
562
+ return len(self.Get())
563
+ Point2D.__len__ = _Point2D___len__
564
+ del _Point2D___len__
565
+ def _Point2D___nonzero__(self):
566
+ return self.Get() != (0,0)
567
+ Point2D.__nonzero__ = _Point2D___nonzero__
568
+ del _Point2D___nonzero__
569
+ def _Point2D___bool__(self):
570
+ return self.Get() != (0,0)
571
+ Point2D.__bool__ = _Point2D___bool__
572
+ del _Point2D___bool__
573
+ def _Point2D___reduce__(self):
574
+ return (Point2D, self.Get())
575
+ Point2D.__reduce__ = _Point2D___reduce__
576
+ del _Point2D___reduce__
577
+ def _Point2D___getitem__(self, idx):
578
+ return self.Get()[idx]
579
+ Point2D.__getitem__ = _Point2D___getitem__
580
+ del _Point2D___getitem__
581
+ def _Point2D___setitem__(self, idx, val):
582
+ if idx == 0: self.x = val
583
+ elif idx == 1: self.y = val
584
+ else: raise IndexError
585
+ Point2D.__setitem__ = _Point2D___setitem__
586
+ del _Point2D___setitem__
587
+ Point2D.__safe_for_unpickling__ = True
588
+
589
+ Point2D.IM = property(Point2D.GetIM)
590
+ def _Rect2D_GetIM(self):
591
+ """
592
+ Returns an immutable representation of the ``wx.Rect2D`` object, based on ``namedtuple``.
593
+
594
+ This new object is hashable and can be used as a dictionary key,
595
+ be added to sets, etc. It can be converted back into a real ``wx.Rect2D``
596
+ with a simple statement like this: ``obj = wx.Rect2D(imObj)``.
597
+ """
598
+ return _im_Rect2D(*self.Get())
599
+ Rect2D.GetIM = _Rect2D_GetIM
600
+ del _Rect2D_GetIM
601
+ def _Rect2D___str__(self):
602
+ return str(self.Get())
603
+ Rect2D.__str__ = _Rect2D___str__
604
+ del _Rect2D___str__
605
+ def _Rect2D___repr__(self):
606
+ return "wx.Rect2D"+str(self.Get())
607
+ Rect2D.__repr__ = _Rect2D___repr__
608
+ del _Rect2D___repr__
609
+ def _Rect2D___len__(self):
610
+ return len(self.Get())
611
+ Rect2D.__len__ = _Rect2D___len__
612
+ del _Rect2D___len__
613
+ def _Rect2D___nonzero__(self):
614
+ return self.Get() != (0,0,0,0)
615
+ Rect2D.__nonzero__ = _Rect2D___nonzero__
616
+ del _Rect2D___nonzero__
617
+ def _Rect2D___bool__(self):
618
+ return self.Get() != (0,0,0,0)
619
+ Rect2D.__bool__ = _Rect2D___bool__
620
+ del _Rect2D___bool__
621
+ def _Rect2D___reduce__(self):
622
+ return (Rect2D, self.Get())
623
+ Rect2D.__reduce__ = _Rect2D___reduce__
624
+ del _Rect2D___reduce__
625
+ def _Rect2D___getitem__(self, idx):
626
+ return self.Get()[idx]
627
+ Rect2D.__getitem__ = _Rect2D___getitem__
628
+ del _Rect2D___getitem__
629
+ def _Rect2D___setitem__(self, idx, val):
630
+ if idx == 0: self.x = val
631
+ elif idx == 1: self.y = val
632
+ elif idx == 2: self.width = val
633
+ elif idx == 3: self.height = val
634
+ else: raise IndexError
635
+ Rect2D.__setitem__ = _Rect2D___setitem__
636
+ del _Rect2D___setitem__
637
+ Rect2D.__safe_for_unpickling__ = True
638
+
639
+ Rect2D.IM = property(Rect2D.GetIM)
640
+ from collections import namedtuple
641
+ _im_Point2D = namedtuple('_im_Point2D', ['x', 'y'])
642
+ del namedtuple
643
+
644
+ from collections import namedtuple
645
+ _im_Rect2D = namedtuple('_im_Rect2D', ['x', 'y', 'width', 'height'])
646
+ del namedtuple
647
+
648
+ def _Position_GetIM(self):
649
+ """
650
+ Returns an immutable representation of the ``wx.Position`` object, based on ``namedtuple``.
651
+
652
+ This new object is hashable and can be used as a dictionary key,
653
+ be added to sets, etc. It can be converted back into a real ``wx.Position``
654
+ with a simple statement like this: ``obj = wx.Position(imObj)``.
655
+ """
656
+ return _im_Position(*self.Get())
657
+ Position.GetIM = _Position_GetIM
658
+ del _Position_GetIM
659
+ def _Position___str__(self):
660
+ return str(self.Get())
661
+ Position.__str__ = _Position___str__
662
+ del _Position___str__
663
+ def _Position___repr__(self):
664
+ return "wx.Position"+str(self.Get())
665
+ Position.__repr__ = _Position___repr__
666
+ del _Position___repr__
667
+ def _Position___len__(self):
668
+ return len(self.Get())
669
+ Position.__len__ = _Position___len__
670
+ del _Position___len__
671
+ def _Position___nonzero__(self):
672
+ return self.Get() != (0,0)
673
+ Position.__nonzero__ = _Position___nonzero__
674
+ del _Position___nonzero__
675
+ def _Position___bool__(self):
676
+ return self.Get() != (0,0)
677
+ Position.__bool__ = _Position___bool__
678
+ del _Position___bool__
679
+ def _Position___reduce__(self):
680
+ return (Position, self.Get())
681
+ Position.__reduce__ = _Position___reduce__
682
+ del _Position___reduce__
683
+ def _Position___getitem__(self, idx):
684
+ return self.Get()[idx]
685
+ Position.__getitem__ = _Position___getitem__
686
+ del _Position___getitem__
687
+ def _Position___setitem__(self, idx, val):
688
+ if idx == 0: self.Row = val
689
+ elif idx == 1: self.Col = val
690
+ else: raise IndexError
691
+ Position.__setitem__ = _Position___setitem__
692
+ del _Position___setitem__
693
+ Position.__safe_for_unpickling__ = True
694
+
695
+ Position.IM = property(Position.GetIM)
696
+ from collections import namedtuple
697
+ _im_Position = namedtuple('_im_Position', ['Row', 'Col'])
698
+ del namedtuple
699
+
700
+ def _Colour_GetIM(self):
701
+ """
702
+ Returns an immutable representation of the ``wx.Colour`` object, based on ``namedtuple``.
703
+
704
+ This new object is hashable and can be used as a dictionary key,
705
+ be added to sets, etc. It can be converted back into a real ``wx.Colour``
706
+ with a simple statement like this: ``obj = wx.Colour(imObj)``.
707
+ """
708
+ return _im_Colour(*self.Get())
709
+ Colour.GetIM = _Colour_GetIM
710
+ del _Colour_GetIM
711
+ def _Colour___str__(self):
712
+ return str(self.Get())
713
+ Colour.__str__ = _Colour___str__
714
+ del _Colour___str__
715
+ def _Colour___repr__(self):
716
+ return "wx.Colour"+str(self.Get())
717
+ Colour.__repr__ = _Colour___repr__
718
+ del _Colour___repr__
719
+ def _Colour___len__(self):
720
+ return len(self.Get())
721
+ Colour.__len__ = _Colour___len__
722
+ del _Colour___len__
723
+ def _Colour___reduce__(self):
724
+ return (Colour, self.Get())
725
+ Colour.__reduce__ = _Colour___reduce__
726
+ del _Colour___reduce__
727
+ def _Colour___getitem__(self, idx):
728
+ return self.Get()[idx]
729
+ Colour.__getitem__ = _Colour___getitem__
730
+ del _Colour___getitem__
731
+ def _Colour___setitem__(self, idx, val):
732
+ if idx == 0: self.red = val
733
+ elif idx == 1: self.green = val
734
+ elif idx == 2: self.blue = val
735
+ elif idx == 3: self.alpha = val
736
+ else: raise IndexError
737
+ Colour.__setitem__ = _Colour___setitem__
738
+ del _Colour___setitem__
739
+ Colour.__safe_for_unpickling__ = True
740
+
741
+ # These stock colours will be initialized when the wx.App object is created.
742
+ BLACK = Colour()
743
+ BLUE = Colour()
744
+ CYAN = Colour()
745
+ GREEN = Colour()
746
+ YELLOW = Colour()
747
+ LIGHT_GREY = Colour()
748
+ RED = Colour()
749
+ WHITE = Colour()
750
+
751
+ from collections import namedtuple
752
+ _im_Colour = namedtuple('_im_Colour', ['red', 'green', 'blue', 'alpha'])
753
+ del namedtuple
754
+
755
+ NamedColour = wx.deprecated(Colour, "Use Colour instead.")
756
+
757
+ ZipFSHandler = wx.deprecated(ArchiveFSHandler, "Use ArchiveFSHandler instead.")
758
+
759
+ def _Image_ConvertToBitmap(self, depth=-1):
760
+ """
761
+ ConvertToBitmap(depth=-1) -> Bitmap
762
+
763
+ Convert the image to a :class:`wx.Bitmap`.
764
+ """
765
+ bmp = wx.Bitmap(self, depth)
766
+ return bmp
767
+ Image.ConvertToBitmap = _Image_ConvertToBitmap
768
+ del _Image_ConvertToBitmap
769
+ def _Image_ConvertToMonoBitmap(self, red, green, blue):
770
+ """
771
+ ConvertToMonoBitmap(red, green, blue) -> Bitmap
772
+
773
+ Creates a monochrome version of the image and returns it as a :class:`wx.Bitmap`.
774
+ """
775
+ mono = self.ConvertToMono( red, green, blue )
776
+ bmp = wx.Bitmap( mono, 1 )
777
+ return bmp
778
+ Image.ConvertToMonoBitmap = _Image_ConvertToMonoBitmap
779
+ del _Image_ConvertToMonoBitmap
780
+ @wx.deprecatedMsg("Use :class:`Image` instead.")
781
+ def EmptyImage(width=0, height=0, clear=True):
782
+ """
783
+ A compatibility wrapper for the wx.Image(width, height) constructor
784
+ """
785
+ return Image(width, height, clear)
786
+
787
+ @wx.deprecatedMsg("Use bitmap.ConvertToImage instead.")
788
+ def ImageFromBitmap(bitmap):
789
+ """
790
+ Create a :class:`Image` from a :class:`wx.Bitmap`
791
+ """
792
+ return bitmap.ConvertToImage()
793
+
794
+ @wx.deprecatedMsg("Use :class:`Image` instead.")
795
+ def ImageFromStream(stream, type=BITMAP_TYPE_ANY, index=-1):
796
+ """
797
+ Load an image from a stream (file-like object)
798
+ """
799
+ return wx.Image(stream, type, index)
800
+
801
+ @wx.deprecatedMsg("Use :class:`Image` instead.")
802
+ def ImageFromData(width, height, data):
803
+ """
804
+ Compatibility wrapper for creating an image from RGB data
805
+ """
806
+ return Image(width, height, data)
807
+
808
+ @wx.deprecatedMsg("Use :class:`Image` instead.")
809
+ def ImageFromDataWithAlpha(width, height, data, alpha):
810
+ """
811
+ Compatibility wrapper for creating an image from RGB and Alpha data
812
+ """
813
+ return Image(width, height, data, alpha)
814
+
815
+ def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
816
+ """
817
+ Creates a :class:`Image` from the data in `dataBuffer`. The `dataBuffer`
818
+ parameter must be a Python object that implements the buffer interface,
819
+ such as a string, array, etc. The `dataBuffer` object is expected to
820
+ contain a series of RGB bytes and be width*height*3 bytes long. A buffer
821
+ object can optionally be supplied for the image's alpha channel data, and
822
+ it is expected to be width*height bytes long.
823
+
824
+ The :class:`Image` will be created with its data and alpha pointers initialized
825
+ to the memory address pointed to by the buffer objects, thus saving the
826
+ time needed to copy the image data from the buffer object to the :class:`Image`.
827
+ While this has advantages, it also has the shoot-yourself-in-the-foot
828
+ risks associated with sharing a C pointer between two objects.
829
+
830
+ To help alleviate the risk a reference to the data and alpha buffer
831
+ objects are kept with the :class:`Image`, so that they won't get deleted until
832
+ after the wx.Image is deleted. However please be aware that it is not
833
+ guaranteed that an object won't move its memory buffer to a new location
834
+ when it needs to resize its contents. If that happens then the :class:`Image`
835
+ will end up referring to an invalid memory location and could cause the
836
+ application to crash. Therefore care should be taken to not manipulate
837
+ the objects used for the data and alpha buffers in a way that would cause
838
+ them to change size.
839
+ """
840
+ img = Image(width, height)
841
+ img.SetDataBuffer(dataBuffer)
842
+ if alphaBuffer:
843
+ img.SetAlphaBuffer(alphaBuffer)
844
+ img._buffer = dataBuffer
845
+ img._alpha = alphaBuffer
846
+ return img
847
+
848
+ IMAGE_OPTION_QUALITY = "quality"
849
+ IMAGE_OPTION_FILENAME = "FileName"
850
+ IMAGE_OPTION_RESOLUTION = "Resolution"
851
+ IMAGE_OPTION_RESOLUTIONX = "ResolutionX"
852
+ IMAGE_OPTION_RESOLUTIONY = "ResolutionY"
853
+ IMAGE_OPTION_RESOLUTIONUNIT = "ResolutionUnit"
854
+ IMAGE_OPTION_MAX_WIDTH = "MaxWidth"
855
+ IMAGE_OPTION_MAX_HEIGHT = "MaxHeight"
856
+ IMAGE_OPTION_ORIGINAL_WIDTH = "OriginalWidth"
857
+ IMAGE_OPTION_ORIGINAL_HEIGHT = "OriginalHeight"
858
+ IMAGE_OPTION_BMP_FORMAT = "wxBMP_FORMAT"
859
+ IMAGE_OPTION_CUR_HOTSPOT_X = "HotSpotX"
860
+ IMAGE_OPTION_CUR_HOTSPOT_Y = "HotSpotY"
861
+ IMAGE_OPTION_GIF_COMMENT = "GifComment"
862
+ IMAGE_OPTION_GIF_TRANSPARENCY = "Transparency"
863
+ IMAGE_OPTION_GIF_TRANSPARENCY_HIGHLIGHT = "Highlight"
864
+ IMAGE_OPTION_GIF_TRANSPARENCY_UNCHANGED = "Unchanged"
865
+ IMAGE_OPTION_PNG_FORMAT = "PngFormat"
866
+ IMAGE_OPTION_PNG_BITDEPTH = "PngBitDepth"
867
+ IMAGE_OPTION_PNG_FILTER = "PngF"
868
+ IMAGE_OPTION_PNG_COMPRESSION_LEVEL = "PngZL"
869
+ IMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL = "PngZM"
870
+ IMAGE_OPTION_PNG_COMPRESSION_STRATEGY = "PngZS"
871
+ IMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE = "PngZB"
872
+ IMAGE_OPTION_PNG_DESCRIPTION = "PngDescription"
873
+ IMAGE_OPTION_TIFF_BITSPERSAMPLE = "BitsPerSample"
874
+ IMAGE_OPTION_TIFF_SAMPLESPERPIXEL = "SamplesPerPixel"
875
+ IMAGE_OPTION_TIFF_COMPRESSION = "Compression"
876
+ IMAGE_OPTION_TIFF_PHOTOMETRIC = "Photometric"
877
+ IMAGE_OPTION_TIFF_IMAGEDESCRIPTOR = "ImageDescriptor"
878
+ IMAGE_OPTION_WEBP_QUALITY = "WebPQuality"
879
+ IMAGE_OPTION_WEBP_FORMAT = "WebPFormat"
880
+ IMAGE_OPTION_TIFF_BITSPERSAMPLE = "BitsPerSample"
881
+ IMAGE_OPTION_TIFF_SAMPLESPERPIXEL = "SamplesPerPixel"
882
+ IMAGE_OPTION_TIFF_COMPRESSION = "Compression"
883
+ IMAGE_OPTION_TIFF_PHOTOMETRIC = "Photometric"
884
+ IMAGE_OPTION_TIFF_IMAGEDESCRIPTOR = "ImageDescriptor"
885
+ IMAGE_OPTION_GIF_COMMENT = "GifComment"
886
+ IMAGE_OPTION_PNG_FORMAT = "PngFormat"
887
+ IMAGE_OPTION_PNG_BITDEPTH = "PngBitDepth"
888
+ IMAGE_OPTION_PNG_FILTER = "PngF"
889
+ IMAGE_OPTION_PNG_COMPRESSION_LEVEL = "PngZL"
890
+ IMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL = "PngZM"
891
+ IMAGE_OPTION_PNG_COMPRESSION_STRATEGY = "PngZS"
892
+ IMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE = "PngZB"
893
+ IMAGE_OPTION_PNG_DESCRIPTION = "PngDescription"
894
+
895
+ @wx.deprecatedMsg("Use :meth:`wx.Bitmap.FromBuffer` or :meth:`wx.Bitmap.FromBufferAndAlpha` instead.")
896
+ def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None):
897
+ """
898
+ A compatibility wrapper for :meth:`wx.Bitmap.FromBuffer` and :meth:`wx.Bitmap.FromBufferAndAlpha`
899
+ """
900
+ if alphaBuffer is not None:
901
+ return Bitmap.FromBufferAndAlpha(width, height, dataBuffer, alphaBuffer)
902
+ else:
903
+ return Bitmap.FromBuffer(width, height, dataBuffer)
904
+
905
+ @wx.deprecatedMsg("Use :meth:`wx.Bitmap.FromBufferRGBA` instead.")
906
+ def BitmapFromBufferRGBA(width, height, dataBuffer):
907
+ """
908
+ A compatibility wrapper for :meth:`wx.Bitmap.FromBufferRGBA`
909
+ """
910
+ return Bitmap.FromBufferRGBA(width, height, dataBuffer)
911
+
912
+ @wx.deprecatedMsg("Use :meth:`wx.Bitmap.FromRGBA` instead.")
913
+ def EmptyBitmapRGBA(width, height, red=0, green=0, blue=0, alpha=0):
914
+ """
915
+ A compatibility wrapper for :meth:`wx.Bitmap.FromRGBA`
916
+ """
917
+ return Bitmap.FromRGBA(width, height, red, green, blue, alpha)
918
+
919
+ @wx.deprecatedMsg("Use :class:`wx.Bitmap` instead")
920
+ def EmptyBitmap(width, height, depth=BITMAP_SCREEN_DEPTH):
921
+ """
922
+ A compatibility wrapper for the wx.Bitmap(width, height, depth) constructor
923
+ """
924
+ return Bitmap(width, height, depth)
925
+
926
+ @wx.deprecatedMsg("Use :class:`wx.Bitmap` instead")
927
+ def BitmapFromImage(image):
928
+ """
929
+ A compatibility wrapper for the wx.Bitmap(wx.Image) constructor
930
+ """
931
+ return Bitmap(image)
932
+
933
+ @wx.deprecatedMsg("Use :class:`Icon` instead")
934
+ def EmptyIcon():
935
+ """
936
+ A compatibility wrapper for the :class:`Icon` constructor
937
+ """
938
+ return Icon()
939
+
940
+ def _Font_SetNoAntiAliasing(self, no=True):
941
+ pass
942
+ Font.SetNoAntiAliasing = wx.deprecated(_Font_SetNoAntiAliasing)
943
+ del _Font_SetNoAntiAliasing
944
+ def _Font_GetNoAntiAliasing(self):
945
+ pass
946
+ Font.GetNoAntiAliasing = wx.deprecated(_Font_GetNoAntiAliasing)
947
+ del _Font_GetNoAntiAliasing
948
+ # These stock fonts will be initialized when the wx.App object is created.
949
+ NORMAL_FONT = Font()
950
+ SMALL_FONT = Font()
951
+ ITALIC_FONT = Font()
952
+ SWISS_FONT = Font()
953
+
954
+ wx.DEFAULT = int(wx.FONTFAMILY_DEFAULT)
955
+ wx.DECORATIVE = int(wx.FONTFAMILY_DECORATIVE)
956
+ wx.ROMAN = int(wx.FONTFAMILY_ROMAN)
957
+ wx.SCRIPT = int(wx.FONTFAMILY_SCRIPT)
958
+ wx.SWISS = int(wx.FONTFAMILY_SWISS)
959
+ wx.MODERN = int(wx.FONTFAMILY_MODERN)
960
+ wx.TELETYPE = int(wx.FONTFAMILY_TELETYPE)
961
+
962
+ wx.NORMAL = int(wx.FONTWEIGHT_NORMAL)
963
+ wx.LIGHT = int(wx.FONTWEIGHT_LIGHT)
964
+ wx.BOLD = int(wx.FONTWEIGHT_BOLD)
965
+
966
+ wx.NORMAL = int(wx.FONTSTYLE_NORMAL)
967
+ wx.ITALIC = int(wx.FONTSTYLE_ITALIC)
968
+ wx.SLANT = int(wx.FONTSTYLE_SLANT)
969
+
970
+ # These stock pens will be initialized when the wx.App object is created.
971
+ RED_PEN = Pen()
972
+ BLUE_PEN = Pen()
973
+ CYAN_PEN = Pen()
974
+ GREEN_PEN = Pen()
975
+ YELLOW_PEN = Pen()
976
+ BLACK_PEN = Pen()
977
+ WHITE_PEN = Pen()
978
+ TRANSPARENT_PEN = Pen()
979
+ BLACK_DASHED_PEN = Pen()
980
+ GREY_PEN = Pen()
981
+ MEDIUM_GREY_PEN = Pen()
982
+ LIGHT_GREY_PEN = Pen()
983
+
984
+ wx.SOLID = int(wx.PENSTYLE_SOLID)
985
+ wx.DOT = int(wx.PENSTYLE_DOT)
986
+ wx.LONG_DASH = int(wx.PENSTYLE_LONG_DASH)
987
+ wx.SHORT_DASH = int(wx.PENSTYLE_SHORT_DASH)
988
+ wx.DOT_DASH = int(wx.PENSTYLE_DOT_DASH)
989
+ wx.USER_DASH = int(wx.PENSTYLE_USER_DASH)
990
+ wx.TRANSPARENT = int(wx.PENSTYLE_TRANSPARENT)
991
+
992
+ # These stock brushes will be initialized when the wx.App object is created.
993
+ BLUE_BRUSH = Brush()
994
+ GREEN_BRUSH = Brush()
995
+ YELLOW_BRUSH = Brush()
996
+ WHITE_BRUSH = Brush()
997
+ BLACK_BRUSH = Brush()
998
+ GREY_BRUSH = Brush()
999
+ MEDIUM_GREY_BRUSH = Brush()
1000
+ LIGHT_GREY_BRUSH = Brush()
1001
+ TRANSPARENT_BRUSH = Brush()
1002
+ CYAN_BRUSH = Brush()
1003
+ RED_BRUSH = Brush()
1004
+
1005
+ wx.STIPPLE_MASK_OPAQUE = int(wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE)
1006
+ wx.STIPPLE_MASK = int(wx.BRUSHSTYLE_STIPPLE_MASK)
1007
+ wx.STIPPLE = int(wx.BRUSHSTYLE_STIPPLE)
1008
+ wx.BDIAGONAL_HATCH = int(wx.BRUSHSTYLE_BDIAGONAL_HATCH)
1009
+ wx.CROSSDIAG_HATCH = int(wx.BRUSHSTYLE_CROSSDIAG_HATCH)
1010
+ wx.FDIAGONAL_HATCH = int(wx.BRUSHSTYLE_FDIAGONAL_HATCH)
1011
+ wx.CROSS_HATCH = int(wx.BRUSHSTYLE_CROSS_HATCH)
1012
+ wx.HORIZONTAL_HATCH = int(wx.BRUSHSTYLE_HORIZONTAL_HATCH)
1013
+ wx.VERTICAL_HATCH = int(wx.BRUSHSTYLE_VERTICAL_HATCH)
1014
+
1015
+ # These stock cursors will be initialized when the wx.App object is created.
1016
+ STANDARD_CURSOR = Cursor()
1017
+ HOURGLASS_CURSOR = Cursor()
1018
+ CROSS_CURSOR = Cursor()
1019
+
1020
+ StockCursor = wx.deprecated(Cursor, "Use Cursor instead.")
1021
+
1022
+ CursorFromImage = wx.deprecated(Cursor, "Use Cursor instead.")
1023
+
1024
+ def _Region___iter__(self):
1025
+ """
1026
+ Returns a rectangle iterator conforming to the Python iterator
1027
+ protocol.
1028
+ """
1029
+ return PyRegionIterator(self)
1030
+ Region.__iter__ = _Region___iter__
1031
+ del _Region___iter__
1032
+ class PyRegionIterator(object):
1033
+ "A Python iterator for wx.Region objects"
1034
+ def __init__(self, region):
1035
+ self._region = region
1036
+ self._iterator = wx.RegionIterator(region)
1037
+ def next(self):
1038
+ if not self._iterator:
1039
+ raise StopIteration
1040
+ rect = self._iterator.GetRect()
1041
+ if self._iterator.HaveRects():
1042
+ self._iterator.Next()
1043
+ return rect
1044
+ __next__ = next # for Python 3
1045
+
1046
+ def _DC_GetClippingRect(self):
1047
+ """
1048
+ Returns the rectangle surrounding the current clipping region as a wx.Rect.
1049
+ """
1050
+ rv, x, y, w, h = self.GetClippingBox()
1051
+ return wx.Rect(x,y,w,h)
1052
+ DC.GetClippingRect = _DC_GetClippingRect
1053
+ del _DC_GetClippingRect
1054
+ DC.DrawImageLabel = wx.deprecated(DC.DrawLabel, "Use DrawLabel instead.")
1055
+
1056
+ def _DC_GetBoundingBox(self):
1057
+ """
1058
+ GetBoundingBox() -> (x1,y1, x2,y2)
1059
+
1060
+ Returns the min and max points used in drawing commands so far.
1061
+ """
1062
+ return (self.MinX(), self.MinY(), self.MaxX(), self.MaxY())
1063
+ DC.GetBoundingBox = _DC_GetBoundingBox
1064
+ del _DC_GetBoundingBox
1065
+ DC.GetHDC = wx.deprecated(DC.GetHDC, "Use GetHandle instead.")
1066
+
1067
+ DC.GetCGContext = wx.deprecated(DC.GetCGContext, "Use GetHandle instead.")
1068
+
1069
+ DC.GetGdkDrawable = wx.deprecated(DC.GetGdkDrawable, "Use GetHandle instead.")
1070
+
1071
+ def _DC___enter__(self):
1072
+ return self
1073
+ DC.__enter__ = _DC___enter__
1074
+ del _DC___enter__
1075
+ def _DC___exit__(self, exc_type, exc_val, exc_tb):
1076
+ self.Destroy()
1077
+ DC.__exit__ = _DC___exit__
1078
+ del _DC___exit__
1079
+ def _DC_DrawPointList(self, points, pens=None):
1080
+ """
1081
+ Draw a list of points as quickly as possible.
1082
+
1083
+ :param points: A sequence of 2-element sequences representing
1084
+ each point to draw, (x,y).
1085
+ :param pens: If None, then the current pen is used. If a single
1086
+ pen then it will be used for all points. If a list of
1087
+ pens then there should be one for each point in points.
1088
+ """
1089
+ if pens is None:
1090
+ pens = []
1091
+ elif isinstance(pens, wx.Pen):
1092
+ pens = [pens]
1093
+ elif len(pens) != len(points):
1094
+ raise ValueError('points and pens must have same length')
1095
+ return self._DrawPointList(points, pens, [])
1096
+ DC.DrawPointList = _DC_DrawPointList
1097
+ del _DC_DrawPointList
1098
+ def _DC_DrawLineList(self, lines, pens=None):
1099
+ """
1100
+ Draw a list of lines as quickly as possible.
1101
+
1102
+ :param lines: A sequence of 4-element sequences representing
1103
+ each line to draw, (x1,y1, x2,y2).
1104
+ :param pens: If None, then the current pen is used. If a
1105
+ single pen then it will be used for all lines. If
1106
+ a list of pens then there should be one for each line
1107
+ in lines.
1108
+ """
1109
+ if pens is None:
1110
+ pens = []
1111
+ elif isinstance(pens, wx.Pen):
1112
+ pens = [pens]
1113
+ elif len(pens) != len(lines):
1114
+ raise ValueError('lines and pens must have same length')
1115
+ return self._DrawLineList(lines, pens, [])
1116
+ DC.DrawLineList = _DC_DrawLineList
1117
+ del _DC_DrawLineList
1118
+ def _DC_DrawRectangleList(self, rectangles, pens=None, brushes=None):
1119
+ """
1120
+ Draw a list of rectangles as quickly as possible.
1121
+
1122
+ :param rectangles: A sequence of 4-element sequences representing
1123
+ each rectangle to draw, (x,y, w,h).
1124
+ :param pens: If None, then the current pen is used. If a
1125
+ single pen then it will be used for all rectangles.
1126
+ If a list of pens then there should be one for each
1127
+ rectangle in rectangles.
1128
+ :param brushes: A brush or brushes to be used to fill the rectagles,
1129
+ with similar semantics as the pens parameter.
1130
+ """
1131
+ if pens is None:
1132
+ pens = []
1133
+ elif isinstance(pens, wx.Pen):
1134
+ pens = [pens]
1135
+ elif len(pens) != len(rectangles):
1136
+ raise ValueError('rectangles and pens must have same length')
1137
+ if brushes is None:
1138
+ brushes = []
1139
+ elif isinstance(brushes, wx.Brush):
1140
+ brushes = [brushes]
1141
+ elif len(brushes) != len(rectangles):
1142
+ raise ValueError('rectangles and brushes must have same length')
1143
+ return self._DrawRectangleList(rectangles, pens, brushes)
1144
+ DC.DrawRectangleList = _DC_DrawRectangleList
1145
+ del _DC_DrawRectangleList
1146
+ def _DC_DrawEllipseList(self, ellipses, pens=None, brushes=None):
1147
+ """
1148
+ Draw a list of ellipses as quickly as possible.
1149
+
1150
+ :param ellipses: A sequence of 4-element sequences representing
1151
+ each ellipse to draw, (x,y, w,h).
1152
+ :param pens: If None, then the current pen is used. If a
1153
+ single pen then it will be used for all ellipses.
1154
+ If a list of pens then there should be one for each
1155
+ ellipse in ellipses.
1156
+ :param brushes: A brush or brushes to be used to fill the ellipses,
1157
+ with similar semantics as the pens parameter.
1158
+ """
1159
+ if pens is None:
1160
+ pens = []
1161
+ elif isinstance(pens, wx.Pen):
1162
+ pens = [pens]
1163
+ elif len(pens) != len(ellipses):
1164
+ raise ValueError('ellipses and pens must have same length')
1165
+ if brushes is None:
1166
+ brushes = []
1167
+ elif isinstance(brushes, wx.Brush):
1168
+ brushes = [brushes]
1169
+ elif len(brushes) != len(ellipses):
1170
+ raise ValueError('ellipses and brushes must have same length')
1171
+ return self._DrawEllipseList(ellipses, pens, brushes)
1172
+ DC.DrawEllipseList = _DC_DrawEllipseList
1173
+ del _DC_DrawEllipseList
1174
+ def _DC_DrawPolygonList(self, polygons, pens=None, brushes=None):
1175
+ """
1176
+ Draw a list of polygons, each of which is a list of points.
1177
+
1178
+ :param polygons: A sequence of sequences of sequences.
1179
+ [[(x1,y1),(x2,y2),(x3,y3)...], [(x1,y1),(x2,y2),(x3,y3)...]]
1180
+
1181
+ :param pens: If None, then the current pen is used. If a
1182
+ single pen then it will be used for all polygons.
1183
+ If a list of pens then there should be one for each
1184
+ polygon.
1185
+ :param brushes: A brush or brushes to be used to fill the polygons,
1186
+ with similar semantics as the pens parameter.
1187
+ """
1188
+ if pens is None:
1189
+ pens = []
1190
+ elif isinstance(pens, wx.Pen):
1191
+ pens = [pens]
1192
+ elif len(pens) != len(polygons):
1193
+ raise ValueError('polygons and pens must have same length')
1194
+ if brushes is None:
1195
+ brushes = []
1196
+ elif isinstance(brushes, wx.Brush):
1197
+ brushes = [brushes]
1198
+ elif len(brushes) != len(polygons):
1199
+ raise ValueError('polygons and brushes must have same length')
1200
+ return self._DrawPolygonList(polygons, pens, brushes)
1201
+ DC.DrawPolygonList = _DC_DrawPolygonList
1202
+ del _DC_DrawPolygonList
1203
+ def _DC_DrawTextList(self, textList, coords, foregrounds=None, backgrounds=None):
1204
+ """
1205
+ Draw a list of strings using a list of coordinants for positioning each string.
1206
+
1207
+ :param textList: A list of strings
1208
+ :param coords: A list of (x,y) positions
1209
+ :param foregrounds: A list of `wx.Colour` objects to use for the
1210
+ foregrounds of the strings.
1211
+ :param backgrounds: A list of `wx.Colour` objects to use for the
1212
+ backgrounds of the strings.
1213
+
1214
+ NOTE: Make sure you set background mode to wx.Solid (DC.SetBackgroundMode)
1215
+ If you want backgrounds to do anything.
1216
+ """
1217
+ if type(textList) == type(''):
1218
+ textList = [textList]
1219
+ elif len(textList) != len(coords):
1220
+ raise ValueError('textlist and coords must have same length')
1221
+ if foregrounds is None:
1222
+ foregrounds = []
1223
+ elif isinstance(foregrounds, wx.Colour):
1224
+ foregrounds = [foregrounds]
1225
+ elif len(foregrounds) != len(coords):
1226
+ raise ValueError('foregrounds and coords must have same length')
1227
+ if backgrounds is None:
1228
+ backgrounds = []
1229
+ elif isinstance(backgrounds, wx.Colour):
1230
+ backgrounds = [backgrounds]
1231
+ elif len(backgrounds) != len(coords):
1232
+ raise ValueError('backgrounds and coords must have same length')
1233
+ return self._DrawTextList(textList, coords, foregrounds, backgrounds)
1234
+ DC.DrawTextList = _DC_DrawTextList
1235
+ del _DC_DrawTextList
1236
+ def _DC_DrawLinesFromBuffer(self, pyBuff):
1237
+ """
1238
+ Implementation of DrawLines that can use numpy arrays, or anything else that uses the
1239
+ python buffer protocol directly without any element conversion. This provides a
1240
+ significant performance increase over the standard DrawLines function.
1241
+
1242
+ The pyBuff argument needs to provide an array of C integers organized as
1243
+ x, y point pairs. The size of a C integer is platform dependent.
1244
+ With numpy, the intc data type will provide the appropriate element size.
1245
+
1246
+ If called with an object that doesn't support
1247
+ the python buffer protocol, or if the underlying element size does not
1248
+ match the size of a C integer, a TypeError exception is raised. If
1249
+ the buffer provided has float data with the same element size as a
1250
+ C integer, no error will be raised, but the lines will not be drawn
1251
+ in the appropriate places.
1252
+
1253
+ :param pyBuff: A python buffer containing integer pairs
1254
+ """
1255
+ return self._DrawLinesFromBuffer(pyBuff)
1256
+ DC.DrawLinesFromBuffer = _DC_DrawLinesFromBuffer
1257
+ del _DC_DrawLinesFromBuffer
1258
+ DC.BoundingBox = property(DC.GetBoundingBox)
1259
+ DC.ClippingRect = property(DC.GetClippingRect)
1260
+ def _DCClipper___enter__(self):
1261
+ return self
1262
+ DCClipper.__enter__ = _DCClipper___enter__
1263
+ del _DCClipper___enter__
1264
+ def _DCClipper___exit__(self, exc_type, exc_val, exc_tb):
1265
+ return False
1266
+ DCClipper.__exit__ = _DCClipper___exit__
1267
+ del _DCClipper___exit__
1268
+ def _DCBrushChanger___enter__(self):
1269
+ return self
1270
+ DCBrushChanger.__enter__ = _DCBrushChanger___enter__
1271
+ del _DCBrushChanger___enter__
1272
+ def _DCBrushChanger___exit__(self, exc_type, exc_val, exc_tb):
1273
+ return False
1274
+ DCBrushChanger.__exit__ = _DCBrushChanger___exit__
1275
+ del _DCBrushChanger___exit__
1276
+ def _DCPenChanger___enter__(self):
1277
+ return self
1278
+ DCPenChanger.__enter__ = _DCPenChanger___enter__
1279
+ del _DCPenChanger___enter__
1280
+ def _DCPenChanger___exit__(self, exc_type, exc_val, exc_tb):
1281
+ return False
1282
+ DCPenChanger.__exit__ = _DCPenChanger___exit__
1283
+ del _DCPenChanger___exit__
1284
+ def _DCTextColourChanger___enter__(self):
1285
+ return self
1286
+ DCTextColourChanger.__enter__ = _DCTextColourChanger___enter__
1287
+ del _DCTextColourChanger___enter__
1288
+ def _DCTextColourChanger___exit__(self, exc_type, exc_val, exc_tb):
1289
+ return False
1290
+ DCTextColourChanger.__exit__ = _DCTextColourChanger___exit__
1291
+ del _DCTextColourChanger___exit__
1292
+ def _DCFontChanger___enter__(self):
1293
+ return self
1294
+ DCFontChanger.__enter__ = _DCFontChanger___enter__
1295
+ del _DCFontChanger___enter__
1296
+ def _DCFontChanger___exit__(self, exc_type, exc_val, exc_tb):
1297
+ return False
1298
+ DCFontChanger.__exit__ = _DCFontChanger___exit__
1299
+ del _DCFontChanger___exit__
1300
+ def _DCTextBgColourChanger___enter__(self):
1301
+ return self
1302
+ DCTextBgColourChanger.__enter__ = _DCTextBgColourChanger___enter__
1303
+ del _DCTextBgColourChanger___enter__
1304
+ def _DCTextBgColourChanger___exit__(self, exc_type, exc_val, exc_tb):
1305
+ return False
1306
+ DCTextBgColourChanger.__exit__ = _DCTextBgColourChanger___exit__
1307
+ del _DCTextBgColourChanger___exit__
1308
+ def _DCTextBgModeChanger___enter__(self):
1309
+ return self
1310
+ DCTextBgModeChanger.__enter__ = _DCTextBgModeChanger___enter__
1311
+ del _DCTextBgModeChanger___enter__
1312
+ def _DCTextBgModeChanger___exit__(self, exc_type, exc_val, exc_tb):
1313
+ return False
1314
+ DCTextBgModeChanger.__exit__ = _DCTextBgModeChanger___exit__
1315
+ del _DCTextBgModeChanger___exit__
1316
+ GraphicsContext.DrawRotatedText = wx.deprecated(GraphicsContext.DrawText, 'Use DrawText instead.')
1317
+
1318
+ def _ctx_hold_ref(f):
1319
+ from functools import wraps
1320
+ @wraps(f)
1321
+ def wrapper(self, obj):
1322
+ ctx = f(self, obj)
1323
+ if ctx is not None:
1324
+ ctx._obj = obj
1325
+ return ctx
1326
+ return wrapper
1327
+ GraphicsRenderer.CreateContext = _ctx_hold_ref(GraphicsRenderer.CreateContext)
1328
+ GraphicsRenderer.CreateContextFromImage = _ctx_hold_ref(GraphicsRenderer.CreateContextFromImage)
1329
+ GraphicsRenderer.CreateContextFromUnknownDC = _ctx_hold_ref(GraphicsRenderer.CreateContextFromUnknownDC)
1330
+
1331
+ def _GraphicsRenderer_GetType(self):
1332
+ """
1333
+ Returns the name of the GraphicsRenderer class.
1334
+ """
1335
+ return self.GetClassInfo().GetClassName()
1336
+ GraphicsRenderer.GetType = _GraphicsRenderer_GetType
1337
+ del _GraphicsRenderer_GetType
1338
+ GraphicsRenderer.Type = property(GraphicsRenderer.GetType)
1339
+ def _PixelDataBase___iter__(self):
1340
+ """
1341
+ Create and return an iterator/generator object for traversing
1342
+ this pixel data object.
1343
+ """
1344
+ width = self.GetWidth()
1345
+ height = self.GetHeight()
1346
+ pixels = self.GetPixels() # this is the C++ iterator
1347
+
1348
+ # This class is a facade over the pixels object (using the one
1349
+ # in the enclosing scope) that only allows Get() and Set() to
1350
+ # be called.
1351
+ class PixelFacade(object):
1352
+ def Get(self):
1353
+ return pixels.Get()
1354
+ def Set(self, *args, **kw):
1355
+ return pixels.Set(*args, **kw)
1356
+ def __str__(self):
1357
+ return str(self.Get())
1358
+ def __repr__(self):
1359
+ return 'pixel(%d,%d): %s' % (x,y,self.Get())
1360
+ X = property(lambda self: x)
1361
+ Y = property(lambda self: y)
1362
+
1363
+ pf = PixelFacade()
1364
+ for y in range(height):
1365
+ pixels.MoveTo(self, 0, y)
1366
+ for x in range(width):
1367
+ # We always generate the same pf instance, but it
1368
+ # accesses the pixels object which we use to iterate
1369
+ # over the pixel buffer.
1370
+ yield pf
1371
+ pixels.nextPixel()
1372
+ PixelDataBase.__iter__ = _PixelDataBase___iter__
1373
+ del _PixelDataBase___iter__
1374
+ @wx.deprecated
1375
+ def GetAccelFromString(label):
1376
+ accel = wx.AcceleratorEntry()
1377
+ accel.FromString(label)
1378
+ return accel
1379
+
1380
+ def _LogNull___enter__(self):
1381
+ return self
1382
+ LogNull.__enter__ = _LogNull___enter__
1383
+ del _LogNull___enter__
1384
+ def _LogNull___exit__(self, exc_type, exc_val, exc_tb):
1385
+ return False
1386
+ LogNull.__exit__ = _LogNull___exit__
1387
+ del _LogNull___exit__
1388
+ def CustomDataFormat(format):
1389
+ return wx.DataFormat(format)
1390
+ CustomDataFormat = wx.deprecated(CustomDataFormat, "Use wx.DataFormat instead.")
1391
+
1392
+ PyDataObjectSimple = wx.deprecated(DataObjectSimple), 'Use DataObjectSimple instead.'
1393
+
1394
+ PyTextDataObject = wx.deprecated(TextDataObject, 'Use TextDataObject instead.')
1395
+
1396
+ PyBitmapDataObject = wx.deprecated(BitmapDataObject, 'Use TextDataObject instead.')
1397
+
1398
+ PyDropTarget = wx.deprecated(DropTarget, 'Use DropTarget instead.')
1399
+
1400
+ # Since wxTheClipboard is not really a global variable (it is a macro
1401
+ # that calls the Get static method) we can't declare it as a global
1402
+ # variable for the wrapper generator, otherwise it will try to run the
1403
+ # function at module import and the wxApp object won't exist yet. So
1404
+ # we'll use a class that will allow us to delay calling the Get until
1405
+ # wx.TheClipboard is actually being used for the first time.
1406
+ class _wxPyDelayedInitWrapper(object):
1407
+ def __init__(self, initfunc, *args, **kwargs):
1408
+ self._initfunc = initfunc
1409
+ self._args = args
1410
+ self._kwargs = kwargs
1411
+ self._instance = None
1412
+ def _checkInstance(self):
1413
+ if self._instance is None:
1414
+ if wx.GetApp():
1415
+ self._instance = self._initfunc(*self._args, **self._kwargs)
1416
+ def __getattr__(self, name):
1417
+ self._checkInstance()
1418
+ return getattr(self._instance, name)
1419
+ def __repr__(self):
1420
+ self._checkInstance()
1421
+ return repr(self._instance)
1422
+
1423
+ # context manager methods
1424
+ def __enter__(self):
1425
+ self._checkInstance()
1426
+ if not self.Open():
1427
+ raise RuntimeError('Unable to open clipboard.')
1428
+ return self
1429
+ def __exit__(self, exc_type, exc_val, exc_tb):
1430
+ self.Close()
1431
+
1432
+ TheClipboard = _wxPyDelayedInitWrapper(Clipboard.Get)
1433
+
1434
+ def _ConfigBase_ReadInt(self, key, defaultVal=0):
1435
+ rv = self._cpp_ReadInt(key, defaultVal)
1436
+ return rv
1437
+ ConfigBase.ReadInt = _ConfigBase_ReadInt
1438
+ del _ConfigBase_ReadInt
1439
+ def _ConfigPathChanger___enter__(self):
1440
+ return self
1441
+ ConfigPathChanger.__enter__ = _ConfigPathChanger___enter__
1442
+ del _ConfigPathChanger___enter__
1443
+ def _ConfigPathChanger___exit__(self, exc_type, exc_val, exc_tb):
1444
+ return False
1445
+ ConfigPathChanger.__exit__ = _ConfigPathChanger___exit__
1446
+ del _ConfigPathChanger___exit__
1447
+ # For 2.8 compatibility
1448
+ KeyboardState.m_controlDown = wx.deprecated(KeyboardState.controlDown, "Use controlDown instead.")
1449
+ KeyboardState.m_shiftDown = wx.deprecated(KeyboardState.shiftDown, "Use shiftDown instead.")
1450
+ KeyboardState.m_altDown = wx.deprecated(KeyboardState.altDown, "Use altDown instead.")
1451
+ KeyboardState.m_metaDown = wx.deprecated(KeyboardState.metaDown, "Use metaDown instead.")
1452
+
1453
+ def _EvtHandler_Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
1454
+ """
1455
+ Bind an event to an event handler.
1456
+
1457
+ :param event: One of the ``EVT_*`` event binder objects that
1458
+ specifies the type of event to bind.
1459
+
1460
+ :param handler: A callable object to be invoked when the
1461
+ event is delivered to self. Pass ``None`` to
1462
+ disconnect an event handler.
1463
+
1464
+ :param source: Sometimes the event originates from a
1465
+ different window than self, but you still
1466
+ want to catch it in self. (For example, a
1467
+ button event delivered to a frame.) By
1468
+ passing the source of the event, the event
1469
+ handling system is able to differentiate
1470
+ between the same event type from different
1471
+ controls.
1472
+
1473
+ :param id: Used to spcify the event source by ID instead
1474
+ of instance.
1475
+
1476
+ :param id2: Used when it is desirable to bind a handler
1477
+ to a range of IDs, such as with EVT_MENU_RANGE.
1478
+ """
1479
+ assert isinstance(event, wx.PyEventBinder)
1480
+ assert callable(handler) or handler is None
1481
+ assert source is None or hasattr(source, 'GetId')
1482
+ if source is not None:
1483
+ id = source.GetId()
1484
+ event.Bind(self, id, id2, handler)
1485
+ EvtHandler.Bind = _EvtHandler_Bind
1486
+ del _EvtHandler_Bind
1487
+ def _EvtHandler_Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY, handler=None):
1488
+ """
1489
+ Disconnects the event handler binding for event from `self`.
1490
+ Returns ``True`` if successful.
1491
+ """
1492
+ if source is not None:
1493
+ id = source.GetId()
1494
+ return event.Unbind(self, id, id2, handler)
1495
+ EvtHandler.Unbind = _EvtHandler_Unbind
1496
+ del _EvtHandler_Unbind
1497
+ def _EventBlocker___enter__(self):
1498
+ return self
1499
+ EventBlocker.__enter__ = _EventBlocker___enter__
1500
+ del _EventBlocker___enter__
1501
+ def _EventBlocker___exit__(self, exc_type, exc_val, exc_tb):
1502
+ return False
1503
+ EventBlocker.__exit__ = _EventBlocker___exit__
1504
+ del _EventBlocker___exit__
1505
+ def _PropagationDisabler___enter__(self):
1506
+ return self
1507
+ PropagationDisabler.__enter__ = _PropagationDisabler___enter__
1508
+ del _PropagationDisabler___enter__
1509
+ def _PropagationDisabler___exit__(self, exc_type, exc_val, exc_tb):
1510
+ return False
1511
+ PropagationDisabler.__exit__ = _PropagationDisabler___exit__
1512
+ del _PropagationDisabler___exit__
1513
+ def _PropagateOnce___enter__(self):
1514
+ return self
1515
+ PropagateOnce.__enter__ = _PropagateOnce___enter__
1516
+ del _PropagateOnce___enter__
1517
+ def _PropagateOnce___exit__(self, exc_type, exc_val, exc_tb):
1518
+ return False
1519
+ PropagateOnce.__exit__ = _PropagateOnce___exit__
1520
+ del _PropagateOnce___exit__
1521
+ def _CommandEvent_GetClientObject(self):
1522
+ """
1523
+ Alias for :meth:`GetClientData`
1524
+ """
1525
+ return self.GetClientData()
1526
+ CommandEvent.GetClientObject = _CommandEvent_GetClientObject
1527
+ del _CommandEvent_GetClientObject
1528
+ def _CommandEvent_SetClientObject(self, data):
1529
+ """
1530
+ Alias for :meth:`SetClientData`
1531
+ """
1532
+ self.SetClientData(data)
1533
+ CommandEvent.SetClientObject = _CommandEvent_SetClientObject
1534
+ del _CommandEvent_SetClientObject
1535
+ CommandEvent.ClientData = property(CommandEvent.GetClientData, CommandEvent.SetClientData)
1536
+ class PyEventBinder(object):
1537
+ """
1538
+ Instances of this class are used to bind specific events to event handlers.
1539
+ """
1540
+ def __init__(self, evtType, expectedIDs=0):
1541
+ if expectedIDs not in [0, 1, 2]:
1542
+ raise ValueError("Invalid number of expectedIDs")
1543
+ self.expectedIDs = expectedIDs
1544
+
1545
+ if isinstance(evtType, (list, tuple)):
1546
+ self.evtType = list(evtType)
1547
+ else:
1548
+ self.evtType = [evtType]
1549
+
1550
+ def Bind(self, target, id1, id2, function):
1551
+ """
1552
+ Bind this set of event types to target using its Connect() method.
1553
+ """
1554
+ for et in self.evtType:
1555
+ target.Connect(id1, id2, et, function)
1556
+
1557
+ def Unbind(self, target, id1, id2, handler=None):
1558
+ """
1559
+ Remove an event binding.
1560
+ """
1561
+ success = 0
1562
+ for et in self.evtType:
1563
+ success += int(target.Disconnect(id1, id2, et, handler))
1564
+ return success != 0
1565
+
1566
+ def _getEvtType(self):
1567
+ """
1568
+ Make it easy to get to the default wxEventType typeID for this
1569
+ event binder.
1570
+ """
1571
+ return self.evtType[0]
1572
+
1573
+ typeId = property(_getEvtType)
1574
+ @wx.deprecatedMsg("Use :meth:`EvtHandler.Bind` instead.")
1575
+ def __call__(self, *args):
1576
+ """
1577
+ For backwards compatibility with the old ``EVT_*`` functions.
1578
+ Should be called with either (window, func), (window, ID,
1579
+ func) or (window, ID1, ID2, func) parameters depending on the
1580
+ type of the event.
1581
+ """
1582
+ assert len(args) == 2 + self.expectedIDs
1583
+ id1 = ID_ANY
1584
+ id2 = ID_ANY
1585
+ target = args[0]
1586
+ if self.expectedIDs == 0:
1587
+ func = args[1]
1588
+ elif self.expectedIDs == 1:
1589
+ id1 = args[1]
1590
+ func = args[2]
1591
+ elif self.expectedIDs == 2:
1592
+ id1 = args[1]
1593
+ id2 = args[2]
1594
+ func = args[3]
1595
+ else:
1596
+ raise ValueError("Unexpected number of IDs")
1597
+
1598
+ self.Bind(target, id1, id2, func)
1599
+
1600
+
1601
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1602
+ # This code block was included from src/event_ex.py
1603
+ # Create some event binders
1604
+ EVT_SIZE = wx.PyEventBinder( wxEVT_SIZE )
1605
+ EVT_SIZING = wx.PyEventBinder( wxEVT_SIZING )
1606
+ EVT_MOVE = wx.PyEventBinder( wxEVT_MOVE )
1607
+ EVT_MOVING = wx.PyEventBinder( wxEVT_MOVING )
1608
+ EVT_MOVE_START = wx.PyEventBinder( wxEVT_MOVE_START )
1609
+ EVT_MOVE_END = wx.PyEventBinder( wxEVT_MOVE_END )
1610
+ EVT_CLOSE = wx.PyEventBinder( wxEVT_CLOSE_WINDOW )
1611
+ EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
1612
+ EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
1613
+ EVT_PAINT = wx.PyEventBinder( wxEVT_PAINT )
1614
+ EVT_NC_PAINT = wx.PyEventBinder( wxEVT_NC_PAINT )
1615
+ EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND )
1616
+ EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR )
1617
+ EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN )
1618
+ EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP )
1619
+ EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1)
1620
+ EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK )
1621
+ EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN )
1622
+ EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE )
1623
+ EVT_MENU_HIGHLIGHT = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT, 1)
1624
+ EVT_MENU_HIGHLIGHT_ALL = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT )
1625
+ EVT_SET_FOCUS = wx.PyEventBinder( wxEVT_SET_FOCUS )
1626
+ EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS )
1627
+ EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS )
1628
+ EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE )
1629
+ EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP )
1630
+ EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE )
1631
+ EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES )
1632
+ EVT_INIT_DIALOG = wx.PyEventBinder( wxEVT_INIT_DIALOG )
1633
+ EVT_SYS_COLOUR_CHANGED = wx.PyEventBinder( wxEVT_SYS_COLOUR_CHANGED )
1634
+ EVT_DISPLAY_CHANGED = wx.PyEventBinder( wxEVT_DISPLAY_CHANGED )
1635
+ EVT_DPI_CHANGED = wx.PyEventBinder( wxEVT_DPI_CHANGED )
1636
+ EVT_SHOW = wx.PyEventBinder( wxEVT_SHOW )
1637
+ EVT_MAXIMIZE = wx.PyEventBinder( wxEVT_MAXIMIZE )
1638
+ EVT_ICONIZE = wx.PyEventBinder( wxEVT_ICONIZE )
1639
+ EVT_NAVIGATION_KEY = wx.PyEventBinder( wxEVT_NAVIGATION_KEY )
1640
+ EVT_PALETTE_CHANGED = wx.PyEventBinder( wxEVT_PALETTE_CHANGED )
1641
+ EVT_QUERY_NEW_PALETTE = wx.PyEventBinder( wxEVT_QUERY_NEW_PALETTE )
1642
+ EVT_WINDOW_CREATE = wx.PyEventBinder( wxEVT_CREATE )
1643
+ EVT_WINDOW_DESTROY = wx.PyEventBinder( wxEVT_DESTROY )
1644
+ EVT_SET_CURSOR = wx.PyEventBinder( wxEVT_SET_CURSOR )
1645
+ EVT_MOUSE_CAPTURE_CHANGED = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_CHANGED )
1646
+ EVT_MOUSE_CAPTURE_LOST = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_LOST )
1647
+
1648
+ EVT_LEFT_DOWN = wx.PyEventBinder( wxEVT_LEFT_DOWN )
1649
+ EVT_LEFT_UP = wx.PyEventBinder( wxEVT_LEFT_UP )
1650
+ EVT_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_MIDDLE_DOWN )
1651
+ EVT_MIDDLE_UP = wx.PyEventBinder( wxEVT_MIDDLE_UP )
1652
+ EVT_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIGHT_DOWN )
1653
+ EVT_RIGHT_UP = wx.PyEventBinder( wxEVT_RIGHT_UP )
1654
+ EVT_MOTION = wx.PyEventBinder( wxEVT_MOTION )
1655
+ EVT_LEFT_DCLICK = wx.PyEventBinder( wxEVT_LEFT_DCLICK )
1656
+ EVT_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_MIDDLE_DCLICK )
1657
+ EVT_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_RIGHT_DCLICK )
1658
+ EVT_LEAVE_WINDOW = wx.PyEventBinder( wxEVT_LEAVE_WINDOW )
1659
+ EVT_ENTER_WINDOW = wx.PyEventBinder( wxEVT_ENTER_WINDOW )
1660
+ EVT_MOUSEWHEEL = wx.PyEventBinder( wxEVT_MOUSEWHEEL )
1661
+ EVT_MOUSE_AUX1_DOWN = wx.PyEventBinder( wxEVT_AUX1_DOWN )
1662
+ EVT_MOUSE_AUX1_UP = wx.PyEventBinder( wxEVT_AUX1_UP )
1663
+ EVT_MOUSE_AUX1_DCLICK = wx.PyEventBinder( wxEVT_AUX1_DCLICK )
1664
+ EVT_MOUSE_AUX2_DOWN = wx.PyEventBinder( wxEVT_AUX2_DOWN )
1665
+ EVT_MOUSE_AUX2_UP = wx.PyEventBinder( wxEVT_AUX2_UP )
1666
+ EVT_MOUSE_AUX2_DCLICK = wx.PyEventBinder( wxEVT_AUX2_DCLICK )
1667
+
1668
+ EVT_MOUSE_EVENTS = wx.PyEventBinder([ wxEVT_LEFT_DOWN,
1669
+ wxEVT_LEFT_UP,
1670
+ wxEVT_MIDDLE_DOWN,
1671
+ wxEVT_MIDDLE_UP,
1672
+ wxEVT_RIGHT_DOWN,
1673
+ wxEVT_RIGHT_UP,
1674
+ wxEVT_MOTION,
1675
+ wxEVT_LEFT_DCLICK,
1676
+ wxEVT_MIDDLE_DCLICK,
1677
+ wxEVT_RIGHT_DCLICK,
1678
+ wxEVT_ENTER_WINDOW,
1679
+ wxEVT_LEAVE_WINDOW,
1680
+ wxEVT_MOUSEWHEEL,
1681
+ wxEVT_AUX1_DOWN,
1682
+ wxEVT_AUX1_UP,
1683
+ wxEVT_AUX1_DCLICK,
1684
+ wxEVT_AUX2_DOWN,
1685
+ wxEVT_AUX2_UP,
1686
+ wxEVT_AUX2_DCLICK,
1687
+ ])
1688
+ EVT_MAGNIFY = wx.PyEventBinder( wxEVT_MAGNIFY )
1689
+
1690
+
1691
+ # Scrolling from wxWindow (sent to wxScrolledWindow)
1692
+ EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP,
1693
+ wxEVT_SCROLLWIN_BOTTOM,
1694
+ wxEVT_SCROLLWIN_LINEUP,
1695
+ wxEVT_SCROLLWIN_LINEDOWN,
1696
+ wxEVT_SCROLLWIN_PAGEUP,
1697
+ wxEVT_SCROLLWIN_PAGEDOWN,
1698
+ wxEVT_SCROLLWIN_THUMBTRACK,
1699
+ wxEVT_SCROLLWIN_THUMBRELEASE,
1700
+ ])
1701
+
1702
+ EVT_SCROLLWIN_TOP = wx.PyEventBinder( wxEVT_SCROLLWIN_TOP )
1703
+ EVT_SCROLLWIN_BOTTOM = wx.PyEventBinder( wxEVT_SCROLLWIN_BOTTOM )
1704
+ EVT_SCROLLWIN_LINEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEUP )
1705
+ EVT_SCROLLWIN_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEDOWN )
1706
+ EVT_SCROLLWIN_PAGEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEUP )
1707
+ EVT_SCROLLWIN_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEDOWN )
1708
+ EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK )
1709
+ EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE )
1710
+
1711
+ # Scrolling from wx.Slider and wx.ScrollBar
1712
+ EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
1713
+ wxEVT_SCROLL_BOTTOM,
1714
+ wxEVT_SCROLL_LINEUP,
1715
+ wxEVT_SCROLL_LINEDOWN,
1716
+ wxEVT_SCROLL_PAGEUP,
1717
+ wxEVT_SCROLL_PAGEDOWN,
1718
+ wxEVT_SCROLL_THUMBTRACK,
1719
+ wxEVT_SCROLL_THUMBRELEASE,
1720
+ wxEVT_SCROLL_CHANGED,
1721
+ ])
1722
+
1723
+ EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP )
1724
+ EVT_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM )
1725
+ EVT_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP )
1726
+ EVT_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN )
1727
+ EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP )
1728
+ EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN )
1729
+ EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK )
1730
+ EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE )
1731
+ EVT_SCROLL_CHANGED = wx.PyEventBinder( wxEVT_SCROLL_CHANGED )
1732
+ EVT_SCROLL_ENDSCROLL = EVT_SCROLL_CHANGED
1733
+
1734
+ # Scrolling from wx.Slider and wx.ScrollBar, with an id
1735
+ EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
1736
+ wxEVT_SCROLL_BOTTOM,
1737
+ wxEVT_SCROLL_LINEUP,
1738
+ wxEVT_SCROLL_LINEDOWN,
1739
+ wxEVT_SCROLL_PAGEUP,
1740
+ wxEVT_SCROLL_PAGEDOWN,
1741
+ wxEVT_SCROLL_THUMBTRACK,
1742
+ wxEVT_SCROLL_THUMBRELEASE,
1743
+ wxEVT_SCROLL_CHANGED,
1744
+ ], 1)
1745
+
1746
+ EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1)
1747
+ EVT_COMMAND_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM, 1)
1748
+ EVT_COMMAND_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1)
1749
+ EVT_COMMAND_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1)
1750
+ EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1)
1751
+ EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1)
1752
+ EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1)
1753
+ EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1)
1754
+ EVT_COMMAND_SCROLL_CHANGED = wx.PyEventBinder( wxEVT_SCROLL_CHANGED, 1)
1755
+ EVT_COMMAND_SCROLL_ENDSCROLL = EVT_COMMAND_SCROLL_CHANGED
1756
+
1757
+ EVT_BUTTON = wx.PyEventBinder( wxEVT_BUTTON, 1)
1758
+ EVT_CHECKBOX = wx.PyEventBinder( wxEVT_CHECKBOX, 1)
1759
+ EVT_CHOICE = wx.PyEventBinder( wxEVT_CHOICE, 1)
1760
+ EVT_LISTBOX = wx.PyEventBinder( wxEVT_LISTBOX, 1)
1761
+ EVT_LISTBOX_DCLICK = wx.PyEventBinder( wxEVT_LISTBOX_DCLICK, 1)
1762
+ EVT_MENU = wx.PyEventBinder( wxEVT_MENU, 1)
1763
+ EVT_MENU_RANGE = wx.PyEventBinder( wxEVT_MENU, 2)
1764
+ EVT_SLIDER = wx.PyEventBinder( wxEVT_SLIDER, 1)
1765
+ EVT_RADIOBOX = wx.PyEventBinder( wxEVT_RADIOBOX, 1)
1766
+ EVT_RADIOBUTTON = wx.PyEventBinder( wxEVT_RADIOBUTTON, 1)
1767
+
1768
+ EVT_SCROLLBAR = wx.PyEventBinder( wxEVT_SCROLLBAR, 1)
1769
+ EVT_VLBOX = wx.PyEventBinder( wxEVT_VLBOX, 1)
1770
+ EVT_COMBOBOX = wx.PyEventBinder( wxEVT_COMBOBOX, 1)
1771
+ EVT_TOOL = wx.PyEventBinder( wxEVT_TOOL, 1)
1772
+ EVT_TOOL_RANGE = wx.PyEventBinder( wxEVT_TOOL, 2)
1773
+ EVT_TOOL_RCLICKED = wx.PyEventBinder( wxEVT_TOOL_RCLICKED, 1)
1774
+ EVT_TOOL_RCLICKED_RANGE = wx.PyEventBinder( wxEVT_TOOL_RCLICKED, 2)
1775
+ EVT_TOOL_ENTER = wx.PyEventBinder( wxEVT_TOOL_ENTER, 1)
1776
+ EVT_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_TOOL_DROPDOWN, 1)
1777
+ EVT_CHECKLISTBOX = wx.PyEventBinder( wxEVT_CHECKLISTBOX, 1)
1778
+ EVT_COMBOBOX_DROPDOWN = wx.PyEventBinder( wxEVT_COMBOBOX_DROPDOWN , 1)
1779
+ EVT_COMBOBOX_CLOSEUP = wx.PyEventBinder( wxEVT_COMBOBOX_CLOSEUP , 1)
1780
+
1781
+ EVT_COMMAND_LEFT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_CLICK, 1)
1782
+ EVT_COMMAND_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_DCLICK, 1)
1783
+ EVT_COMMAND_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_CLICK, 1)
1784
+ EVT_COMMAND_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_DCLICK, 1)
1785
+ EVT_COMMAND_SET_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_SET_FOCUS, 1)
1786
+ EVT_COMMAND_KILL_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_KILL_FOCUS, 1)
1787
+ EVT_COMMAND_ENTER = wx.PyEventBinder( wxEVT_COMMAND_ENTER, 1)
1788
+
1789
+ EVT_HELP = wx.PyEventBinder( wxEVT_HELP, 1)
1790
+ EVT_HELP_RANGE = wx.PyEventBinder( wxEVT_HELP, 2)
1791
+ EVT_DETAILED_HELP = wx.PyEventBinder( wxEVT_DETAILED_HELP, 1)
1792
+ EVT_DETAILED_HELP_RANGE = wx.PyEventBinder( wxEVT_DETAILED_HELP, 2)
1793
+
1794
+ EVT_IDLE = wx.PyEventBinder( wxEVT_IDLE )
1795
+
1796
+ EVT_UPDATE_UI = wx.PyEventBinder( wxEVT_UPDATE_UI, 1)
1797
+ EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2)
1798
+
1799
+ EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU )
1800
+
1801
+ EVT_THREAD = wx.PyEventBinder( wxEVT_THREAD )
1802
+
1803
+ EVT_WINDOW_MODAL_DIALOG_CLOSED = wx.PyEventBinder( wxEVT_WINDOW_MODAL_DIALOG_CLOSED )
1804
+
1805
+ EVT_JOY_BUTTON_DOWN = wx.PyEventBinder( wxEVT_JOY_BUTTON_DOWN )
1806
+ EVT_JOY_BUTTON_UP = wx.PyEventBinder( wxEVT_JOY_BUTTON_UP )
1807
+ EVT_JOY_MOVE = wx.PyEventBinder( wxEVT_JOY_MOVE )
1808
+ EVT_JOY_ZMOVE = wx.PyEventBinder( wxEVT_JOY_ZMOVE )
1809
+ EVT_JOYSTICK_EVENTS = wx.PyEventBinder([ wxEVT_JOY_BUTTON_DOWN,
1810
+ wxEVT_JOY_BUTTON_UP,
1811
+ wxEVT_JOY_MOVE,
1812
+ wxEVT_JOY_ZMOVE,
1813
+ ])
1814
+
1815
+ EVT_GESTURE_PAN = wx.PyEventBinder( wxEVT_GESTURE_PAN )
1816
+ EVT_GESTURE_ZOOM = wx.PyEventBinder( wxEVT_GESTURE_ZOOM )
1817
+ EVT_GESTURE_ROTATE = wx.PyEventBinder( wxEVT_GESTURE_ROTATE )
1818
+ EVT_TWO_FINGER_TAP = wx.PyEventBinder( wxEVT_TWO_FINGER_TAP )
1819
+ EVT_LONG_PRESS = wx.PyEventBinder( wxEVT_LONG_PRESS )
1820
+ EVT_PRESS_AND_TAP = wx.PyEventBinder( wxEVT_PRESS_AND_TAP )
1821
+
1822
+ EVT_CLIPBOARD_CHANGED = wx.PyEventBinder(wxEVT_CLIPBOARD_CHANGED, 1)
1823
+
1824
+ EVT_FULLSCREEN = wx.PyEventBinder(wxEVT_FULLSCREEN, 1)
1825
+
1826
+ # deprecated wxEVT aliases
1827
+ wxEVT_COMMAND_BUTTON_CLICKED = wxEVT_BUTTON
1828
+ wxEVT_COMMAND_CHECKBOX_CLICKED = wxEVT_CHECKBOX
1829
+ wxEVT_COMMAND_CHOICE_SELECTED = wxEVT_CHOICE
1830
+ wxEVT_COMMAND_LISTBOX_SELECTED = wxEVT_LISTBOX
1831
+ wxEVT_COMMAND_LISTBOX_DOUBLECLICKED = wxEVT_LISTBOX_DCLICK
1832
+ wxEVT_COMMAND_CHECKLISTBOX_TOGGLED = wxEVT_CHECKLISTBOX
1833
+ wxEVT_COMMAND_MENU_SELECTED = wxEVT_MENU
1834
+ wxEVT_COMMAND_TOOL_CLICKED = wxEVT_TOOL
1835
+ wxEVT_COMMAND_SLIDER_UPDATED = wxEVT_SLIDER
1836
+ wxEVT_COMMAND_RADIOBOX_SELECTED = wxEVT_RADIOBOX
1837
+ wxEVT_COMMAND_RADIOBUTTON_SELECTED = wxEVT_RADIOBUTTON
1838
+ wxEVT_COMMAND_SCROLLBAR_UPDATED = wxEVT_SCROLLBAR
1839
+ wxEVT_COMMAND_VLBOX_SELECTED = wxEVT_VLBOX
1840
+ wxEVT_COMMAND_COMBOBOX_SELECTED = wxEVT_COMBOBOX
1841
+ wxEVT_COMMAND_TOOL_RCLICKED = wxEVT_TOOL_RCLICKED
1842
+ wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED = wxEVT_TOOL_DROPDOWN
1843
+ wxEVT_COMMAND_TOOL_ENTER = wxEVT_TOOL_ENTER
1844
+ wxEVT_COMMAND_COMBOBOX_DROPDOWN = wxEVT_COMBOBOX_DROPDOWN
1845
+ wxEVT_COMMAND_COMBOBOX_CLOSEUP = wxEVT_COMBOBOX_CLOSEUP
1846
+
1847
+ # End of included code block
1848
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1849
+
1850
+ PyEvtHandler = wx.deprecated(EvtHandler, "Use :class:`EvtHandler` instead.")
1851
+
1852
+ def _PyEvent_Clone(self):
1853
+ """
1854
+ Make a new instance of the event that is a copy of self.
1855
+
1856
+ Through the magic of Python this implementation should work for
1857
+ this and all derived classes.
1858
+ """
1859
+ # Create a new instance of the same type as this instance and
1860
+ # then invoke the C++ copy constructor to copy the C++ parts and
1861
+ # any custom attributes.
1862
+ clone = wx.PyEvent.__new__(self.__class__)
1863
+ wx.PyEvent.__init__(clone, self)
1864
+ return clone
1865
+ PyEvent.Clone = _PyEvent_Clone
1866
+ del _PyEvent_Clone
1867
+ def _PyCommandEvent_Clone(self):
1868
+ """
1869
+ Make a new instance of the event that is a copy of self.
1870
+
1871
+ Through the magic of Python this implementation should work for
1872
+ this and all derived classes.
1873
+ """
1874
+ # Create a new instance of the same type as this instance and
1875
+ # then invoke the C++ copy constructor to copy the C++ parts and
1876
+ # any custom attributes.
1877
+ clone = wx.PyCommandEvent.__new__(self.__class__)
1878
+ wx.PyCommandEvent.__init__(clone, self)
1879
+ return clone
1880
+ PyCommandEvent.Clone = _PyCommandEvent_Clone
1881
+ del _PyCommandEvent_Clone
1882
+ def _Sizer_AddMany(self, items):
1883
+ """
1884
+ :meth:`AddMany` is a convenience method for adding several items to a sizer
1885
+ at one time. Simply pass it a list of tuples, where each tuple
1886
+ consists of the parameters that you would normally pass to the :meth:`Add`
1887
+ method.
1888
+ """
1889
+ for item in items:
1890
+ if not isinstance(item, (tuple, list)):
1891
+ item = (item, )
1892
+ self.Add(*item)
1893
+ Sizer.AddMany = _Sizer_AddMany
1894
+ del _Sizer_AddMany
1895
+ def _Sizer___nonzero__(self):
1896
+ """
1897
+ Can be used to test if the C++ part of the sizer still exists, with
1898
+ code like this::
1899
+
1900
+ if theSizer:
1901
+ doSomething()
1902
+ """
1903
+ import wx.siplib
1904
+ return not wx.siplib.isdeleted(self)
1905
+ Sizer.__nonzero__ = _Sizer___nonzero__
1906
+ del _Sizer___nonzero__
1907
+ def _Sizer___iter__(self):
1908
+ """
1909
+ A Python convenience method that allows Sizers to act as iterables that will yield their wx.SizerItems.
1910
+ """
1911
+ for item in self.GetChildren(): yield item
1912
+ Sizer.__iter__ = _Sizer___iter__
1913
+ del _Sizer___iter__
1914
+ Sizer.__bool__ = Sizer.__nonzero__
1915
+
1916
+ def _GridSizer_CalcRowsCols(self):
1917
+ """
1918
+ CalcRowsCols() -> (rows, cols)
1919
+
1920
+ Calculates how many rows and columns will be in the sizer based
1921
+ on the current number of items and also the rows, cols specified
1922
+ in the constructor.
1923
+ """
1924
+ nitems = len(self.GetChildren())
1925
+ rows = self.GetRows()
1926
+ cols = self.GetCols()
1927
+ assert rows != 0 or cols != 0, "Grid sizer must have either rows or columns fixed"
1928
+ if cols != 0:
1929
+ rows = (nitems + cols - 1) / cols
1930
+ elif rows != 0:
1931
+ cols = (nitems + rows - 1) / rows
1932
+ return (rows, cols)
1933
+ GridSizer.CalcRowsCols = _GridSizer_CalcRowsCols
1934
+ del _GridSizer_CalcRowsCols
1935
+ PySizer = wx.deprecated(Sizer, 'Use Sizer instead.')
1936
+
1937
+ def _SizerItemList___repr__(self):
1938
+ return "SizerItemList: " + repr(list(self))
1939
+ SizerItemList.__repr__ = _SizerItemList___repr__
1940
+ del _SizerItemList___repr__
1941
+ def _GBPosition_GetIM(self):
1942
+ """
1943
+ Returns an immutable representation of the ``wx.GBPosition`` object, based on ``namedtuple``.
1944
+
1945
+ This new object is hashable and can be used as a dictionary key,
1946
+ be added to sets, etc. It can be converted back into a real ``wx.GBPosition``
1947
+ with a simple statement like this: ``obj = wx.GBPosition(imObj)``.
1948
+ """
1949
+ return _im_GBPosition(*self.Get())
1950
+ GBPosition.GetIM = _GBPosition_GetIM
1951
+ del _GBPosition_GetIM
1952
+ def _GBPosition___str__(self):
1953
+ return str(self.Get())
1954
+ GBPosition.__str__ = _GBPosition___str__
1955
+ del _GBPosition___str__
1956
+ def _GBPosition___repr__(self):
1957
+ return "wx.GBPosition"+str(self.Get())
1958
+ GBPosition.__repr__ = _GBPosition___repr__
1959
+ del _GBPosition___repr__
1960
+ def _GBPosition___len__(self):
1961
+ return len(self.Get())
1962
+ GBPosition.__len__ = _GBPosition___len__
1963
+ del _GBPosition___len__
1964
+ def _GBPosition___nonzero__(self):
1965
+ return self.Get() != (0,0)
1966
+ GBPosition.__nonzero__ = _GBPosition___nonzero__
1967
+ del _GBPosition___nonzero__
1968
+ def _GBPosition___bool__(self):
1969
+ return self.Get() != (0,0)
1970
+ GBPosition.__bool__ = _GBPosition___bool__
1971
+ del _GBPosition___bool__
1972
+ def _GBPosition___reduce__(self):
1973
+ return (GBPosition, self.Get())
1974
+ GBPosition.__reduce__ = _GBPosition___reduce__
1975
+ del _GBPosition___reduce__
1976
+ def _GBPosition___getitem__(self, idx):
1977
+ return self.Get()[idx]
1978
+ GBPosition.__getitem__ = _GBPosition___getitem__
1979
+ del _GBPosition___getitem__
1980
+ def _GBPosition___setitem__(self, idx, val):
1981
+ if idx == 0: self.Row = val
1982
+ elif idx == 1: self.Col = val
1983
+ else: raise IndexError
1984
+ GBPosition.__setitem__ = _GBPosition___setitem__
1985
+ del _GBPosition___setitem__
1986
+ GBPosition.__safe_for_unpickling__ = True
1987
+
1988
+ def _GBSpan_GetIM(self):
1989
+ """
1990
+ Returns an immutable representation of the ``wx.GBSpan`` object, based on ``namedtuple``.
1991
+
1992
+ This new object is hashable and can be used as a dictionary key,
1993
+ be added to sets, etc. It can be converted back into a real ``wx.GBSpan``
1994
+ with a simple statement like this: ``obj = wx.GBSpan(imObj)``.
1995
+ """
1996
+ return _im_GBSpan(*self.Get())
1997
+ GBSpan.GetIM = _GBSpan_GetIM
1998
+ del _GBSpan_GetIM
1999
+ def _GBSpan___str__(self):
2000
+ return str(self.Get())
2001
+ GBSpan.__str__ = _GBSpan___str__
2002
+ del _GBSpan___str__
2003
+ def _GBSpan___repr__(self):
2004
+ return "wx.GBSpan"+str(self.Get())
2005
+ GBSpan.__repr__ = _GBSpan___repr__
2006
+ del _GBSpan___repr__
2007
+ def _GBSpan___len__(self):
2008
+ return len(self.Get())
2009
+ GBSpan.__len__ = _GBSpan___len__
2010
+ del _GBSpan___len__
2011
+ def _GBSpan___nonzero__(self):
2012
+ return self.Get() != (0,0)
2013
+ GBSpan.__nonzero__ = _GBSpan___nonzero__
2014
+ del _GBSpan___nonzero__
2015
+ def _GBSpan___bool__(self):
2016
+ return self.Get() != (0,0)
2017
+ GBSpan.__bool__ = _GBSpan___bool__
2018
+ del _GBSpan___bool__
2019
+ def _GBSpan___reduce__(self):
2020
+ return (GBSpan, self.Get())
2021
+ GBSpan.__reduce__ = _GBSpan___reduce__
2022
+ del _GBSpan___reduce__
2023
+ def _GBSpan___getitem__(self, idx):
2024
+ return self.Get()[idx]
2025
+ GBSpan.__getitem__ = _GBSpan___getitem__
2026
+ del _GBSpan___getitem__
2027
+ def _GBSpan___setitem__(self, idx, val):
2028
+ if idx == 0: self.Rowspan = val
2029
+ elif idx == 1: self.Colspan = val
2030
+ else: raise IndexError
2031
+ GBSpan.__setitem__ = _GBSpan___setitem__
2032
+ del _GBSpan___setitem__
2033
+ GBSpan.__safe_for_unpickling__ = True
2034
+
2035
+ GridBagSizer.CheckForIntersectionPos = wx.deprecated(GridBagSizer.CheckForIntersection, 'Use CheckForIntersection instead.')
2036
+
2037
+ from collections import namedtuple
2038
+ _im_GBPosition = namedtuple('_im_GBPosition', ['row', 'col'])
2039
+ del namedtuple
2040
+
2041
+ from collections import namedtuple
2042
+ _im_GBSpan = namedtuple('_im_GBSpan', ['rowspan', 'colspan'])
2043
+ del namedtuple
2044
+
2045
+ def _EventLoopActivator___enter__(self):
2046
+ return self
2047
+ EventLoopActivator.__enter__ = _EventLoopActivator___enter__
2048
+ del _EventLoopActivator___enter__
2049
+ def _EventLoopActivator___exit__(self, exc_type, exc_val, exc_tb):
2050
+ return False
2051
+ EventLoopActivator.__exit__ = _EventLoopActivator___exit__
2052
+ del _EventLoopActivator___exit__
2053
+ @wx.deprecatedMsg('Use GUIEventLoop instead.')
2054
+ class EventLoop(GUIEventLoop):
2055
+ '''A class using the old name for compatibility.'''
2056
+ def __init__(self):
2057
+ GUIEventLoop.__init__(self)
2058
+
2059
+ def YieldIfNeeded():
2060
+ """
2061
+ Convenience function for wx.GetApp().Yield(True)
2062
+ """
2063
+ return wx.GetApp().Yield(True)
2064
+
2065
+ class PyOnDemandOutputWindow(object):
2066
+ """
2067
+ A class that can be used for redirecting Python's stdout and
2068
+ stderr streams. It will do nothing until something is wrriten to
2069
+ the stream at which point it will create a Frame with a text area
2070
+ and write the text there.
2071
+ """
2072
+ def __init__(self, title="wxPython: stdout/stderr"):
2073
+ self.frame = None
2074
+ self.title = title
2075
+ self.pos = wx.DefaultPosition
2076
+ self.size = (450, 300)
2077
+ self.parent = None
2078
+
2079
+ def SetParent(self, parent):
2080
+ """
2081
+ Set the window to be used as the popup Frame's parent.
2082
+ """
2083
+ self.parent = parent
2084
+
2085
+ def CreateOutputWindow(self, txt):
2086
+ self.frame = wx.Frame(self.parent, -1, self.title, self.pos, self.size,
2087
+ style=wx.DEFAULT_FRAME_STYLE)
2088
+ self.text = wx.TextCtrl(self.frame, -1, "",
2089
+ style=wx.TE_MULTILINE|wx.TE_READONLY)
2090
+ self.text.AppendText(txt)
2091
+ self.frame.Show(True)
2092
+ self.frame.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2093
+
2094
+ def OnCloseWindow(self, event):
2095
+ if self.frame is not None:
2096
+ self.frame.Destroy()
2097
+ self.frame = None
2098
+ self.text = None
2099
+ self.parent = None
2100
+
2101
+ def write(self, text):
2102
+ """
2103
+ Create the output window if needed and write the string to it.
2104
+ If not called in the context of the gui thread then CallAfter is
2105
+ used to do the work there.
2106
+ """
2107
+ if self.frame is None:
2108
+ if not wx.IsMainThread():
2109
+ wx.CallAfter(self.CreateOutputWindow, text)
2110
+ else:
2111
+ self.CreateOutputWindow(text)
2112
+ else:
2113
+ if not wx.IsMainThread():
2114
+ wx.CallAfter(self.text.AppendText, text)
2115
+ else:
2116
+ self.text.AppendText(text)
2117
+
2118
+ def close(self):
2119
+ if self.frame is not None:
2120
+ wx.CallAfter(self.frame.Close)
2121
+
2122
+ def flush(self):
2123
+ pass
2124
+
2125
+
2126
+ class App(PyApp):
2127
+ """
2128
+ The ``wx.App`` class represents the application and is used to:
2129
+
2130
+ * bootstrap the wxPython system and initialize the underlying
2131
+ gui toolkit
2132
+ * set and get application-wide properties
2133
+ * implement the native windowing system main message or event loop,
2134
+ and to dispatch events to window instances
2135
+ * etc.
2136
+
2137
+ Every wx application must have a single ``wx.App`` instance, and all
2138
+ creation of UI objects should be delayed until after the ``wx.App`` object
2139
+ has been created in order to ensure that the gui platform and wxWidgets
2140
+ have been fully initialized.
2141
+
2142
+ Normally you would derive from this class and implement an ``OnInit``
2143
+ method that creates a frame and then calls ``self.SetTopWindow(frame)``,
2144
+ however ``wx.App`` is also usable on its own without derivation.
2145
+
2146
+ :note: In Python the wrapper for the C++ class ``wxApp`` has been renamed tp
2147
+ :class:`wx.PyApp`. This ``wx.App`` class derives from ``wx.PyApp``, and is
2148
+ responsible for handling the Python-specific needs for bootstrapping the
2149
+ wxWidgets library and other Python integration related requirements.
2150
+ """
2151
+ outputWindowClass = PyOnDemandOutputWindow
2152
+ def __init__(self, redirect=False, filename=None, useBestVisual=False, clearSigInt=True):
2153
+ """
2154
+ Construct a ``wx.App`` object.
2155
+
2156
+ :param redirect: Should ``sys.stdout`` and ``sys.stderr`` be
2157
+ redirected? Defaults to False. If ``filename`` is None
2158
+ then output will be redirected to a window that pops up
2159
+ as needed. (You can control what kind of window is created
2160
+ for the output by resetting the class variable
2161
+ ``outputWindowClass`` to a class of your choosing.)
2162
+
2163
+ :param filename: The name of a file to redirect output to, if
2164
+ redirect is True.
2165
+
2166
+ :param useBestVisual: Should the app try to use the best
2167
+ available visual provided by the system (only relevant on
2168
+ systems that have more than one visual.) This parameter
2169
+ must be used instead of calling `SetUseBestVisual` later
2170
+ on because it must be set before the underlying GUI
2171
+ toolkit is initialized.
2172
+
2173
+ :param clearSigInt: Should SIGINT be cleared? This allows the
2174
+ app to terminate upon a Ctrl-C in the console like other
2175
+ GUI apps will.
2176
+
2177
+ :note: You should override OnInit to do application
2178
+ initialization to ensure that the system, toolkit and
2179
+ wxWidgets are fully initialized.
2180
+ """
2181
+ PyApp.__init__(self)
2182
+
2183
+ # make sure we can create a GUI
2184
+ if not self.IsDisplayAvailable():
2185
+
2186
+ if wx.Port == "__WXMAC__":
2187
+ msg = "This program needs access to the screen. Please run with a\n" \
2188
+ "Framework build of python, and only when you are logged in\n" \
2189
+ "on the main display of your Mac."
2190
+
2191
+ elif wx.Port == "__WXGTK__":
2192
+ msg ="Unable to access the X Display, is $DISPLAY set properly?"
2193
+
2194
+ else:
2195
+ msg = "Unable to create GUI"
2196
+ # TODO: more description is needed for wxMSW...
2197
+
2198
+ raise SystemExit(msg)
2199
+
2200
+ # This has to be done before OnInit
2201
+ self.SetUseBestVisual(useBestVisual)
2202
+
2203
+ # Set the default handler for SIGINT. This fixes a problem
2204
+ # where if Ctrl-C is pressed in the console that started this
2205
+ # app then it will not appear to do anything, (not even send
2206
+ # KeyboardInterrupt???) but will later segfault on exit. By
2207
+ # setting the default handler then the app will exit, as
2208
+ # expected (depending on platform.)
2209
+ if clearSigInt:
2210
+ try:
2211
+ import signal
2212
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
2213
+ except:
2214
+ pass
2215
+
2216
+ # Save and redirect the stdio to a window?
2217
+ self.stdioWin = None
2218
+ self.saveStdio = (_sys.stdout, _sys.stderr)
2219
+ if redirect:
2220
+ self.RedirectStdio(filename)
2221
+
2222
+ # Use Python's install prefix as the default
2223
+ prefix = _sys.prefix
2224
+ if isinstance(prefix, (bytes, bytearray)):
2225
+ prefix = prefix.decode(_sys.getfilesystemencoding())
2226
+ wx.StandardPaths.Get().SetInstallPrefix(prefix)
2227
+
2228
+ # Until the new native control for wxMac is up to par, still use the generic one.
2229
+ wx.SystemOptions.SetOption("mac.listctrl.always_use_generic", 1)
2230
+
2231
+ # This finishes the initialization of wxWindows and then calls
2232
+ # the OnInit that should be present in the derived class
2233
+ self._BootstrapApp()
2234
+
2235
+ def OnPreInit(self):
2236
+ """
2237
+ Things that must be done after _BootstrapApp has done its thing, but
2238
+ would be nice if they were already done by the time that OnInit is
2239
+ called. This can be overridden in derived classes, but be sure to call
2240
+ this method from there.
2241
+ """
2242
+ wx.StockGDI._initStockObjects()
2243
+ self.InitLocale()
2244
+
2245
+ def __del__(self):
2246
+ # Just in case the MainLoop was overridden without calling RestoreStio
2247
+ self.RestoreStdio()
2248
+
2249
+ def SetTopWindow(self, frame):
2250
+ """
2251
+ Set the "main" top level window, which will be used for the parent of
2252
+ the on-demand output window as well as for dialogs that do not have
2253
+ an explicit parent set.
2254
+ """
2255
+ if self.stdioWin:
2256
+ self.stdioWin.SetParent(frame)
2257
+ wx.PyApp.SetTopWindow(self, frame)
2258
+
2259
+ def MainLoop(self):
2260
+ """
2261
+ Execute the main GUI event loop
2262
+ """
2263
+ rv = wx.PyApp.MainLoop(self)
2264
+ self.RestoreStdio()
2265
+ return rv
2266
+
2267
+ def RedirectStdio(self, filename=None):
2268
+ """
2269
+ Redirect sys.stdout and sys.stderr to a file or a popup window.
2270
+ """
2271
+ if filename:
2272
+ _sys.stdout = _sys.stderr = open(filename, 'a')
2273
+ else:
2274
+ self.stdioWin = self.outputWindowClass()
2275
+ _sys.stdout = _sys.stderr = self.stdioWin
2276
+
2277
+ def RestoreStdio(self):
2278
+ try:
2279
+ _sys.stdout, _sys.stderr = self.saveStdio
2280
+ except:
2281
+ pass
2282
+
2283
+ def SetOutputWindowAttributes(self, title=None, pos=None, size=None):
2284
+ """
2285
+ Set the title, position and/or size of the output window if the stdio
2286
+ has been redirected. This should be called before any output would
2287
+ cause the output window to be created.
2288
+ """
2289
+ if self.stdioWin:
2290
+ if title is not None:
2291
+ self.stdioWin.title = title
2292
+ if pos is not None:
2293
+ self.stdioWin.pos = pos
2294
+ if size is not None:
2295
+ self.stdioWin.size = size
2296
+
2297
+ def InitLocale(self):
2298
+ """
2299
+ Starting with version 3.8 on Windows, Python is now setting the locale
2300
+ to what is defined by the system as the default locale. This causes
2301
+ problems with wxWidgets which expects to be able to manage the locale
2302
+ via the wx.Locale class, so the locale will be reset here to be the
2303
+ default "C" locale settings.
2304
+
2305
+ If you have troubles from the default behavior of this method you can
2306
+ override it in a derived class to behave differently. Please report
2307
+ the problem you encountered.
2308
+ """
2309
+ if _sys.platform.startswith('win') and _sys.version_info > (3,8):
2310
+ import locale
2311
+ locale.setlocale(locale.LC_ALL, "C")
2312
+
2313
+ def ResetLocale(self):
2314
+ """
2315
+ This method is now a NOP and will be deprecated.
2316
+ """
2317
+ pass
2318
+
2319
+ @staticmethod
2320
+ def Get():
2321
+ """
2322
+ A staticmethod returning the currently active application object.
2323
+ Essentially just a more pythonic version of :meth:`GetApp`.
2324
+ """
2325
+ return GetApp()
2326
+
2327
+
2328
+ @wx.deprecatedMsg("Use :class:`App` instead.")
2329
+ class PySimpleApp(App):
2330
+ """
2331
+ This class is deprecated. Please use :class:`App` instead.
2332
+ """
2333
+ def __init__(self, *args, **kw):
2334
+ App.__init__(self, *args, **kw)
2335
+
2336
+
2337
+ EVT_TIMER = wx.PyEventBinder( wxEVT_TIMER )
2338
+
2339
+ class PyTimer(Timer):
2340
+ '''This timer class is passed the callable object to be called when the timer expires.'''
2341
+ def __init__(self, notify):
2342
+ Timer.__init__(self)
2343
+ self.notify = notify
2344
+
2345
+ def Notify(self):
2346
+ if self.notify:
2347
+ self.notify()
2348
+
2349
+ def _Window_SetRect(self, rect):
2350
+ return self.SetSize(rect)
2351
+ Window.SetRect = _Window_SetRect
2352
+ del _Window_SetRect
2353
+ Window.Rect = property(Window.GetRect, Window.SetRect)
2354
+ def _Window_SetClientRect(self, rect):
2355
+ return self.SetClientSize(rect)
2356
+ Window.SetClientRect = _Window_SetClientRect
2357
+ del _Window_SetClientRect
2358
+ Window.ClientRect = property(Window.GetClientRect, Window.SetClientRect)
2359
+ Window.SetDimensions = wx.deprecated(Window.SetDimensions, 'Use SetSize instead.')
2360
+
2361
+ def _Window___nonzero__(self):
2362
+ """
2363
+ Can be used to test if the C++ part of the window still exists, with
2364
+ code like this::
2365
+
2366
+ if theWindow:
2367
+ doSomething()
2368
+ """
2369
+ import wx.siplib
2370
+ return not wx.siplib.isdeleted(self)
2371
+ Window.__nonzero__ = _Window___nonzero__
2372
+ del _Window___nonzero__
2373
+ Window.__bool__ = Window.__nonzero__
2374
+
2375
+ def _Window_DestroyLater(self):
2376
+ """
2377
+ Schedules the window to be destroyed in the near future.
2378
+
2379
+ This should be used whenever Destroy could happen too soon, such
2380
+ as when there may still be events for this window or its children
2381
+ waiting in the event queue.
2382
+ """
2383
+ self.Hide()
2384
+ wx.GetApp().ScheduleForDestruction(self)
2385
+ Window.DestroyLater = _Window_DestroyLater
2386
+ del _Window_DestroyLater
2387
+ def _Window_DLG_UNIT(self, dlg_unit):
2388
+ """
2389
+ A convenience wrapper for :meth:`ConvertDialogToPixels`.
2390
+ """
2391
+ is_wxType = isinstance(dlg_unit, (wx.Size, wx.Point))
2392
+ pix = self.ConvertDialogToPixels(dlg_unit)
2393
+ if not is_wxType:
2394
+ pix = tuple(pix)
2395
+ return pix
2396
+ Window.DLG_UNIT = _Window_DLG_UNIT
2397
+ del _Window_DLG_UNIT
2398
+ def _Window_PostCreate(self, pre):
2399
+ pass
2400
+ Window.PostCreate = wx.deprecated(_Window_PostCreate, "PostCreate is no longer necessary.")
2401
+ del _Window_PostCreate
2402
+ def _Window_GetPositionTuple(self):
2403
+ return self.GetPosition()
2404
+ Window.GetPositionTuple = wx.deprecated(_Window_GetPositionTuple, "Use GetPosition instead")
2405
+ del _Window_GetPositionTuple
2406
+ def _Window_GetSizeTuple(self):
2407
+ return self.GetSize()
2408
+ Window.GetSizeTuple = wx.deprecated(_Window_GetSizeTuple, "Use GetSize instead")
2409
+ del _Window_GetSizeTuple
2410
+ def _Window_MoveXY(self, x, y):
2411
+ return self.Move(x, y)
2412
+ Window.MoveXY = wx.deprecated(_Window_MoveXY, "Use Move instead.")
2413
+ del _Window_MoveXY
2414
+ def _Window_SetSizeWH(self, w, h):
2415
+ return self.SetSize(w,h)
2416
+ Window.SetSizeWH = wx.deprecated(_Window_SetSizeWH, "Use SetSize instead.")
2417
+ del _Window_SetSizeWH
2418
+ def _Window_SetVirtualSizeWH(self, w, h):
2419
+ return self.SetVirtualSize(w,h)
2420
+ Window.SetVirtualSizeWH = wx.deprecated(_Window_SetVirtualSizeWH, "Use SetVirtualSize instead.")
2421
+ del _Window_SetVirtualSizeWH
2422
+ def _Window_GetVirtualSizeTuple(self):
2423
+ return self.GetVirtualSize()
2424
+ Window.GetVirtualSizeTuple = wx.deprecated(_Window_GetVirtualSizeTuple, "Use GetVirtualSize instead.")
2425
+ del _Window_GetVirtualSizeTuple
2426
+ def _Window_SetToolTipString(self, string):
2427
+ return self.SetToolTip(string)
2428
+ Window.SetToolTipString = wx.deprecated(_Window_SetToolTipString, "Use SetToolTip instead.")
2429
+ del _Window_SetToolTipString
2430
+ def _Window_ConvertDialogPointToPixels(self, point):
2431
+ return self.ConvertDialogToPixels(point)
2432
+ Window.ConvertDialogPointToPixels = wx.deprecated(_Window_ConvertDialogPointToPixels, "Use ConvertDialogToPixels instead.")
2433
+ del _Window_ConvertDialogPointToPixels
2434
+ def _Window_ConvertDialogSizeToPixels(self, size):
2435
+ return self.ConvertDialogToPixels(point)
2436
+ Window.ConvertDialogSizeToPixels = wx.deprecated(_Window_ConvertDialogSizeToPixels, "Use ConvertDialogToPixels instead.")
2437
+ del _Window_ConvertDialogSizeToPixels
2438
+ def _Window_SetSizeHintsSz(self, minSize, maxSize=wx.DefaultSize, incSize=wx.DefaultSize):
2439
+ return self.SetSizeHints(minSize, maxSize, incSize)
2440
+ Window.SetSizeHintsSz = wx.deprecated(_Window_SetSizeHintsSz, "Use SetSizeHints instead.")
2441
+ del _Window_SetSizeHintsSz
2442
+ class FrozenWindow(object):
2443
+ """
2444
+ A context manager to be used with Python 'with' statements
2445
+ that will freeze the given window for the duration of the
2446
+ with block.
2447
+ """
2448
+ def __init__(self, window):
2449
+ self._win = window
2450
+ def __enter__(self):
2451
+ self._win.Freeze()
2452
+ return self
2453
+ def __exit__(self, exc_type, exc_val, exc_tb):
2454
+ self._win.Thaw()
2455
+
2456
+ def DLG_UNIT(win, dlg_unit, val2=None):
2457
+ """
2458
+ Convenience function for converting a wx.Point, wx.Size or
2459
+ (x,y) in dialog units to pixels, using the given window as a
2460
+ reference.
2461
+ """
2462
+ if val2 is not None:
2463
+ dlg_unit = (dlg_unit, val2)
2464
+ is_wxType = isinstance(dlg_unit, (wx.Size, wx.Point))
2465
+ pix = win.ConvertDialogToPixels(dlg_unit)
2466
+ if not is_wxType:
2467
+ pix = tuple(pix)
2468
+ return pix
2469
+
2470
+ DLG_PNT = wx.deprecated(DLG_UNIT, "Use DLG_UNIT instead.")
2471
+ DLG_SZE = wx.deprecated(DLG_UNIT, "Use DLG_UNIT instead.")
2472
+
2473
+ def _WindowList___repr__(self):
2474
+ return "WindowList: " + repr(list(self))
2475
+ WindowList.__repr__ = _WindowList___repr__
2476
+ del _WindowList___repr__
2477
+ PyWindow = wx.deprecated(Window, 'Use Window instead.')
2478
+
2479
+ PyValidator = wx.deprecated(Validator, 'Use Validator instead.')
2480
+
2481
+ PyPanel = wx.deprecated(Panel, 'Use Panel instead.')
2482
+
2483
+ def _MenuItemList___repr__(self):
2484
+ return "MenuItemList: " + repr(list(self))
2485
+ MenuItemList.__repr__ = _MenuItemList___repr__
2486
+ del _MenuItemList___repr__
2487
+ def _Menu_AppendMenu(self, id, item, subMenu, help=""):
2488
+ return self.Append(id, item, subMenu, help)
2489
+ Menu.AppendMenu = wx.deprecated(_Menu_AppendMenu, "Use Append instead.")
2490
+ del _Menu_AppendMenu
2491
+ def _Menu_AppendItem(self, menuItem):
2492
+ return self.Append(menuItem)
2493
+ Menu.AppendItem = wx.deprecated(_Menu_AppendItem, "Use Append instead.")
2494
+ del _Menu_AppendItem
2495
+ def _Menu_InsertMenu(self, pos, id, item, subMenu, help=""):
2496
+ return self.Insert(pos, id, item, subMenu, help)
2497
+ Menu.InsertMenu = wx.deprecated(_Menu_InsertMenu, "Use Insert instead.")
2498
+ del _Menu_InsertMenu
2499
+ def _Menu_InsertItem(self, pos, menuItem):
2500
+ return self.Insert(pos, menuItem)
2501
+ Menu.InsertItem = wx.deprecated(_Menu_InsertItem, "Use Insert instead.")
2502
+ del _Menu_InsertItem
2503
+ def _Menu_PrependMenu(self, id, item, subMenu, help=""):
2504
+ return self.Prepend(id, item, subMenu, help)
2505
+ Menu.PrependMenu = wx.deprecated(_Menu_PrependMenu, "Use Prepend instead.")
2506
+ del _Menu_PrependMenu
2507
+ def _Menu_PrependItem(self, menuItem):
2508
+ return self.Prepend(menuItem)
2509
+ Menu.PrependItem = wx.deprecated(_Menu_PrependItem, "Use Prepend instead.")
2510
+ del _Menu_PrependItem
2511
+ def _Menu_RemoveMenu(self, id, item, subMenu, help=""):
2512
+ return self.Remove(id, item, subMenu, help)
2513
+ Menu.RemoveMenu = wx.deprecated(_Menu_RemoveMenu, "Use Remove instead.")
2514
+ del _Menu_RemoveMenu
2515
+ def _Menu_RemoveItem(self, menuItem):
2516
+ return self.Remove(menuItem)
2517
+ Menu.RemoveItem = wx.deprecated(_Menu_RemoveItem, "Use Remove instead.")
2518
+ del _Menu_RemoveItem
2519
+ def _MenuBar_GetMenus(self):
2520
+ """
2521
+ GetMenus() -> (menu, label)
2522
+
2523
+ Return a list of (menu, label) items for the menus in the :class:`MenuBar`.
2524
+ """
2525
+ return [(self.GetMenu(i), self.GetMenuLabel(i)) for i in range(self.GetMenuCount())]
2526
+ MenuBar.GetMenus = _MenuBar_GetMenus
2527
+ del _MenuBar_GetMenus
2528
+ def _MenuBar_SetMenus(self, items):
2529
+ """
2530
+ SetMenus()
2531
+
2532
+ Clear and add new menus to the :class:`MenuBar` from a list of (menu, label) items.
2533
+ """
2534
+ for i in range(self.GetMenuCount()-1, -1, -1):
2535
+ self.Remove(i)
2536
+ for m, l in items:
2537
+ self.Append(m, l)
2538
+ MenuBar.SetMenus = _MenuBar_SetMenus
2539
+ del _MenuBar_SetMenus
2540
+ MenuBar.Menus = property(MenuBar.GetMenus, MenuBar.SetMenus)
2541
+ def _MenuList___repr__(self):
2542
+ return "MenuList: " + repr(list(self))
2543
+ MenuList.__repr__ = _MenuList___repr__
2544
+ del _MenuList___repr__
2545
+ PyScrolledWindow = wx.deprecated(ScrolledWindow, 'Use ScrolledWindow instead.')
2546
+
2547
+ def _VarHVScrollHelper_HitTest(self, *args):
2548
+ """
2549
+ Deprecated compatibility helper.
2550
+ """
2551
+ if len(args) == 2:
2552
+ x, y = args
2553
+ return self.VirtualHitTest(y)
2554
+ else:
2555
+ pt = args[0]
2556
+ return self.VirtualHitTest(pt[1])
2557
+ VarHVScrollHelper.HitTest = wx.deprecated(_VarHVScrollHelper_HitTest, "Use VirtualHitTest instead.")
2558
+ del _VarHVScrollHelper_HitTest
2559
+ PyControl = wx.deprecated(Control, 'Use Control instead.')
2560
+
2561
+ def _ItemContainer_GetClientObject(self, n):
2562
+ """
2563
+ Alias for :meth:`GetClientData`
2564
+ """
2565
+ return self.GetClientData(n)
2566
+ ItemContainer.GetClientObject = _ItemContainer_GetClientObject
2567
+ del _ItemContainer_GetClientObject
2568
+ def _ItemContainer_SetClientObject(self, n, data):
2569
+ """
2570
+ Alias for :meth:`SetClientData`
2571
+ """
2572
+ self.SetClientData(n, data)
2573
+ ItemContainer.SetClientObject = _ItemContainer_SetClientObject
2574
+ del _ItemContainer_SetClientObject
2575
+ def _ItemContainer_AppendItems(self, items):
2576
+ """
2577
+ Alias for :meth:`Append`
2578
+ """
2579
+ self.Append(items)
2580
+ ItemContainer.AppendItems = _ItemContainer_AppendItems
2581
+ del _ItemContainer_AppendItems
2582
+ def _ItemContainer_GetItems(self):
2583
+ """
2584
+ Alias for :meth:`GetStrings`
2585
+ """
2586
+ return self.GetStrings()
2587
+ ItemContainer.GetItems = _ItemContainer_GetItems
2588
+ del _ItemContainer_GetItems
2589
+ def _ItemContainer_SetItems(self, items):
2590
+ """
2591
+ Alias for :meth:`Set`
2592
+ """
2593
+ self.Set(items)
2594
+ ItemContainer.SetItems = _ItemContainer_SetItems
2595
+ del _ItemContainer_SetItems
2596
+ ItemContainer.Items = property(ItemContainer.GetItems, ItemContainer.SetItems)
2597
+ EVT_NOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_NOTEBOOK_PAGE_CHANGED, 1 )
2598
+ EVT_NOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_NOTEBOOK_PAGE_CHANGING, 1 )
2599
+
2600
+ # Aliases for the "best book" control as described in the overview
2601
+ BookCtrl = Notebook
2602
+ wxEVT_BOOKCTRL_PAGE_CHANGED = wxEVT_NOTEBOOK_PAGE_CHANGED
2603
+ wxEVT_BOOKCTRL_PAGE_CHANGING = wxEVT_NOTEBOOK_PAGE_CHANGING
2604
+ EVT_BOOKCTRL_PAGE_CHANGED = EVT_NOTEBOOK_PAGE_CHANGED
2605
+ EVT_BOOKCTRL_PAGE_CHANGING = EVT_NOTEBOOK_PAGE_CHANGING
2606
+
2607
+ # deprecated wxEVT aliases
2608
+ wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED = wxEVT_BOOKCTRL_PAGE_CHANGED
2609
+ wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING = wxEVT_BOOKCTRL_PAGE_CHANGING
2610
+ wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED = wxEVT_NOTEBOOK_PAGE_CHANGED
2611
+ wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING = wxEVT_NOTEBOOK_PAGE_CHANGING
2612
+
2613
+ # Add wx.NotebookPage alias, as seen in the documentation
2614
+ NotebookPage = Window
2615
+
2616
+ EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_SPLITTER_SASH_POS_CHANGED, 1 )
2617
+ EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_SPLITTER_SASH_POS_CHANGING, 1 )
2618
+ EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_SPLITTER_DOUBLECLICKED, 1 )
2619
+ EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_SPLITTER_UNSPLIT, 1 )
2620
+ EVT_SPLITTER_DCLICK = EVT_SPLITTER_DOUBLECLICKED
2621
+
2622
+ # deprecated wxEVT aliases
2623
+ wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED = wxEVT_SPLITTER_SASH_POS_CHANGED
2624
+ wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING = wxEVT_SPLITTER_SASH_POS_CHANGING
2625
+ wxEVT_COMMAND_SPLITTER_DOUBLECLICKED = wxEVT_SPLITTER_DOUBLECLICKED
2626
+ wxEVT_COMMAND_SPLITTER_UNSPLIT = wxEVT_SPLITTER_UNSPLIT
2627
+
2628
+ EVT_COLLAPSIBLEPANE_CHANGED = wx.PyEventBinder( wxEVT_COLLAPSIBLEPANE_CHANGED )
2629
+
2630
+ # deprecated wxEVT alias
2631
+ wxEVT_COMMAND_COLLPANE_CHANGED = wxEVT_COLLAPSIBLEPANE_CHANGED
2632
+
2633
+ EVT_TEXT = wx.PyEventBinder( wxEVT_TEXT, 1)
2634
+ EVT_TEXT_ENTER = wx.PyEventBinder( wxEVT_TEXT_ENTER, 1)
2635
+ EVT_TEXT_URL = wx.PyEventBinder( wxEVT_TEXT_URL, 1)
2636
+ EVT_TEXT_MAXLEN = wx.PyEventBinder( wxEVT_TEXT_MAXLEN, 1)
2637
+ EVT_TEXT_CUT = wx.PyEventBinder( wxEVT_TEXT_CUT )
2638
+ EVT_TEXT_COPY = wx.PyEventBinder( wxEVT_TEXT_COPY )
2639
+ EVT_TEXT_PASTE = wx.PyEventBinder( wxEVT_TEXT_PASTE )
2640
+
2641
+ # deprecated wxEVT aliases
2642
+ wxEVT_COMMAND_TEXT_UPDATED = wxEVT_TEXT
2643
+ wxEVT_COMMAND_TEXT_ENTER = wxEVT_TEXT_ENTER
2644
+ wxEVT_COMMAND_TEXT_URL = wxEVT_TEXT_URL
2645
+ wxEVT_COMMAND_TEXT_MAXLEN = wxEVT_TEXT_MAXLEN
2646
+ wxEVT_COMMAND_TEXT_CUT = wxEVT_TEXT_CUT
2647
+ wxEVT_COMMAND_TEXT_COPY = wxEVT_TEXT_COPY
2648
+ wxEVT_COMMAND_TEXT_PASTE = wxEVT_TEXT_PASTE
2649
+
2650
+ ComboBox.SetMark = wx.deprecated(ComboBox.SetTextSelection, 'Use SetTextSelection instead.')
2651
+
2652
+ ComboBox.GetMark = wx.deprecated(ComboBox.GetTextSelection, 'Use GetTextSelection instead.')
2653
+
2654
+ def _CheckListBox_GetCheckedItems(self):
2655
+ """
2656
+ GetCheckedItems()
2657
+
2658
+ Return a sequence of integers corresponding to the checked items in
2659
+ the control, based on :meth:`IsChecked`.
2660
+ """
2661
+ return tuple([i for i in range(self.Count) if self.IsChecked(i)])
2662
+ CheckListBox.GetCheckedItems = _CheckListBox_GetCheckedItems
2663
+ del _CheckListBox_GetCheckedItems
2664
+ def _CheckListBox_GetCheckedStrings(self):
2665
+ """
2666
+ GetCheckedStrings()
2667
+
2668
+ Return a tuple of strings corresponding to the checked
2669
+ items of the control, based on :meth:`GetChecked`.
2670
+ """
2671
+ return tuple([self.GetString(i) for i in self.GetCheckedItems()])
2672
+ CheckListBox.GetCheckedStrings = _CheckListBox_GetCheckedStrings
2673
+ del _CheckListBox_GetCheckedStrings
2674
+ def _CheckListBox_SetCheckedItems(self, indexes):
2675
+ """
2676
+ SetCheckedItems(indexes)
2677
+
2678
+ Sets the checked state of items if the index of the item is
2679
+ found in the indexes sequence.
2680
+ """
2681
+ for i in indexes:
2682
+ assert 0 <= i < self.Count, "Index (%s) out of range" % i
2683
+ for i in range(self.Count):
2684
+ self.Check(i, i in indexes)
2685
+ CheckListBox.SetCheckedItems = _CheckListBox_SetCheckedItems
2686
+ del _CheckListBox_SetCheckedItems
2687
+ def _CheckListBox_SetCheckedStrings(self, strings):
2688
+ """
2689
+ SetCheckedStrings(strings)
2690
+
2691
+ Sets the checked state of items if the item's string is found
2692
+ in the strings sequence.
2693
+ """
2694
+ for s in strings:
2695
+ assert s in self.GetStrings(), "String ('%s') not found" % s
2696
+ for i in range(self.Count):
2697
+ self.Check(i, self.GetString(i) in strings)
2698
+ CheckListBox.SetCheckedStrings = _CheckListBox_SetCheckedStrings
2699
+ del _CheckListBox_SetCheckedStrings
2700
+ def _CheckListBox_GetChecked(self):
2701
+ return self.GetCheckedItems()
2702
+ CheckListBox.GetChecked = wx.deprecated(_CheckListBox_GetChecked, "Use GetCheckedItems instead.")
2703
+ del _CheckListBox_GetChecked
2704
+ def _CheckListBox_SetChecked(self, indexes):
2705
+ return self.SetCheckedItems(indexes)
2706
+ CheckListBox.SetChecked = wx.deprecated(_CheckListBox_SetChecked, "Use SetCheckedItems instead.")
2707
+ del _CheckListBox_SetChecked
2708
+ CheckListBox.Checked = property(CheckListBox.GetChecked, CheckListBox.SetChecked)
2709
+ CheckListBox.CheckedItems = property(CheckListBox.GetCheckedItems, CheckListBox.SetCheckedItems)
2710
+ CheckListBox.CheckedStrings = property(CheckListBox.GetCheckedStrings, CheckListBox.SetCheckedStrings)
2711
+ SettableHeaderColumn.Title = property(HeaderColumn.GetTitle, SettableHeaderColumn.SetTitle)
2712
+ SettableHeaderColumn.Bitmap = property(HeaderColumn.GetBitmap, SettableHeaderColumn.SetBitmap)
2713
+ SettableHeaderColumn.Width = property(HeaderColumn.GetWidth, SettableHeaderColumn.SetWidth)
2714
+ SettableHeaderColumn.MinWidth = property(HeaderColumn.GetMinWidth, SettableHeaderColumn.SetMinWidth)
2715
+ SettableHeaderColumn.Alignment = property(HeaderColumn.GetAlignment, SettableHeaderColumn.SetAlignment)
2716
+ SettableHeaderColumn.Flags = property(HeaderColumn.GetFlags, SettableHeaderColumn.SetFlags)
2717
+ SettableHeaderColumn.Resizeable = property(HeaderColumn.IsResizeable, SettableHeaderColumn.SetResizeable)
2718
+ SettableHeaderColumn.Sortable = property(HeaderColumn.IsSortable, SettableHeaderColumn.SetSortable)
2719
+ SettableHeaderColumn.Reorderable = property(HeaderColumn.IsReorderable, SettableHeaderColumn.SetReorderable)
2720
+ SettableHeaderColumn.Hidden = property(HeaderColumn.IsHidden, SettableHeaderColumn.SetHidden)
2721
+ EVT_HEADER_CLICK = wx.PyEventBinder( wxEVT_HEADER_CLICK )
2722
+ EVT_HEADER_RIGHT_CLICK = wx.PyEventBinder( wxEVT_HEADER_RIGHT_CLICK )
2723
+ EVT_HEADER_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_HEADER_MIDDLE_CLICK )
2724
+ EVT_HEADER_DCLICK = wx.PyEventBinder( wxEVT_HEADER_DCLICK )
2725
+ EVT_HEADER_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_HEADER_RIGHT_DCLICK )
2726
+ EVT_HEADER_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_HEADER_MIDDLE_DCLICK )
2727
+ EVT_HEADER_SEPARATOR_DCLICK = wx.PyEventBinder( wxEVT_HEADER_SEPARATOR_DCLICK )
2728
+ EVT_HEADER_BEGIN_RESIZE = wx.PyEventBinder( wxEVT_HEADER_BEGIN_RESIZE )
2729
+ EVT_HEADER_RESIZING = wx.PyEventBinder( wxEVT_HEADER_RESIZING )
2730
+ EVT_HEADER_END_RESIZE = wx.PyEventBinder( wxEVT_HEADER_END_RESIZE )
2731
+ EVT_HEADER_BEGIN_REORDER = wx.PyEventBinder( wxEVT_HEADER_BEGIN_REORDER )
2732
+ EVT_HEADER_END_REORDER = wx.PyEventBinder( wxEVT_HEADER_END_REORDER )
2733
+ EVT_HEADER_DRAGGING_CANCELLED = wx.PyEventBinder( wxEVT_HEADER_DRAGGING_CANCELLED )
2734
+
2735
+ # deprecated wxEVT aliases
2736
+ wxEVT_COMMAND_HEADER_CLICK = wxEVT_HEADER_CLICK
2737
+ wxEVT_COMMAND_HEADER_RIGHT_CLICK = wxEVT_HEADER_RIGHT_CLICK
2738
+ wxEVT_COMMAND_HEADER_MIDDLE_CLICK = wxEVT_HEADER_MIDDLE_CLICK
2739
+ wxEVT_COMMAND_HEADER_DCLICK = wxEVT_HEADER_DCLICK
2740
+ wxEVT_COMMAND_HEADER_RIGHT_DCLICK = wxEVT_HEADER_RIGHT_DCLICK
2741
+ wxEVT_COMMAND_HEADER_MIDDLE_DCLICK = wxEVT_HEADER_MIDDLE_DCLICK
2742
+ wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK = wxEVT_HEADER_SEPARATOR_DCLICK
2743
+ wxEVT_COMMAND_HEADER_BEGIN_RESIZE = wxEVT_HEADER_BEGIN_RESIZE
2744
+ wxEVT_COMMAND_HEADER_RESIZING = wxEVT_HEADER_RESIZING
2745
+ wxEVT_COMMAND_HEADER_END_RESIZE = wxEVT_HEADER_END_RESIZE
2746
+ wxEVT_COMMAND_HEADER_BEGIN_REORDER = wxEVT_HEADER_BEGIN_REORDER
2747
+ wxEVT_COMMAND_HEADER_END_REORDER = wxEVT_HEADER_END_REORDER
2748
+ wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED = wxEVT_HEADER_DRAGGING_CANCELLED
2749
+
2750
+ EVT_SEARCH_CANCEL = wx.PyEventBinder( wxEVT_SEARCH_CANCEL, 1)
2751
+ EVT_SEARCH = wx.PyEventBinder( wxEVT_SEARCH, 1)
2752
+
2753
+ # deprecated wxEVT aliases
2754
+ wxEVT_SEARCHCTRL_CANCEL_BTN = wxEVT_SEARCH_CANCEL
2755
+ wxEVT_SEARCHCTRL_SEARCH_BTN = wxEVT_SEARCH
2756
+ wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN = wxEVT_SEARCHCTRL_CANCEL_BTN
2757
+ wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN = wxEVT_SEARCHCTRL_SEARCH_BTN
2758
+ EVT_SEARCHCTRL_CANCEL_BTN = wx.PyEventBinder( wxEVT_SEARCHCTRL_CANCEL_BTN, 1)
2759
+ EVT_SEARCHCTRL_SEARCH_BTN = wx.PyEventBinder( wxEVT_SEARCHCTRL_SEARCH_BTN, 1)
2760
+
2761
+ def _RadioBox_GetItemLabel(self, n):
2762
+ """
2763
+ GetItemLabel(self, n) -> string
2764
+
2765
+ Return the text of the n'th item in the radio box.
2766
+ """
2767
+ return self.GetString(n)
2768
+ RadioBox.GetItemLabel = _RadioBox_GetItemLabel
2769
+ del _RadioBox_GetItemLabel
2770
+ def _RadioBox_SetItemLabel(self, n, text):
2771
+ """
2772
+ SetItemLabel(self, n, text)
2773
+
2774
+ Set the text of the n'th item in the radio box.
2775
+ """
2776
+ self.SetString(n, text)
2777
+ RadioBox.SetItemLabel = _RadioBox_SetItemLabel
2778
+ del _RadioBox_SetItemLabel
2779
+ def _Slider_GetRange(self):
2780
+ return (self.GetMin(), self.GetMax())
2781
+ Slider.GetRange = _Slider_GetRange
2782
+ del _Slider_GetRange
2783
+ Slider.Range = property(Slider.GetRange)
2784
+ def _SpinButton_GetRange(self):
2785
+ return (self.GetMin(), self.GetMax())
2786
+ SpinButton.GetRange = _SpinButton_GetRange
2787
+ del _SpinButton_GetRange
2788
+ def _SpinButton_SetMin(self, minVal):
2789
+ self.SetRange(minVal, self.GetMax())
2790
+ SpinButton.SetMin = _SpinButton_SetMin
2791
+ del _SpinButton_SetMin
2792
+ def _SpinButton_SetMax(self, maxVal):
2793
+ self.SetRange(self.GetMin(), maxVal)
2794
+ SpinButton.SetMax = _SpinButton_SetMax
2795
+ del _SpinButton_SetMax
2796
+ SpinButton.Max = property(SpinButton.GetMax, SpinButton.SetMax)
2797
+ SpinButton.Min = property(SpinButton.GetMin, SpinButton.SetMin)
2798
+ SpinButton.Range = property(SpinButton.GetRange)
2799
+ EVT_SPIN_UP = wx.PyEventBinder( wxEVT_SPIN_UP, 1)
2800
+ EVT_SPIN_DOWN = wx.PyEventBinder( wxEVT_SPIN_DOWN, 1)
2801
+ EVT_SPIN = wx.PyEventBinder( wxEVT_SPIN, 1)
2802
+
2803
+ def _SpinCtrl_GetRange(self):
2804
+ return (self.GetMin(), self.GetMax())
2805
+ SpinCtrl.GetRange = _SpinCtrl_GetRange
2806
+ del _SpinCtrl_GetRange
2807
+ def _SpinCtrl_SetMin(self, minVal):
2808
+ self.SetRange(minVal, self.GetMax())
2809
+ SpinCtrl.SetMin = _SpinCtrl_SetMin
2810
+ del _SpinCtrl_SetMin
2811
+ def _SpinCtrl_SetMax(self, maxVal):
2812
+ self.SetRange(self.GetMin(), maxVal)
2813
+ SpinCtrl.SetMax = _SpinCtrl_SetMax
2814
+ del _SpinCtrl_SetMax
2815
+ SpinCtrl.Max = property(SpinCtrl.GetMax, SpinCtrl.SetMax)
2816
+ SpinCtrl.Min = property(SpinCtrl.GetMin, SpinCtrl.SetMin)
2817
+ SpinCtrl.Range = property(SpinCtrl.GetRange)
2818
+ def _SpinCtrlDouble_GetRange(self):
2819
+ return (self.GetMin(), self.GetMax())
2820
+ SpinCtrlDouble.GetRange = _SpinCtrlDouble_GetRange
2821
+ del _SpinCtrlDouble_GetRange
2822
+ def _SpinCtrlDouble_SetMin(self, minVal):
2823
+ self.SetRange(minVal, self.GetMax())
2824
+ SpinCtrlDouble.SetMin = _SpinCtrlDouble_SetMin
2825
+ del _SpinCtrlDouble_SetMin
2826
+ def _SpinCtrlDouble_SetMax(self, maxVal):
2827
+ self.SetRange(self.GetMin(), maxVal)
2828
+ SpinCtrlDouble.SetMax = _SpinCtrlDouble_SetMax
2829
+ del _SpinCtrlDouble_SetMax
2830
+ SpinCtrlDouble.Max = property(SpinCtrlDouble.GetMax, SpinCtrlDouble.SetMax)
2831
+ SpinCtrlDouble.Min = property(SpinCtrlDouble.GetMin, SpinCtrlDouble.SetMin)
2832
+ SpinCtrlDouble.Range = property(SpinCtrlDouble.GetRange)
2833
+ EVT_SPINCTRL = wx.PyEventBinder( wxEVT_SPINCTRL, 1)
2834
+ EVT_SPINCTRLDOUBLE = wx.PyEventBinder( wxEVT_SPINCTRLDOUBLE, 1)
2835
+
2836
+ # deprecated wxEVT aliases
2837
+ wxEVT_COMMAND_SPINCTRL_UPDATED = wxEVT_SPINCTRL
2838
+ wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED = wxEVT_SPINCTRLDOUBLE
2839
+
2840
+ EVT_TOGGLEBUTTON = PyEventBinder(wxEVT_TOGGLEBUTTON, 1)
2841
+
2842
+ # deprecated wxEVT alias
2843
+ wxEVT_COMMAND_TOGGLEBUTTON_CLICKED = wxEVT_TOGGLEBUTTON
2844
+
2845
+ def _ToolBar_AddSimpleTool(self, toolId, bitmap, shortHelpString="", longHelpString="", isToggle=0):
2846
+ """
2847
+ Old style method to add a tool to the toolbar.
2848
+ """
2849
+ kind = wx.ITEM_NORMAL
2850
+ if isToggle: kind = wx.ITEM_CHECK
2851
+ return self.AddTool(toolId, '', bitmap, wx.NullBitmap, kind,
2852
+ shortHelpString, longHelpString)
2853
+ ToolBar.AddSimpleTool = wx.deprecated(_ToolBar_AddSimpleTool, "Use :meth:`AddTool` instead.")
2854
+ del _ToolBar_AddSimpleTool
2855
+ def _ToolBar_AddLabelTool(self, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="", clientData=None):
2856
+ """
2857
+ Old style method to add a tool in the toolbar.
2858
+ """
2859
+ return self.AddTool(id, label, bitmap, bmpDisabled, kind,
2860
+ shortHelp, longHelp, clientData)
2861
+ ToolBar.AddLabelTool = wx.deprecated(_ToolBar_AddLabelTool, "Use :meth:`AddTool` instead.")
2862
+ del _ToolBar_AddLabelTool
2863
+ def _ToolBar_InsertSimpleTool(self, pos, toolId, bitmap, shortHelpString="", longHelpString="", isToggle=0):
2864
+ """
2865
+ Old style method to insert a tool in the toolbar.
2866
+ """
2867
+ kind = wx.ITEM_NORMAL
2868
+ if isToggle: kind = wx.ITEM_CHECK
2869
+ return self.InsertTool(pos, toolId, '', bitmap, wx.NullBitmap, kind,
2870
+ shortHelpString, longHelpString)
2871
+ ToolBar.InsertSimpleTool = wx.deprecated(_ToolBar_InsertSimpleTool, "Use :meth:`InsertTool` instead.")
2872
+ del _ToolBar_InsertSimpleTool
2873
+ def _ToolBar_InsertLabelTool(self, pos, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="", clientData=None):
2874
+ """
2875
+ Old style method to insert a tool in the toolbar.
2876
+ """
2877
+ return self.InsertTool(pos, id, label, bitmap, bmpDisabled, kind,
2878
+ shortHelp, longHelp, clientData)
2879
+ ToolBar.InsertLabelTool = wx.deprecated(_ToolBar_InsertLabelTool, "Use :meth:`InsertTool` instead.")
2880
+ del _ToolBar_InsertLabelTool
2881
+ ListCtrl.FindItemData = wx.deprecated(ListCtrl.FindItem, "Use FindItem instead.")
2882
+
2883
+ ListCtrl.FindItemAtPos = wx.deprecated(ListCtrl.FindItem, "Use FindItem instead.")
2884
+
2885
+ ListCtrl.InsertStringItem = wx.deprecated(ListCtrl.InsertItem, "Use InsertItem instead.")
2886
+
2887
+ ListCtrl.InsertImageItem = wx.deprecated(ListCtrl.InsertItem, "Use InsertItem instead.")
2888
+
2889
+ ListCtrl.InsertImageStringItem = wx.deprecated(ListCtrl.InsertItem, "Use InsertItem instead.")
2890
+
2891
+ ListCtrl.SetStringItem = wx.deprecated(ListCtrl.SetItem, "Use SetItem instead.")
2892
+
2893
+ def _ListCtrl_Select(self, idx, on=1):
2894
+ """
2895
+ Selects/deselects an item.
2896
+ """
2897
+ if on: state = wx.LIST_STATE_SELECTED
2898
+ else: state = 0
2899
+ self.SetItemState(idx, state, wx.LIST_STATE_SELECTED)
2900
+ ListCtrl.Select = _ListCtrl_Select
2901
+ del _ListCtrl_Select
2902
+ def _ListCtrl_Focus(self, idx):
2903
+ """
2904
+ Focus and show the given item.
2905
+ """
2906
+ self.SetItemState(idx, wx.LIST_STATE_FOCUSED, wx.LIST_STATE_FOCUSED)
2907
+ self.EnsureVisible(idx)
2908
+ ListCtrl.Focus = _ListCtrl_Focus
2909
+ del _ListCtrl_Focus
2910
+ def _ListCtrl_GetFocusedItem(self):
2911
+ """
2912
+ Gets the currently focused item or -1 if none is focused.
2913
+ """
2914
+ return self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_FOCUSED)
2915
+ ListCtrl.GetFocusedItem = _ListCtrl_GetFocusedItem
2916
+ del _ListCtrl_GetFocusedItem
2917
+ def _ListCtrl_GetFirstSelected(self, *args):
2918
+ """
2919
+ Returns the first selected item, or -1 when none is selected.
2920
+ """
2921
+ return self.GetNextSelected(-1)
2922
+ ListCtrl.GetFirstSelected = _ListCtrl_GetFirstSelected
2923
+ del _ListCtrl_GetFirstSelected
2924
+ def _ListCtrl_GetNextSelected(self, item):
2925
+ """
2926
+ Returns subsequent selected items, or -1 when no more are selected.
2927
+ """
2928
+ return self.GetNextItem(item, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
2929
+ ListCtrl.GetNextSelected = _ListCtrl_GetNextSelected
2930
+ del _ListCtrl_GetNextSelected
2931
+ def _ListCtrl_IsSelected(self, idx):
2932
+ """
2933
+ Returns ``True`` if the item is selected.
2934
+ """
2935
+ return (self.GetItemState(idx, wx.LIST_STATE_SELECTED) & wx.LIST_STATE_SELECTED) != 0
2936
+ ListCtrl.IsSelected = _ListCtrl_IsSelected
2937
+ del _ListCtrl_IsSelected
2938
+ def _ListCtrl_SetColumnImage(self, col, image):
2939
+ item = self.GetColumn(col)
2940
+ # preserve all other attributes too
2941
+ item.SetMask( wx.LIST_MASK_STATE |
2942
+ wx.LIST_MASK_TEXT |
2943
+ wx.LIST_MASK_IMAGE |
2944
+ wx.LIST_MASK_DATA |
2945
+ wx.LIST_SET_ITEM |
2946
+ wx.LIST_MASK_WIDTH |
2947
+ wx.LIST_MASK_FORMAT )
2948
+ item.SetImage(image)
2949
+ self.SetColumn(col, item)
2950
+ ListCtrl.SetColumnImage = _ListCtrl_SetColumnImage
2951
+ del _ListCtrl_SetColumnImage
2952
+ def _ListCtrl_ClearColumnImage(self, col):
2953
+ self.SetColumnImage(col, -1)
2954
+ ListCtrl.ClearColumnImage = _ListCtrl_ClearColumnImage
2955
+ del _ListCtrl_ClearColumnImage
2956
+ def _ListCtrl_Append(self, entry):
2957
+ """
2958
+ Append an item to the list control. The `entry` parameter should be a
2959
+ sequence with an item for each column
2960
+ """
2961
+ if len(entry):
2962
+ pos = self.InsertItem(self.GetItemCount(), str(entry[0]))
2963
+ for i in range(1, len(entry)):
2964
+ self.SetItem(pos, i, str(entry[i]))
2965
+ return pos
2966
+ ListCtrl.Append = _ListCtrl_Append
2967
+ del _ListCtrl_Append
2968
+ ListCtrl.FocusedItem = property(ListCtrl.GetFocusedItem)
2969
+ ListItemAttr = wx.deprecated(ItemAttr, 'Use ItemAttr instead')
2970
+
2971
+ EVT_LIST_BEGIN_DRAG = PyEventBinder(wxEVT_LIST_BEGIN_DRAG , 1)
2972
+ EVT_LIST_BEGIN_RDRAG = PyEventBinder(wxEVT_LIST_BEGIN_RDRAG , 1)
2973
+ EVT_LIST_BEGIN_LABEL_EDIT = PyEventBinder(wxEVT_LIST_BEGIN_LABEL_EDIT , 1)
2974
+ EVT_LIST_END_LABEL_EDIT = PyEventBinder(wxEVT_LIST_END_LABEL_EDIT , 1)
2975
+ EVT_LIST_DELETE_ITEM = PyEventBinder(wxEVT_LIST_DELETE_ITEM , 1)
2976
+ EVT_LIST_DELETE_ALL_ITEMS = PyEventBinder(wxEVT_LIST_DELETE_ALL_ITEMS , 1)
2977
+ EVT_LIST_ITEM_SELECTED = PyEventBinder(wxEVT_LIST_ITEM_SELECTED , 1)
2978
+ EVT_LIST_ITEM_DESELECTED = PyEventBinder(wxEVT_LIST_ITEM_DESELECTED , 1)
2979
+ EVT_LIST_KEY_DOWN = PyEventBinder(wxEVT_LIST_KEY_DOWN , 1)
2980
+ EVT_LIST_INSERT_ITEM = PyEventBinder(wxEVT_LIST_INSERT_ITEM , 1)
2981
+ EVT_LIST_COL_CLICK = PyEventBinder(wxEVT_LIST_COL_CLICK , 1)
2982
+ EVT_LIST_ITEM_RIGHT_CLICK = PyEventBinder(wxEVT_LIST_ITEM_RIGHT_CLICK , 1)
2983
+ EVT_LIST_ITEM_MIDDLE_CLICK = PyEventBinder(wxEVT_LIST_ITEM_MIDDLE_CLICK, 1)
2984
+ EVT_LIST_ITEM_ACTIVATED = PyEventBinder(wxEVT_LIST_ITEM_ACTIVATED , 1)
2985
+ EVT_LIST_CACHE_HINT = PyEventBinder(wxEVT_LIST_CACHE_HINT , 1)
2986
+ EVT_LIST_COL_RIGHT_CLICK = PyEventBinder(wxEVT_LIST_COL_RIGHT_CLICK , 1)
2987
+ EVT_LIST_COL_BEGIN_DRAG = PyEventBinder(wxEVT_LIST_COL_BEGIN_DRAG , 1)
2988
+ EVT_LIST_COL_DRAGGING = PyEventBinder(wxEVT_LIST_COL_DRAGGING , 1)
2989
+ EVT_LIST_COL_END_DRAG = PyEventBinder(wxEVT_LIST_COL_END_DRAG , 1)
2990
+ EVT_LIST_ITEM_FOCUSED = PyEventBinder(wxEVT_LIST_ITEM_FOCUSED , 1)
2991
+ EVT_LIST_ITEM_CHECKED = PyEventBinder(wxEVT_LIST_ITEM_CHECKED , 1)
2992
+ EVT_LIST_ITEM_UNCHECKED = PyEventBinder(wxEVT_LIST_ITEM_UNCHECKED , 1)
2993
+
2994
+ # deprecated wxEVT aliases
2995
+ wxEVT_COMMAND_LIST_BEGIN_DRAG = wxEVT_LIST_BEGIN_DRAG
2996
+ wxEVT_COMMAND_LIST_BEGIN_RDRAG = wxEVT_LIST_BEGIN_RDRAG
2997
+ wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT = wxEVT_LIST_BEGIN_LABEL_EDIT
2998
+ wxEVT_COMMAND_LIST_END_LABEL_EDIT = wxEVT_LIST_END_LABEL_EDIT
2999
+ wxEVT_COMMAND_LIST_DELETE_ITEM = wxEVT_LIST_DELETE_ITEM
3000
+ wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS = wxEVT_LIST_DELETE_ALL_ITEMS
3001
+ wxEVT_COMMAND_LIST_ITEM_SELECTED = wxEVT_LIST_ITEM_SELECTED
3002
+ wxEVT_COMMAND_LIST_ITEM_DESELECTED = wxEVT_LIST_ITEM_DESELECTED
3003
+ wxEVT_COMMAND_LIST_KEY_DOWN = wxEVT_LIST_KEY_DOWN
3004
+ wxEVT_COMMAND_LIST_INSERT_ITEM = wxEVT_LIST_INSERT_ITEM
3005
+ wxEVT_COMMAND_LIST_COL_CLICK = wxEVT_LIST_COL_CLICK
3006
+ wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = wxEVT_LIST_ITEM_RIGHT_CLICK
3007
+ wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = wxEVT_LIST_ITEM_MIDDLE_CLICK
3008
+ wxEVT_COMMAND_LIST_ITEM_ACTIVATED = wxEVT_LIST_ITEM_ACTIVATED
3009
+ wxEVT_COMMAND_LIST_CACHE_HINT = wxEVT_LIST_CACHE_HINT
3010
+ wxEVT_COMMAND_LIST_COL_RIGHT_CLICK = wxEVT_LIST_COL_RIGHT_CLICK
3011
+ wxEVT_COMMAND_LIST_COL_BEGIN_DRAG = wxEVT_LIST_COL_BEGIN_DRAG
3012
+ wxEVT_COMMAND_LIST_COL_DRAGGING = wxEVT_LIST_COL_DRAGGING
3013
+ wxEVT_COMMAND_LIST_COL_END_DRAG = wxEVT_LIST_COL_END_DRAG
3014
+ wxEVT_COMMAND_LIST_ITEM_FOCUSED = wxEVT_LIST_ITEM_FOCUSED
3015
+
3016
+ def _TreeItemId___hash__(self):
3017
+ return hash(int(self.GetID()))
3018
+ TreeItemId.__hash__ = _TreeItemId___hash__
3019
+ del _TreeItemId___hash__
3020
+ TreeCtrl.GetItemPyData = wx.deprecated(TreeCtrl.GetItemData, 'Use GetItemData instead.')
3021
+ TreeCtrl.SetItemPyData = wx.deprecated(TreeCtrl.SetItemData, 'Use SetItemData instead.')
3022
+ TreeCtrl.GetPyData = wx.deprecated(TreeCtrl.GetItemData, 'Use GetItemData instead.')
3023
+ TreeCtrl.SetPyData = wx.deprecated(TreeCtrl.SetItemData, 'Use SetItemData instead.')
3024
+
3025
+ def TreeItemData(data):
3026
+ return data
3027
+ TreeItemData = deprecated(TreeItemData, "The TreeItemData class no longer exists, just pass your object directly to the tree instead.")
3028
+
3029
+ EVT_TREE_BEGIN_DRAG = PyEventBinder(wxEVT_TREE_BEGIN_DRAG , 1)
3030
+ EVT_TREE_BEGIN_RDRAG = PyEventBinder(wxEVT_TREE_BEGIN_RDRAG , 1)
3031
+ EVT_TREE_BEGIN_LABEL_EDIT = PyEventBinder(wxEVT_TREE_BEGIN_LABEL_EDIT , 1)
3032
+ EVT_TREE_END_LABEL_EDIT = PyEventBinder(wxEVT_TREE_END_LABEL_EDIT , 1)
3033
+ EVT_TREE_DELETE_ITEM = PyEventBinder(wxEVT_TREE_DELETE_ITEM , 1)
3034
+ EVT_TREE_GET_INFO = PyEventBinder(wxEVT_TREE_GET_INFO , 1)
3035
+ EVT_TREE_SET_INFO = PyEventBinder(wxEVT_TREE_SET_INFO , 1)
3036
+ EVT_TREE_ITEM_EXPANDED = PyEventBinder(wxEVT_TREE_ITEM_EXPANDED , 1)
3037
+ EVT_TREE_ITEM_EXPANDING = PyEventBinder(wxEVT_TREE_ITEM_EXPANDING , 1)
3038
+ EVT_TREE_ITEM_COLLAPSED = PyEventBinder(wxEVT_TREE_ITEM_COLLAPSED , 1)
3039
+ EVT_TREE_ITEM_COLLAPSING = PyEventBinder(wxEVT_TREE_ITEM_COLLAPSING , 1)
3040
+ EVT_TREE_SEL_CHANGED = PyEventBinder(wxEVT_TREE_SEL_CHANGED , 1)
3041
+ EVT_TREE_SEL_CHANGING = PyEventBinder(wxEVT_TREE_SEL_CHANGING , 1)
3042
+ EVT_TREE_KEY_DOWN = PyEventBinder(wxEVT_TREE_KEY_DOWN , 1)
3043
+ EVT_TREE_ITEM_ACTIVATED = PyEventBinder(wxEVT_TREE_ITEM_ACTIVATED , 1)
3044
+ EVT_TREE_ITEM_RIGHT_CLICK = PyEventBinder(wxEVT_TREE_ITEM_RIGHT_CLICK , 1)
3045
+ EVT_TREE_ITEM_MIDDLE_CLICK = PyEventBinder(wxEVT_TREE_ITEM_MIDDLE_CLICK, 1)
3046
+ EVT_TREE_END_DRAG = PyEventBinder(wxEVT_TREE_END_DRAG , 1)
3047
+ EVT_TREE_STATE_IMAGE_CLICK = PyEventBinder(wxEVT_TREE_STATE_IMAGE_CLICK, 1)
3048
+ EVT_TREE_ITEM_GETTOOLTIP = PyEventBinder(wxEVT_TREE_ITEM_GETTOOLTIP, 1)
3049
+ EVT_TREE_ITEM_MENU = PyEventBinder(wxEVT_TREE_ITEM_MENU, 1)
3050
+
3051
+ # deprecated wxEVT aliases
3052
+ wxEVT_COMMAND_TREE_BEGIN_DRAG = wxEVT_TREE_BEGIN_DRAG
3053
+ wxEVT_COMMAND_TREE_BEGIN_RDRAG = wxEVT_TREE_BEGIN_RDRAG
3054
+ wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT = wxEVT_TREE_BEGIN_LABEL_EDIT
3055
+ wxEVT_COMMAND_TREE_END_LABEL_EDIT = wxEVT_TREE_END_LABEL_EDIT
3056
+ wxEVT_COMMAND_TREE_DELETE_ITEM = wxEVT_TREE_DELETE_ITEM
3057
+ wxEVT_COMMAND_TREE_GET_INFO = wxEVT_TREE_GET_INFO
3058
+ wxEVT_COMMAND_TREE_SET_INFO = wxEVT_TREE_SET_INFO
3059
+ wxEVT_COMMAND_TREE_ITEM_EXPANDED = wxEVT_TREE_ITEM_EXPANDED
3060
+ wxEVT_COMMAND_TREE_ITEM_EXPANDING = wxEVT_TREE_ITEM_EXPANDING
3061
+ wxEVT_COMMAND_TREE_ITEM_COLLAPSED = wxEVT_TREE_ITEM_COLLAPSED
3062
+ wxEVT_COMMAND_TREE_ITEM_COLLAPSING = wxEVT_TREE_ITEM_COLLAPSING
3063
+ wxEVT_COMMAND_TREE_SEL_CHANGED = wxEVT_TREE_SEL_CHANGED
3064
+ wxEVT_COMMAND_TREE_SEL_CHANGING = wxEVT_TREE_SEL_CHANGING
3065
+ wxEVT_COMMAND_TREE_KEY_DOWN = wxEVT_TREE_KEY_DOWN
3066
+ wxEVT_COMMAND_TREE_ITEM_ACTIVATED = wxEVT_TREE_ITEM_ACTIVATED
3067
+ wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK = wxEVT_TREE_ITEM_RIGHT_CLICK
3068
+ wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK = wxEVT_TREE_ITEM_MIDDLE_CLICK
3069
+ wxEVT_COMMAND_TREE_END_DRAG = wxEVT_TREE_END_DRAG
3070
+ wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK = wxEVT_TREE_STATE_IMAGE_CLICK
3071
+ wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP = wxEVT_TREE_ITEM_GETTOOLTIP
3072
+ wxEVT_COMMAND_TREE_ITEM_MENU = wxEVT_TREE_ITEM_MENU
3073
+
3074
+ EVT_COLOURPICKER_CHANGED = wx.PyEventBinder( wxEVT_COLOURPICKER_CHANGED, 1 )
3075
+ EVT_COLOURPICKER_CURRENT_CHANGED = wx.PyEventBinder( wxEVT_COLOURPICKER_CURRENT_CHANGED, 1 )
3076
+ EVT_COLOURPICKER_DIALOG_CANCELLED = wx.PyEventBinder( wxEVT_COLOURPICKER_DIALOG_CANCELLED, 1 )
3077
+
3078
+ # deprecated wxEVT alias
3079
+ wxEVT_COMMAND_COLOURPICKER_CHANGED = wxEVT_COLOURPICKER_CHANGED
3080
+
3081
+ EVT_FILEPICKER_CHANGED = wx.PyEventBinder( wxEVT_FILEPICKER_CHANGED, 1 )
3082
+ EVT_DIRPICKER_CHANGED = wx.PyEventBinder( wxEVT_DIRPICKER_CHANGED, 1 )
3083
+
3084
+ # deprecated wxEVT aliases
3085
+ wxEVT_COMMAND_FILEPICKER_CHANGED = wxEVT_FILEPICKER_CHANGED
3086
+ wxEVT_COMMAND_DIRPICKER_CHANGED = wxEVT_DIRPICKER_CHANGED
3087
+
3088
+ EVT_FONTPICKER_CHANGED = wx.PyEventBinder( wxEVT_FONTPICKER_CHANGED, 1 )
3089
+
3090
+ # deprecated wxEVT alias
3091
+ wxEVT_COMMAND_FONTPICKER_CHANGED = wxEVT_FONTPICKER_CHANGED
3092
+
3093
+ EVT_FILECTRL_SELECTIONCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_SELECTIONCHANGED, 1)
3094
+ EVT_FILECTRL_FILEACTIVATED = wx.PyEventBinder( wxEVT_FILECTRL_FILEACTIVATED, 1)
3095
+ EVT_FILECTRL_FOLDERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FOLDERCHANGED, 1)
3096
+ EVT_FILECTRL_FILTERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FILTERCHANGED, 1)
3097
+
3098
+ EVT_CHOICEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGED, 1 )
3099
+ EVT_CHOICEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGING, 1 )
3100
+
3101
+ # deprecated wxEVT aliases
3102
+ wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxEVT_CHOICEBOOK_PAGE_CHANGED
3103
+ wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxEVT_CHOICEBOOK_PAGE_CHANGING
3104
+
3105
+ EVT_LISTBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_LISTBOOK_PAGE_CHANGED, 1 )
3106
+ EVT_LISTBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_LISTBOOK_PAGE_CHANGING, 1 )
3107
+
3108
+ # deprecated wxEVT aliases
3109
+ wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxEVT_LISTBOOK_PAGE_CHANGED
3110
+ wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxEVT_LISTBOOK_PAGE_CHANGING
3111
+
3112
+ EVT_TOOLBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_TOOLBOOK_PAGE_CHANGED, 1 )
3113
+ EVT_TOOLBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_TOOLBOOK_PAGE_CHANGING, 1 )
3114
+
3115
+ # deprecated wxEVT aliases
3116
+ wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED = wxEVT_TOOLBOOK_PAGE_CHANGED
3117
+ wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING = wxEVT_TOOLBOOK_PAGE_CHANGING
3118
+
3119
+ EVT_TREEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_TREEBOOK_PAGE_CHANGED, 1 )
3120
+ EVT_TREEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_TREEBOOK_PAGE_CHANGING, 1)
3121
+ EVT_TREEBOOK_NODE_COLLAPSED = wx.PyEventBinder( wxEVT_TREEBOOK_NODE_COLLAPSED, 1 )
3122
+ EVT_TREEBOOK_NODE_EXPANDED = wx.PyEventBinder( wxEVT_TREEBOOK_NODE_EXPANDED, 1 )
3123
+
3124
+ # deprecated wxEVT aliases
3125
+ wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED = wxEVT_TREEBOOK_PAGE_CHANGED
3126
+ wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING = wxEVT_TREEBOOK_PAGE_CHANGING
3127
+ wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED = wxEVT_TREEBOOK_NODE_COLLAPSED
3128
+ wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED = wxEVT_TREEBOOK_NODE_EXPANDED
3129
+
3130
+ EVT_COLLAPSIBLEHEADER_CHANGED = PyEventBinder(wxEVT_COLLAPSIBLEHEADER_CHANGED, 1)
3131
+
3132
+ def _Dialog___enter__(self):
3133
+ return self
3134
+ Dialog.__enter__ = _Dialog___enter__
3135
+ del _Dialog___enter__
3136
+ def _Dialog___exit__(self, exc_type, exc_val, exc_tb):
3137
+ self.Destroy()
3138
+ Dialog.__exit__ = _Dialog___exit__
3139
+ del _Dialog___exit__
3140
+ EVT_DIRCTRL_SELECTIONCHANGED = wx.PyEventBinder( wxEVT_DIRCTRL_SELECTIONCHANGED, 1 )
3141
+ EVT_DIRCTRL_FILEACTIVATED = wx.PyEventBinder( wxEVT_DIRCTRL_FILEACTIVATED, 1 )
3142
+
3143
+ EVT_COLOUR_CHANGED = PyEventBinder(wxEVT_COLOUR_CHANGED, 1)
3144
+
3145
+ EVT_FIND = wx.PyEventBinder( wxEVT_FIND, 1 )
3146
+ EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_FIND_NEXT, 1 )
3147
+ EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_FIND_REPLACE, 1 )
3148
+ EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_FIND_REPLACE_ALL, 1 )
3149
+ EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_FIND_CLOSE, 1 )
3150
+
3151
+ # deprecated wxEVT aliases
3152
+ wxEVT_COMMAND_FIND = wxEVT_FIND
3153
+ wxEVT_COMMAND_FIND_NEXT = wxEVT_FIND_NEXT
3154
+ wxEVT_COMMAND_FIND_REPLACE = wxEVT_FIND_REPLACE
3155
+ wxEVT_COMMAND_FIND_REPLACE_ALL = wxEVT_FIND_REPLACE_ALL
3156
+ wxEVT_COMMAND_FIND_CLOSE = wxEVT_FIND_CLOSE
3157
+
3158
+ def _PowerResourceBlocker___enter__(self):
3159
+ return self
3160
+ PowerResourceBlocker.__enter__ = _PowerResourceBlocker___enter__
3161
+ del _PowerResourceBlocker___enter__
3162
+ def _PowerResourceBlocker___exit__(self, exc_type, exc_val, exc_tb):
3163
+ pass
3164
+ PowerResourceBlocker.__exit__ = _PowerResourceBlocker___exit__
3165
+ del _PowerResourceBlocker___exit__
3166
+ EVT_POWER_SUSPENDING = wx.PyEventBinder( wxEVT_POWER_SUSPENDING , 1 )
3167
+ EVT_POWER_SUSPENDED = wx.PyEventBinder( wxEVT_POWER_SUSPENDED , 1 )
3168
+ EVT_POWER_SUSPEND_CANCEL = wx.PyEventBinder( wxEVT_POWER_SUSPEND_CANCEL , 1 )
3169
+ EVT_POWER_RESUME = wx.PyEventBinder( wxEVT_POWER_RESUME , 1 )
3170
+
3171
+ def _WindowDisabler___enter__(self):
3172
+ return self
3173
+ WindowDisabler.__enter__ = _WindowDisabler___enter__
3174
+ del _WindowDisabler___enter__
3175
+ def _WindowDisabler___exit__(self, exc_type, exc_val, exc_tb):
3176
+ pass
3177
+ WindowDisabler.__exit__ = _WindowDisabler___exit__
3178
+ del _WindowDisabler___exit__
3179
+ def _BusyCursor___enter__(self):
3180
+ return self
3181
+ BusyCursor.__enter__ = _BusyCursor___enter__
3182
+ del _BusyCursor___enter__
3183
+ def _BusyCursor___exit__(self, exc_type, exc_val, exc_tb):
3184
+ pass
3185
+ BusyCursor.__exit__ = _BusyCursor___exit__
3186
+ del _BusyCursor___exit__
3187
+ EVT_END_PROCESS = wx.PyEventBinder( wxEVT_END_PROCESS )
3188
+
3189
+ def HelpController(parentWindow=None):
3190
+ """
3191
+ Rather than being an alias for some class, the Python version of
3192
+ ``HelpController`` is a factory function that creates and returns an
3193
+ instance of the best Help Controller for the platform.
3194
+ """
3195
+ try:
3196
+ if 'wxMSW' in wx.PlatformInfo:
3197
+ from .msw import CHMHelpController as ControllerClass
3198
+ else:
3199
+ from .html import HtmlHelpController as ControllerClass
3200
+ except ImportError:
3201
+ from .adv import ExtHelpController as ControllerClass
3202
+
3203
+ return ControllerClass(parentWindow)
3204
+
3205
+ PrintPreview.Ok = wx.deprecated(PrintPreview.IsOk, 'Use IsOk instead.')
3206
+
3207
+ PyPrintPreview = wx.deprecated(PrintPreview, 'Use PrintPreview instead.')
3208
+
3209
+ PyPreviewFrame = wx.deprecated(PreviewFrame, 'Use PreviewFrame instead.')
3210
+
3211
+ PyPreviewControlBar = wx.deprecated(PreviewControlBar, 'Use PreviewControlBar instead.')
3212
+
3213
+ PyPrintout = wx.deprecated(Printout, 'Use Printout instead.')
3214
+
3215
+ def _BusyInfo___enter__(self):
3216
+ return self
3217
+ BusyInfo.__enter__ = _BusyInfo___enter__
3218
+ del _BusyInfo___enter__
3219
+ def _BusyInfo___exit__(self, exc_type, exc_val, exc_tb):
3220
+ return False
3221
+ BusyInfo.__exit__ = _BusyInfo___exit__
3222
+ del _BusyInfo___exit__
3223
+ def _FileHistoryMenuList___repr__(self):
3224
+ return "FileHistoryMenuList: " + repr(list(self))
3225
+ FileHistoryMenuList.__repr__ = _FileHistoryMenuList___repr__
3226
+ del _FileHistoryMenuList___repr__
3227
+ def _CommandList___repr__(self):
3228
+ return "CommandList: " + repr(list(self))
3229
+ CommandList.__repr__ = _CommandList___repr__
3230
+ del _CommandList___repr__
3231
+ EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER)
3232
+
3233
+ def version():
3234
+ """
3235
+ Returns a string containing version and port info
3236
+ """
3237
+ if wx.Port == '__WXMSW__':
3238
+ port = 'msw'
3239
+ elif wx.Port == '__WXMAC__':
3240
+ if 'wxOSX-carbon' in wx.PlatformInfo:
3241
+ port = 'osx-carbon'
3242
+ else:
3243
+ port = 'osx-cocoa'
3244
+ elif wx.Port == '__WXGTK__':
3245
+ port = 'gtk'
3246
+ if 'gtk2' in wx.PlatformInfo:
3247
+ port = 'gtk2'
3248
+ elif 'gtk3' in wx.PlatformInfo:
3249
+ port = 'gtk3'
3250
+ else:
3251
+ port = '???'
3252
+ return "%s %s (phoenix) %s" % (wx.VERSION_STRING, port, wx.wxWidgets_version)
3253
+
3254
+ _T = typing.TypeVar('_T')
3255
+ _P = typing.ParamSpec('_P')
3256
+
3257
+ def CallAfter(callableObj: typing.Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> None:
3258
+ """
3259
+ Call the specified function after the current and pending event
3260
+ handlers have been completed. This is also good for making GUI
3261
+ method calls from non-GUI threads. Any extra positional or
3262
+ keyword args are passed on to the callable when it is called.
3263
+
3264
+ :param PyObject callableObj: the callable object
3265
+ :param args: arguments to be passed to the callable object
3266
+ :param kw: keywords to be passed to the callable object
3267
+
3268
+ .. seealso::
3269
+ :ref:`wx.CallLater`
3270
+ """
3271
+ assert callable(callableObj), "callableObj is not callable"
3272
+ app = wx.GetApp()
3273
+ assert app is not None, 'No wx.App created yet'
3274
+
3275
+ if not hasattr(app, "_CallAfterId"):
3276
+ app._CallAfterId = wx.NewEventType()
3277
+ app.Connect(-1, -1, app._CallAfterId,
3278
+ lambda event: event.callable(*event.args, **event.kw) )
3279
+ evt = wx.PyEvent()
3280
+ evt.SetEventType(app._CallAfterId)
3281
+ evt.callable = callableObj
3282
+ evt.args = args
3283
+ evt.kw = kw
3284
+ wx.PostEvent(app, evt)
3285
+
3286
+ class CallLater(typing.Generic[_P, _T]):
3287
+ """
3288
+ A convenience class for :class:`wx.Timer`, that calls the given callable
3289
+ object once after the given amount of milliseconds, passing any
3290
+ positional or keyword args. The return value of the callable is
3291
+ available after it has been run with the :meth:`~wx.CallLater.GetResult`
3292
+ method.
3293
+
3294
+ If you don't need to get the return value or restart the timer
3295
+ then there is no need to hold a reference to this object. CallLater
3296
+ maintains references to its instances while they are running. When they
3297
+ finish, the internal reference is deleted and the GC is free to collect
3298
+ naturally.
3299
+
3300
+ .. seealso::
3301
+ :func:`wx.CallAfter`
3302
+ """
3303
+ __instances: dict = {}
3304
+ def __init__(self, millis, callableObj: typing.Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> None:
3305
+ """
3306
+ Constructs a new :class:`wx.CallLater` object.
3307
+
3308
+ :param int millis: number of milliseconds to delay until calling the callable object
3309
+ :param PyObject callableObj: the callable object
3310
+ :param args: arguments to be passed to the callable object
3311
+ :param kw: keyword arguments to be passed to the callable object
3312
+ """
3313
+ assert callable(callableObj), "callableObj is not callable"
3314
+ self.millis = millis
3315
+ self.callable = callableObj
3316
+ self.SetArgs(*args, **kwargs)
3317
+ self.runCount = 0
3318
+ self.running = False
3319
+ self.hasRun = False
3320
+ self.result = None
3321
+ self.timer = None
3322
+ self.Start()
3323
+
3324
+ def __del__(self):
3325
+ self.Stop()
3326
+
3327
+ def Start(self, millis: typing.Optional[int]=None, *args: _P.args, **kwargs: _P.kwargs) -> None:
3328
+ """
3329
+ (Re)start the timer
3330
+
3331
+ :param int millis: number of milli seconds
3332
+ :param args: arguments to be passed to the callable object
3333
+ :param kw: keywords to be passed to the callable object
3334
+ """
3335
+ self.hasRun = False
3336
+ if millis is not None:
3337
+ self.millis = millis
3338
+ if args or kwargs:
3339
+ self.SetArgs(*args, **kwargs)
3340
+ self.Stop()
3341
+ CallLater.__instances[self] = "value irrelevant" # Maintain a reference to avoid GC
3342
+ self.timer = wx.PyTimer(self.Notify)
3343
+ self.timer.Start(self.millis, wx.TIMER_ONE_SHOT)
3344
+ self.running = True
3345
+
3346
+ Restart = Start
3347
+ def Stop(self) -> None:
3348
+ """
3349
+ Stop and destroy the timer.
3350
+ """
3351
+ if self in CallLater.__instances:
3352
+ del CallLater.__instances[self]
3353
+ if self.timer is not None:
3354
+ self.timer.Stop()
3355
+ self.timer = None
3356
+
3357
+ def GetInterval(self) -> int:
3358
+ if self.timer is not None:
3359
+ return self.timer.GetInterval()
3360
+ else:
3361
+ return 0
3362
+
3363
+ def IsRunning(self) -> bool:
3364
+ return self.timer is not None and self.timer.IsRunning()
3365
+
3366
+ def SetArgs(self, *args: _P.args, **kwargs: _P.kwargs) -> None:
3367
+ """
3368
+ (Re)set the args passed to the callable object. This is
3369
+ useful in conjunction with :meth:`Start` if
3370
+ you want to schedule a new call to the same callable
3371
+ object but with different parameters.
3372
+
3373
+ :param args: arguments to be passed to the callable object
3374
+ :param kw: keywords to be passed to the callable object
3375
+ """
3376
+ self.args = args
3377
+ self.kwargs = kwargs
3378
+
3379
+ def HasRun(self) -> bool:
3380
+ """
3381
+ Returns whether or not the callable has run.
3382
+
3383
+ :rtype: bool
3384
+ """
3385
+ return self.hasRun
3386
+
3387
+ def GetResult(self) -> _T:
3388
+ """
3389
+ Returns the value of the callable.
3390
+
3391
+ :rtype: a Python object
3392
+ :return: result from callable
3393
+ """
3394
+ return self.result
3395
+
3396
+ def Notify(self) -> None:
3397
+ """
3398
+ The timer has expired so call the callable.
3399
+ """
3400
+ if self.callable and getattr(self.callable, 'im_self', True):
3401
+ self.runCount += 1
3402
+ self.running = False
3403
+ self.result = self.callable(*self.args, **self.kwargs)
3404
+ self.hasRun = True
3405
+ if not self.running:
3406
+ # if it wasn't restarted, then cleanup
3407
+ wx.CallAfter(self.Stop)
3408
+
3409
+ Interval = property(GetInterval)
3410
+ Result = property(GetResult)
3411
+
3412
+ FutureCall = deprecated(CallLater, 'Use CallLater instead.')
3413
+
3414
+ def GetDefaultPyEncoding() -> str:
3415
+ return "utf-8"
3416
+ GetDefaultPyEncoding = deprecated(GetDefaultPyEncoding, msg="wxPython now always uses utf-8")
3417
+