[Python-modules-commits] [python-easygui] 01/02: Import python-easygui_0.98.0.orig.tar.gz
Andreas Noteng
anoteng-guest at moszumanska.debian.org
Wed May 11 20:57:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
anoteng-guest pushed a commit to branch master
in repository python-easygui.
commit 01e4c07b90934332149c14210b136c3eb39a7d49
Author: Andreas Noteng <andreas at noteng.no>
Date: Wed May 11 22:57:06 2016 +0200
Import python-easygui_0.98.0.orig.tar.gz
---
.gitattributes | 29 +
.gitignore | 56 +
MANIFEST | 6 +
README.md | 118 +
README.txt | 120 +
__init__.py | 0
developer_information/BUILD INSTRUCTIONS.txt | 95 +
developer_information/DEVELOPER_NOTES.txt | 17 +
developer_information/Git-branching-model.png | Bin 0 -> 193289 bytes
easygui.py | 2412 --------------------
easygui/__init__.py | 58 +
easygui/boxes/__init__.py | 0
easygui/boxes/about.py | 257 +++
easygui/boxes/base_boxes.py | 27 +
easygui/boxes/button_box.py | 504 ++++
easygui/boxes/choice_box.py | 456 ++++
easygui/boxes/demo.py | 465 ++++
easygui/boxes/derived_boxes.py | 414 ++++
easygui/boxes/diropen_box.py | 58 +
easygui/boxes/egstore.py | 145 ++
easygui/boxes/fileboxsetup.py | 164 ++
easygui/boxes/fileopen_box.py | 122 +
easygui/boxes/filesave_box.py | 69 +
easygui/boxes/fillable_box.py | 169 ++
easygui/boxes/global_state.py | 28 +
easygui/boxes/multi_fillable_box.py | 495 ++++
easygui/boxes/text_box.py | 575 +++++
easygui/boxes/utils.py | 222 ++
easygui/easygui.py | 86 +
.../python_and_check_logo.gif | Bin
easygui/python_and_check_logo.jpg | Bin 0 -> 8928 bytes
easygui/python_and_check_logo.png | Bin 0 -> 3585 bytes
easygui/zzzzz.gif | Bin 0 -> 1703 bytes
easygui_license_info.txt | 9 -
easygui_pydoc.html | 441 ----
easygui_version_info.html | 417 ----
setup.cfg | 3 +
setup.py | 119 +-
sphinx/Makefile | 179 ++
sphinx/__init__.py | 1 +
.../_static/python-logo-master-v3-TM-flattened.png | Bin 0 -> 11155 bytes
.../easygui_demo_registration_app.zip | Bin 0 -> 3619 bytes
.../screenshot_register_main.png | Bin 0 -> 49603 bytes
.../screenshot_register_show.png | Bin 0 -> 16886 bytes
sphinx/_static/tutorial/python-logo.gif | Bin 0 -> 2086 bytes
sphinx/_static/tutorial/screenshot2.png | Bin 0 -> 12824 bytes
sphinx/_static/tutorial/screenshot3.png | Bin 0 -> 16559 bytes
sphinx/_static/tutorial/screenshot4.png | Bin 0 -> 19062 bytes
.../tutorial/screenshot_buttonbox-with-image.gif | Bin 0 -> 22101 bytes
.../tutorial/screenshot_buttonbox_with_image.png | Bin 0 -> 9475 bytes
sphinx/_static/tutorial/screenshot_ccbox.png | Bin 0 -> 19062 bytes
sphinx/_static/tutorial/screenshot_choicebox.png | Bin 0 -> 26832 bytes
.../tutorial/screenshot_choicebox_icecream.png | Bin 0 -> 28991 bytes
...eenshot_choicebox_monofonts_and_exit_button.gif | Bin 0 -> 40957 bytes
.../screenshot_choicebox_with_multiple_buttons.gif | Bin 0 -> 21431 bytes
.../_static/tutorial/screenshot_codebox_vista.png | Bin 0 -> 35260 bytes
.../tutorial/screenshot_exceptionbox_vista.png | Bin 0 -> 24498 bytes
.../tutorial/screenshot_fileopenbox_vista.png | Bin 0 -> 64330 bytes
sphinx/_static/tutorial/screenshot_msgbox.png | Bin 0 -> 14872 bytes
.../_static/tutorial/screenshot_multchoicebox.png | Bin 0 -> 43432 bytes
.../_static/tutorial/screenshot_multenterbox.png | Bin 0 -> 9609 bytes
.../tutorial/screenshot_multenterbox_vista.png | Bin 0 -> 11853 bytes
sphinx/_static/tutorial/screenshot_passwordbox.png | Bin 0 -> 7841 bytes
sphinx/api.rst | 12 +
sphinx/conf.py | 292 +++
sphinx/cookbook.rst | 145 ++
sphinx/faq.rst | 52 +
sphinx/index.rst | 117 +
sphinx/links.rst | 49 +
sphinx/make.bat | 246 ++
sphinx/support.rst | 44 +
sphinx/tutorial.rst | 498 ++++
test_cases/SimpleCv.py | 38 +
test_cases/The Pirates of the Caribean Game.py | 36 +
test_cases/audio/intro.mp3 | Bin 0 -> 704026 bytes
test_cases/audio/intro.ogg | Bin 0 -> 332054 bytes
test_cases/books.xml | 120 +
test_cases/dice.py | 68 +
test_cases/file_open_box.py | 11 +
test_cases/flash_multiple_rb.py | 16 +
test_cases/geo_quiz.py | 460 ++++
test_cases/gps_auto_update.py | 40 +
test_cases/hex_entry.py | 89 +
test_cases/images/cross.gif | Bin 0 -> 4517 bytes
test_cases/images/daffy duck.gif | Bin 0 -> 6766 bytes
test_cases/images/dave.gif | Bin 0 -> 17478 bytes
test_cases/images/globe.jpg | Bin 0 -> 44519 bytes
test_cases/images/mickey.gif | Bin 0 -> 10353 bytes
test_cases/images/minnie.gif | Bin 0 -> 8236 bytes
test_cases/images/tick.gif | Bin 0 -> 2073 bytes
test_cases/multienter_backspace.py | 38 +
test_cases/multiple_disney_images.py | 39 +
test_cases/pi.jpg | Bin 0 -> 5520 bytes
test_cases/result.png | Bin 0 -> 546 bytes
test_cases/text2binary.py | 12 +
test_cases/weather_man.py | 10 +
test_cases/xml_parse.py | 32 +
97 files changed, 7517 insertions(+), 3283 deletions(-)
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..b788074
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,29 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
+
+# suppress some directories from language statistics
+# ref: https://github.com/github/linguist#overrides
+legacy_website/* linguist-vendored
+docs/* linguist-vendored
+releases/* linguist-vendored
+developer_information/* linguist-vendored
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6e2178f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,56 @@
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msm
+*.msp
+
+# =========================
+# Operating System Files
+# =========================
+
+# OSX
+# =========================
+
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear on external disk
+.Spotlight-V100
+.Trashes
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+sphinx/_build
+*.*~
+*.pyc
+.idea
+*.swp
+*.html.bak
+
+docs/
+build/
+build\
+easygui.egg-info/
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..ba2e77b
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,6 @@
+# file GENERATED by distutils, do NOT edit
+README.txt
+__init__.py
+setup-docs.py
+setup.cfg
+setup.py
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d587c6a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,118 @@
+EasyGUI
+=======
+
+EasyGUI is a module for very simple, very easy GUI programming in Python. EasyGUI is different from other GUI
+libraries in that EasyGUI is NOT event-driven. Instead, all GUI interactions are invoked by simple function calls.
+
+EasyGUI runs on Python 2 and 3, and does not have any dependencies beyond python.
+
+Example Usage
+-------------
+
+ >>> import easygui
+ >>> easygui.ynbox('Shall I continue?', 'Title', ('Yes', 'No'))
+ 1
+ >>> easygui.msgbox('This is a basic message box.', 'Title Goes Here')
+ 'OK'
+ >>> easygui.buttonbox('Click on your favorite flavor.', 'Favorite Flavor', ('Chocolate', 'Vanilla', 'Strawberry'))
+ 'Chocolate'
+
+
+Full documentation is always available.
+
+For the most-recent production version:
+<http://easygui.readthedocs.org/en/master/>.
+
+For our develop version which will be released next:
+<http://easygui.readthedocs.org/en/develop>.
+
+========================================================================
+0.98.0
+========================================================================
+This is an exciting time for easygui. We continue to make good progress with refactoring as
+well as some enhancements and bug fixes here and there.
+
+We would like to welcome Juanjo Denis-Corrales to the team. He is responsible for lots of good new work
+this release. Of course we appreciate the work of everyone who contributed.
+
+NOTE: I decided in this release to change the API a bit. Please consult the function documentation for details.
+
+BUG FIXES
+---------
+ * Made changes guessing at fixes to any IDLE problems. Please report any problems found.
+
+ENHANCEMENTS
+------------
+ * Refactored the easygui.py file into several smaller files to improve our ability to manage the code
+ * Added callbacks to allow for more dynamic dialogs. See the docs for usage.
+ * Added class access to dialogs so properties may be changed.
+
+KNOWN ISSUES
+------------
+ * There were previous issues when using easygui with the IDLE IDE. I hope I resolved these problems, however,
+ I've never actually been able to repeat them. Please report any problems found in github.
+
+OTHER CHANGES
+-------------
+ * Centralized the Python 2 versus Python 3 "compatibility layer" into boxes/utils.py
+
+
+0.97.4
+========================================================================
+This is a minor bug-fix release to address python 3 import errors.
+
+0.97.3
+========================================================================
+We are happy to release version 0.97.3 of easygui. The intent of this release is to address some basic
+functionality issues as well as improve easygui in the ways people have asked.
+
+Robert Lugg (me) was searching for a GUI library for my python work. I saw easygui and liked very much its
+paradigm. Stephen Ferg, the creator and developer of easygui, graciously allowed me to start development
+back up. With the help of Alexander Zawadzki, Horst Jens, and others I set a goal to release before the
+end of 2014.
+
+We rely on user feedback so please bring up problems, ideas, or just say how you are using easygui.
+
+BUG FIXES
+---------
+ * sourceforge #4: easygui docs contain bad references to easygui_pydoc.html
+ * sourceforge #6: no index.html in docs download file. Updated to sphinx which as autolinking.
+ * sourceforge #8: unicode issues with file*box. Fixed all that I knew how.
+ * sourceforge #12: Cannot Exit with 'X'. Now X and escape either return "cancel_button", if set, or None
+
+ENHANCEMENTS
+------------
+ * Added ability to specify default_choice and cancel_choice for button widgets (See API docs)
+ * True and False are returned instead of 1 and 0 for several boxes
+ * Allow user to map keyboard keys to buttons by enclosing a hotkey in square braces like: "Pick [M]e", which would assign
+ keyboard key M to that button. Double braces hide that character, and keysyms are allowed:
+ [[q]]Exit Would show Exit on the button, and the button would be controlled by the q key
+ [<F1>]Help Would show Help on the button, and the button would be controlled by the F1 function key
+ NOTE: We are still working on the exact syntax of these key mappings as Enter, space, and arrows are already being
+ used.
+ * Escape and the windows 'X' button always work in buttonboxes. Those return None in that case.
+ * sourceforge #9: let fileopenbox open multiple files. Added optional argument 'multiple'
+ * Location of dialogs on screen is preserved. This isn't perfect yet, but now, at least, the dialogs don't
+ always reset to their default position!
+ * added some, but not all of the bugs/enhancements developed by Robbie Brook:
+ http://all-you-need-is-tech.blogspot.com/2013/01/improving-easygui-for-python.html
+
+KNOWN ISSUES
+------------
+ * In the documentation, there were previous references to issues when using the IDLE IDE. I haven't
+ experienced those, but also didn't do anything to fix them, so they may still be there. Please report
+ any problems and we'll try to address them
+ * I am fairly new to contributing to open source, so I don't understand packaging, pypi, etc. There
+ are likely problems as well as better ways to do things. Again, I appreciate any help or guidance.
+
+Other Changes (that you likely don't care about)
+------------------------------------------------
+ * Restructured loading of image files to try PIL first throw error if file doesn't exist.
+ * Converted docs to sphinx with just a bit of doctest. Most content was retained from the old site, so
+ there might be some redundancies still. Please make any suggested improvements.
+ * Set up a GitHub repository for development: https://github.com/robertlugg/easygui
+ * Improved output/packaging for Debian distribution
+
+EasyGui is licensed under what is generally known as
+the "modified BSD license" (aka "revised BSD", "new BSD", "3-clause BSD").
+This license is GPL-compatible but less restrictive than GPL.
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..dccacc3
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,120 @@
+EasyGUI
+=======
+
+EasyGUI is a module for very simple, very easy GUI programming in Python. EasyGUI is different from other GUI
+libraries in that EasyGUI is NOT event-driven. Instead, all GUI interactions are invoked by simple function calls.
+
+EasyGUI runs on Python 2 and 3, and does not have any dependencies beyond python.
+
+Example Usage
+-------------
+
+ >>> import easygui
+ >>> easygui.ynbox('Shall I continue?', 'Title', ('Yes', 'No'))
+ 1
+ >>> easygui.msgbox('This is a basic message box.', 'Title Goes Here')
+ 'OK'
+ >>> easygui.buttonbox('Click on your favorite flavor.', 'Favorite Flavor', ('Chocolate', 'Vanilla', 'Strawberry'))
+ 'Chocolate'
+
+
+Full documentation is always available.
+
+For the most-recent production version:
+<http://easygui.readthedocs.org/en/master/>.
+
+For our develop version which will be released next:
+<http://easygui.readthedocs.org/en/develop>.
+
+
+========================================================================
+0.98.0
+========================================================================
+This is an exciting time for easygui. We continue to make good progress with refactoring as
+well as some enhancements and bug fixes here and there.
+
+We would like to welcome Juanjo Denis-Corrales to the team. He is responsible for lots of good new work
+this release. Of course we appreciate the work of everyone who contributed.
+
+NOTE: I decided in this release to change the API a bit. Please consult the function documentation for details.
+
+BUG FIXES
+---------
+ * Made changes guessing at fixes to any IDLE problems. Please report any problems found.
+
+ENHANCEMENTS
+------------
+ * Refactored the easygui.py file into several smaller files to improve our ability to manage the code
+ * Added callbacks to allow for more dynamic dialogs. See the docs for usage.
+ * Added class access to dialogs so properties may be changed.
+ * in integerbox, allowed lower and upper bounds to be None which means they aren't checked.
+
+KNOWN ISSUES
+------------
+ * There were previous issues when using easygui with the IDLE IDE. I hope I resolved these problems, however,
+ I've never actually been able to repeat them. Please report any problems found in github.
+
+OTHER CHANGES
+-------------
+ * Centralized the Python 2 versus Python 3 "compatibility layer" into boxes/utils.py
+
+
+0.97.4
+========================================================================
+This is a minor bug-fix release to address python 3 import errors.
+
+0.97.3
+========================================================================
+We are happy to release version 0.97.3 of easygui. The intent of this release is to address some basic
+functionality issues as well as improve easygui in the ways people have asked.
+
+Robert Lugg (me) was searching for a GUI library for my python work. I saw easygui and liked very much its
+paradigm. Stephen Ferg, the creator and developer of easygui, graciously allowed me to start development
+back up. With the help of Alexander Zawadzki, Horst Jens, and others I set a goal to release before the
+end of 2014.
+
+We rely on user feedback so please bring up problems, ideas, or just say how you are using easygui.
+
+BUG FIXES
+---------
+ * sourceforge #4: easygui docs contain bad references to easygui_pydoc.html
+ * sourceforge #6: no index.html in docs download file. Updated to sphinx which as autolinking.
+ * sourceforge #8: unicode issues with file*box. Fixed all that I knew how.
+ * sourceforge #12: Cannot Exit with 'X'. Now X and escape either return "cancel_button", if set, or None
+
+ENHANCEMENTS
+------------
+ * Added ability to specify default_choice and cancel_choice for button widgets (See API docs)
+ * True and False are returned instead of 1 and 0 for several boxes
+ * Allow user to map keyboard keys to buttons by enclosing a hotkey in square braces like: "Pick [M]e", which would assign
+ keyboard key M to that button. Double braces hide that character, and keysyms are allowed:
+ [[q]]Exit Would show Exit on the button, and the button would be controlled by the q key
+ [<F1>]Help Would show Help on the button, and the button would be controlled by the F1 function key
+ NOTE: We are still working on the exact syntax of these key mappings as Enter, space, and arrows are already being
+ used.
+ * Escape and the windows 'X' button always work in buttonboxes. Those return None in that case.
+ * sourceforge #9: let fileopenbox open multiple files. Added optional argument 'multiple'
+ * Location of dialogs on screen is preserved. This isn't perfect yet, but now, at least, the dialogs don't
+ always reset to their default position!
+ * added some, but not all of the bugs/enhancements developed by Robbie Brook:
+ http://all-you-need-is-tech.blogspot.com/2013/01/improving-easygui-for-python.html
+
+KNOWN ISSUES
+------------
+ * In the documentation, there were previous references to issues when using the IDLE IDE. I haven't
+ experienced those, but also didn't do anything to fix them, so they may still be there. Please report
+ any problems and we'll try to address them
+ * I am fairly new to contributing to open source, so I don't understand packaging, pypi, etc. There
+ are likely problems as well as better ways to do things. Again, I appreciate any help or guidance.
+
+Other Changes (that you likely don't care about)
+------------------------------------------------
+ * Restructured loading of image files to try PIL first throw error if file doesn't exist.
+ * Converted docs to sphinx with just a bit of doctest. Most content was retained from the old site, so
+ there might be some redundancies still. Please make any suggested improvements.
+ * Set up a GitHub repository for development: https://github.com/robertlugg/easygui
+ * Improved output/packaging for Debian distribution
+
+EasyGui is licensed under what is generally known as
+the "modified BSD license" (aka "revised BSD", "new BSD", "3-clause BSD").
+This license is GPL-compatible but less restrictive than GPL.
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/developer_information/BUILD INSTRUCTIONS.txt b/developer_information/BUILD INSTRUCTIONS.txt
new file mode 100644
index 0000000..3f934be
--- /dev/null
+++ b/developer_information/BUILD INSTRUCTIONS.txt
@@ -0,0 +1,95 @@
+Introduction:
+-------------
+
+These instructions explain how to actually deploy easygui
+
+Documentation
+-------------
+Documentation is auto-built by readthedocs.
+
+Creating a package
+------------------
+* Update README.md and README.txt to include the current release note text
+* Update sphinx/conf.py with new version and release date
+* Update easygui/easygui.py with new version in eg_version. This should be fixed.
+* Update setup.py with new version. update it with any new packages (such as easygui.boxes)
+* Update sourceforge site
+
+
+Creating a pypi package
+-----------------------
+
+Links:
+Install/packaging:
+ https://packaging.python.org/en/latest/distributing.html
+ http://stackoverflow.com/questions/22051360/a-simple-hello-world-setuptools-package-and-installing-it-with-pip
+ https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/
+Things I needed to do:
+install meld diff tool
+pip install --upgrade pip
+pip install -U twine
+pip install -U wheel
+pip install --upgrade virtualenv
+
+to package it up:
+python setup.py sdist -d releases\0.97.4 --formats=gztar,zip
+python setup.py bdist_wheel -d releases\0.97.4
+
+to package it into an egg:
+python setup.py bdist_egg
+...but to actually import it (instead of install), I need to change its filename to remove the -
+
+to tag GitHub repository
+git push --tags
+git fetch --tags
+git tag -a ...
+git push --tags
+
+
+- These create two directories: build and dist
+
+check confirm install works:
+virtualenv 27_dist
+.\Scripts\activate.bat
+then: pip install ...releases..zipfile...
+python
+ import easygui
+ easygui.egdemo()
+
+
+
+To upload to pypi:
+
+twine upload releases\0.97.4\*
+
+
+Create a .pypirc file in my Users/rlugg (home) directory. The file like:
+[distutils]
+index-servers=
+ test-server
+ pypi
+
+[test-server]
+repository = https://testpypi.python.org/pypi
+username = Robert.Lugg
+password = XXX
+
+[pypi]
+repository = https://pypi.python.org/pypi
+username = Robert.Lugg
+password = XXX
+
+Then:
+python setup.py register -r test-server
+python setup.py sdist upload -r test-server
+python setup.py bdist_wheel upload -r test-server
+
+xxxxxxxxxxxxxxxxxxxxxxxxxxx
+OLD INFO: Not needed.
+* Update sourceforge website with 'documentation' directory
+ sftp: web.sourceforge.net
+ user: robertlugg (for example)
+ password: your sourceforge password
+* Update pypi docs website: You can now host documentation at http://pythonhosted.org/easygui. To upload documentation, prepare a .zip file that is unpacked into this URL. Only static pages are supported. The zip file must have a top-level "index.html".
+-----
+# python setup-docs.py sdist -d releases\0.9.3 --formats=gztar,zip # FOR NOW, use 7-zip to create a .tar file
diff --git a/developer_information/DEVELOPER_NOTES.txt b/developer_information/DEVELOPER_NOTES.txt
new file mode 100644
index 0000000..d99050d
--- /dev/null
+++ b/developer_information/DEVELOPER_NOTES.txt
@@ -0,0 +1,17 @@
+Getting Linux up and running.
+
+Use virtualbox and download a ready-made vdi file for something like experimentalOS
+
+
+
+
+Setup up git to use meld as default
+git config --global merge.tool meld
+
+Issues with ElementaryOS0.2. I needed, for some reason to install this:
+sudo apt-get install python-tk
+
+Git Stuff:
+* We will follow the process described in Git-branching-model.pdf
+* To remove a file from Git, but still leave it in the local directory: git rm --cached file.txt
+* Tag files when released: $ git tag -a "0.97.3" -m "0.97.3 (2014-12-27)"
diff --git a/developer_information/Git-branching-model.png b/developer_information/Git-branching-model.png
new file mode 100644
index 0000000..bb110b7
Binary files /dev/null and b/developer_information/Git-branching-model.png differ
diff --git a/easygui.py b/easygui.py
deleted file mode 100644
index 2ce1be2..0000000
--- a/easygui.py
+++ /dev/null
@@ -1,2412 +0,0 @@
-"""
- at version: 0.96(2010-06-25)
- at note:
-EasyGui provides an easy-to-use interface for simple GUI interaction
-with a user. It does not require the programmer to know anything about
-tkinter, frames, widgets, callbacks or lambda. All GUI interactions are
-invoked by simple function calls that return results.
-
-
- at note:
-WARNING about using EasyGui with IDLE
-
-You may encounter problems using IDLE to run programs that use EasyGui. Try it
-and find out. EasyGui is a collection of Tkinter routines that run their own
-event loops. IDLE is also a Tkinter application, with its own event loop. The
-two may conflict, with unpredictable results. If you find that you have
-problems, try running your EasyGui program outside of IDLE.
-
-Note that EasyGui requires Tk release 8.0 or greater.
-"""
-egversion = __doc__.split()[1]
-
-__all__ = ['ynbox'
- , 'ccbox'
- , 'boolbox'
- , 'indexbox'
- , 'msgbox'
- , 'buttonbox'
- , 'integerbox'
- , 'multenterbox'
- , 'enterbox'
- , 'exceptionbox'
- , 'choicebox'
- , 'codebox'
- , 'textbox'
- , 'diropenbox'
- , 'fileopenbox'
- , 'filesavebox'
- , 'passwordbox'
- , 'multpasswordbox'
- , 'multchoicebox'
- , 'abouteasygui'
- , 'egversion'
- , 'egdemo'
- , 'EgStore'
- ]
-
-import sys, os, string, types, pickle,traceback
-import pprint
-
-#--------------------------------------------------
-# check python version and take appropriate action
-#--------------------------------------------------
-"""
-From the python documentation:
-
-sys.hexversion contains the version number encoded as a single integer. This is
-guaranteed to increase with each version, including proper support for non-
-production releases. For example, to test that the Python interpreter is at
-least version 1.5.2, use:
-
-if sys.hexversion >= 0x010502F0:
- # use some advanced feature
- ...
-else:
- # use an alternative implementation or warn the user
- ...
-"""
-
-
-if sys.hexversion >= 0x020600F0:
- runningPython26 = True
-else:
- runningPython26 = False
-
-if sys.hexversion >= 0x030000F0:
- runningPython3 = True
-else:
- runningPython3 = False
-
-
-if runningPython3:
- from tkinter import *
- import tkinter.filedialog as tk_FileDialog
- from io import StringIO
-else:
- from Tkinter import *
- import tkFileDialog as tk_FileDialog
- from StringIO import StringIO
-
-def write(*args):
- args = [str(arg) for arg in args]
- args = " ".join(args)
- sys.stdout.write(args)
-
-def writeln(*args):
- write(*args)
- sys.stdout.write("\n")
-
-say = writeln
-
-
-if TkVersion < 8.0 :
- stars = "*"*75
- writeln("""\n\n\n""" + stars + """
-You are running Tk version: """ + str(TkVersion) + """
-You must be using Tk version 8.0 or greater to use EasyGui.
-Terminating.
-""" + stars + """\n\n\n""")
- sys.exit(0)
-
-def dq(s):
- return '"%s"' % s
-
-rootWindowPosition = "+300+200"
-
-PROPORTIONAL_FONT_FAMILY = ("MS", "Sans", "Serif")
-MONOSPACE_FONT_FAMILY = ("Courier")
-
-PROPORTIONAL_FONT_SIZE = 10
-MONOSPACE_FONT_SIZE = 9 #a little smaller, because it it more legible at a smaller size
-TEXT_ENTRY_FONT_SIZE = 12 # a little larger makes it easier to see
-
-#STANDARD_SELECTION_EVENTS = ["Return", "Button-1"]
-STANDARD_SELECTION_EVENTS = ["Return", "Button-1", "space"]
-
-# Initialize some global variables that will be reset later
-__choiceboxMultipleSelect = None
-__widgetTexts = None
-__replyButtonText = None
-__choiceboxResults = None
-__firstWidget = None
-__enterboxText = None
-__enterboxDefaultText=""
-__multenterboxText = ""
-choiceboxChoices = None
-choiceboxWidget = None
-entryWidget = None
-boxRoot = None
-ImageErrorMsg = (
- "\n\n---------------------------------------------\n"
- "Error: %s\n%s")
-#-------------------------------------------------------------------
-# various boxes built on top of the basic buttonbox
-#-----------------------------------------------------------------------
-
-#-----------------------------------------------------------------------
-# ynbox
-#-----------------------------------------------------------------------
-def ynbox(msg="Shall I continue?"
- , title=" "
- , choices=("Yes", "No")
- , image=None
- ):
- """
- Display a msgbox with choices of Yes and No.
-
- The default is "Yes".
-
- The returned value is calculated this way::
- if the first choice ("Yes") is chosen, or if the dialog is cancelled:
- return 1
- else:
- return 0
-
- If invoked without a msg argument, displays a generic request for a confirmation
- that the user wishes to continue. So it can be used this way::
- if ynbox(): pass # continue
- else: sys.exit(0) # exit the program
-
- @arg msg: the msg to be displayed.
- @arg title: the window title
- @arg choices: a list or tuple of the choices to be displayed
- """
- return boolbox(msg, title, choices, image=image)
-
-
-#-----------------------------------------------------------------------
-# ccbox
-#-----------------------------------------------------------------------
-def ccbox(msg="Shall I continue?"
- , title=" "
- , choices=("Continue", "Cancel")
- , image=None
- ):
- """
- Display a msgbox with choices of Continue and Cancel.
-
- The default is "Continue".
-
- The returned value is calculated this way::
- if the first choice ("Continue") is chosen, or if the dialog is cancelled:
- return 1
- else:
- return 0
-
- If invoked without a msg argument, displays a generic request for a confirmation
- that the user wishes to continue. So it can be used this way::
-
- if ccbox():
- pass # continue
- else:
- sys.exit(0) # exit the program
-
- @arg msg: the msg to be displayed.
- @arg title: the window title
- @arg choices: a list or tuple of the choices to be displayed
- """
- return boolbox(msg, title, choices, image=image)
-
-
-#-----------------------------------------------------------------------
-# boolbox
-#-----------------------------------------------------------------------
-def boolbox(msg="Shall I continue?"
- , title=" "
- , choices=("Yes","No")
- , image=None
- ):
- """
- Display a boolean msgbox.
-
- The default is the first choice.
-
- The returned value is calculated this way::
- if the first choice is chosen, or if the dialog is cancelled:
- returns 1
- else:
- returns 0
- """
- reply = buttonbox(msg=msg, choices=choices, title=title, image=image)
- if reply == choices[0]: return 1
- else: return 0
-
-
-#-----------------------------------------------------------------------
-# indexbox
-#-----------------------------------------------------------------------
-def indexbox(msg="Shall I continue?"
- , title=" "
- , choices=("Yes","No")
- , image=None
- ):
- """
- Display a buttonbox with the specified choices.
- Return the index of the choice selected.
- """
- reply = buttonbox(msg=msg, choices=choices, title=title, image=image)
- index = -1
- for choice in choices:
- index = index + 1
- if reply == choice: return index
- raise AssertionError(
- "There is a program logic error in the EasyGui code for indexbox.")
-
-
-#-----------------------------------------------------------------------
-# msgbox
-#-----------------------------------------------------------------------
-def msgbox(msg="(Your message goes here)", title=" ", ok_button="OK",image=None,root=None):
- """
- Display a messagebox
- """
- if type(ok_button) != type("OK"):
- raise AssertionError("The 'ok_button' argument to msgbox must be a string.")
-
- return buttonbox(msg=msg, title=title, choices=[ok_button], image=image,root=root)
-
-
-#-------------------------------------------------------------------
-# buttonbox
-#-------------------------------------------------------------------
-def buttonbox(msg="",title=" "
- ,choices=("Button1", "Button2", "Button3")
- , image=None
- , root=None
- ):
- """
- Display a msg, a title, and a set of buttons.
- The buttons are defined by the members of the choices list.
- Return the text of the button that the user selected.
-
- @arg msg: the msg to be displayed.
- @arg title: the window title
- @arg choices: a list or tuple of the choices to be displayed
- """
- global boxRoot, __replyButtonText, __widgetTexts, buttonsFrame
-
-
- # Initialize __replyButtonText to the first choice.
- # This is what will be used if the window is closed by the close button.
- __replyButtonText = choices[0]
-
- if root:
- root.withdraw()
- boxRoot = Toplevel(master=root)
- boxRoot.withdraw()
- else:
- boxRoot = Tk()
- boxRoot.withdraw()
-
- boxRoot.protocol('WM_DELETE_WINDOW', denyWindowManagerClose )
- boxRoot.title(title)
- boxRoot.iconname('Dialog')
- boxRoot.geometry(rootWindowPosition)
- boxRoot.minsize(400, 100)
-
- # ------------- define the messageFrame ---------------------------------
- messageFrame = Frame(master=boxRoot)
- messageFrame.pack(side=TOP, fill=BOTH)
-
- # ------------- define the imageFrame ---------------------------------
-
-
- tk_Image = None
- if image:
- imageFilename = os.path.normpath(image)
- junk,ext = os.path.splitext(imageFilename)
-
- if os.path.exists(imageFilename):
- if ext.lower() in [".gif", ".pgm", ".ppm"]:
- tk_Image = PhotoImage(file=imageFilename)
- else:
- try:
- from PIL import Image as PILImage
- from PIL import ImageTk as PILImageTk
- PILisLoaded = True
- except:
- PILisLoaded = False
-
- if PILisLoaded:
- try:
- pil_Image = PILImage.open(imageFilename)
- tk_Image = PILImageTk.PhotoImage(pil_Image)
- except:
- msg += ImageErrorMsg % (imageFilename,
- "\nThe Python Imaging Library (PIL) could not convert this file to a displayable image."
- "\n\nPIL reports:\n" + exception_format())
-
- else: # PIL is not loaded
- msg += ImageErrorMsg % (imageFilename,
- "\nI could not import the Python Imaging Library (PIL) to display the image.\n\n"
- "You may need to install PIL\n"
- "(http://www.pythonware.com/products/pil/)\n"
- "to display " + ext + " image files.")
-
- else:
- msg += ImageErrorMsg % (imageFilename, "\nImage file not found.")
-
- if tk_Image:
- imageFrame = Frame(master=boxRoot)
- imageFrame.pack(side=TOP, fill=BOTH)
- label = Label(imageFrame,image=tk_Image)
- label.image = tk_Image # keep a reference!
- label.pack(side=TOP, expand=YES, fill=X, padx='1m', pady='1m')
-
- # ------------- define the buttonsFrame ---------------------------------
- buttonsFrame = Frame(master=boxRoot)
- buttonsFrame.pack(side=TOP, fill=BOTH)
-
- # -------------------- place the widgets in the frames -----------------------
- messageWidget = Message(messageFrame, text=msg, width=400)
- messageWidget.configure(font=(PROPORTIONAL_FONT_FAMILY,PROPORTIONAL_FONT_SIZE))
- messageWidget.pack(side=TOP, expand=YES, fill=X, padx='3m', pady='3m')
-
- __put_buttons_in_buttonframe(choices)
-
- # -------------- the action begins -----------
- # put the focus on the first button
- __firstWidget.focus_force()
-
- boxRoot.deiconify()
- boxRoot.mainloop()
- boxRoot.destroy()
- if root: root.deiconify()
- return __replyButtonText
-
-
-#-------------------------------------------------------------------
-# integerbox
-#-------------------------------------------------------------------
-def integerbox(msg=""
- , title=" "
- , default=""
- , lowerbound=0
- , upperbound=99
- , image = None
- , root = None
- , **invalidKeywordArguments
- ):
- """
- Show a box in which a user can enter an integer.
-
- In addition to arguments for msg and title, this function accepts
- integer arguments for "default", "lowerbound", and "upperbound".
-
- The default argument may be None.
-
... 10420 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-easygui.git
More information about the Python-modules-commits
mailing list