, 'passwordbox'
, 'multpasswordbox'
, 'multchoicebox'
- , 'abouteasygui'
+# , 'abouteasygui'
, 'egversion'
- , 'egdemo'
- , 'EgStore'
+# , 'egdemo'
+# , 'EgStore'
]
import sys, os
ImageErrorMsg = (
"\n\n---------------------------------------------\n"
"Error: %s\n%s")
+
+def _bring_to_front():
+ from subprocess import Popen
+ Tk().destroy()
+ Popen([
+ 'osascript',
+ '-e', 'tell application "System Events"',
+ '-e', 'set vprocs to every process whose unix id is %s' % os.getpid(),
+ '-e', 'repeat with proc in vprocs',
+ '-e', 'set the frontmost of proc to true',
+ '-e', 'end repeat',
+ '-e', 'end tell'
+ ])
#-------------------------------------------------------------------
# various boxes built on top of the basic buttonbox
#-----------------------------------------------------------------------
@arg choices: a list or tuple of the choices to be displayed
"""
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
+ _bring_to_front()
global boxRoot, __replyButtonText, __widgetTexts, buttonsFrame
supported. They have been replaced by "upperbound" and "lowerbound".
"""
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
+ _bring_to_front()
if "argLowerBound" in invalidKeywordArguments:
raise AssertionError(
"\nintegerbox no longer supports the 'argLowerBound' argument.\n"
while 1:
reply = enterbox(msg, title, str(default), image=image, root=root)
- if reply == None: return None
+ if reply is None:
+ return None
try:
reply = int(reply)
, mask = None
):
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
+ _bring_to_front()
global boxRoot, __multenterboxText, __multenterboxDefaultText, cancelButton, entryWidget, okButton
Returns the text that the user entered, or None if he cancels the operation.
"""
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
-
+ _bring_to_front()
global boxRoot, __enterboxText, __enterboxDefaultText
global cancelButton, entryWidget, okButton
- if title == None: title == ""
- if default == None: default = ""
+ if title is None:
+ title = ""
+ if default is None:
+ default = ""
__enterboxDefaultText = default
__enterboxText = __enterboxDefaultText
internal routine to support choicebox() and multchoicebox()
"""
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
+ _bring_to_front()
global boxRoot, __choiceboxResults, choiceboxWidget, defaultText
global choiceboxWidget, choiceboxChoices
#-------------------------------------------------------------------
lines_to_show = min(len(choices), 20)
lines_to_show = 20
- if title == None: title = ""
+ if title is None:
+ title = ""
# Initialize __choiceboxResults
# This is the value that will be returned if the user clicks the close icon
Note that you do not need to (and cannot) pass an exception object
as an argument. The latest exception will automatically be used.
"""
- if title == None: title = "Error Report"
- if msg == None:
+ if title is None:
+ title = "Error Report"
+ if msg is None:
msg = "An error (exception) has occurred in the program."
codebox(msg, title, exception_format())
displayed in the textbox.
"""
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
- if msg == None: msg = ""
- if title == None: title = ""
+ _bring_to_front()
+ if msg is None:
+ msg = ""
+ if title is None:
+ title = ""
global boxRoot, __replyButtonText, __widgetTexts, buttonsFrame
global rootWindowPosition
directory exists, then the dialog box will start with that directory.
"""
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
+ _bring_to_front()
title=getFileDialogTitle(msg,title)
localRoot = Tk()
localRoot.withdraw()
@arg filetypes: filemasks that a user can choose, e.g. "*.txt"
"""
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
+ _bring_to_front()
localRoot = Tk()
localRoot.withdraw()
fileopenbox.
"""
if sys.platform == 'darwin':
- from subprocess import Popen
- Tk().destroy()
- Popen(['osascript', '-e', 'tell application "Python" to activate'])
+ _bring_to_front()
localRoot = Tk()
localRoot.withdraw()