summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1998-09-28 23:41:53 (GMT)
committerBarry Warsaw <barry@python.org>1998-09-28 23:41:53 (GMT)
commit63c9e9851ef229c641f24baea232ed8cffeaeb99 (patch)
tree04bcf2fc375a6e0db3cf2ed25bcdd4de1b5f5aa8
parent1ac18cd326648527c6fa5abf976285afd7a1b9eb (diff)
downloadcpython-63c9e9851ef229c641f24baea232ed8cffeaeb99.zip
cpython-63c9e9851ef229c641f24baea232ed8cffeaeb99.tar.gz
cpython-63c9e9851ef229c641f24baea232ed8cffeaeb99.tar.bz2
Rework startup
-rw-r--r--Tools/pynche/Main.py36
1 files changed, 10 insertions, 26 deletions
diff --git a/Tools/pynche/Main.py b/Tools/pynche/Main.py
index fca80d6..7fcc877 100644
--- a/Tools/pynche/Main.py
+++ b/Tools/pynche/Main.py
@@ -35,17 +35,14 @@ __version__ = '1.0'
import sys
import getopt
import ColorDB
-from Tkinter import *
from PyncheWidget import PyncheWidget
from Switchboard import Switchboard
+from StripViewer import StripViewer
PROGRAM = sys.argv[0]
-# Milliseconds between interrupt checks
-KEEPALIVE_TIMER = 500
-
# Default locations of rgb.txt or other textual color database
RGB_TXT = [
# Solaris OpenWindows
@@ -63,21 +60,7 @@ def usage(status, msg=''):
-app = None
-
-def keepalive():
- # Exercise the Python interpreter regularly so keyboard interrupts get
- # through.
- app.tk.createtimerhandler(KEEPALIVE_TIMER, keepalive)
-
-
-def finished(event=None):
- sys.exit(0)
-
-
def main():
- global app
-
try:
opts, args = getopt.getopt(
sys.argv[1:],
@@ -109,11 +92,9 @@ def main():
else:
raise IOError('No color database file found')
- app = Tk(className='Pynche')
- app.protocol('WM_DELETE_WINDOW', finished)
- app.title('Pynche %s' % __version__)
- app.iconname('Pynche')
- app.tk.createtimerhandler(KEEPALIVE_TIMER, keepalive)
+ # create the application window decorations
+ app = PyncheWidget(__version__)
+ parent = app.parent()
# get triplet for initial color
try:
@@ -130,10 +111,13 @@ def main():
except ColorDB.BadColor:
usage(1, 'Cannot find an initial color to use')
- s = Switchboard(app, colordb, red, green, blue)
+ # create all output widgets
+ s = Switchboard()
+ s.add_view(StripViewer(s, parent))
+ s.update_views(red, green, blue)
+
try:
- keepalive()
- app.mainloop()
+ app.start()
except KeyboardInterrupt:
pass