summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-06-22 02:32:26 -0400
committerTerry Jan Reedy <tjreedy@udel.edu>2014-06-22 02:32:26 -0400
commit3a28478503c760a3bf9e1a4983ed7197ac4b75c7 (patch)
treea189b6ad8738d0160816bafd84d9b3827fbaa761
parente353ce3f942d9526aebc27d6df2189b2282c5931 (diff)
downloadcpython-3a28478503c760a3bf9e1a4983ed7197ac4b75c7.tar.gz
Issue #21824: Turtledemo 2.7 help menu entries now display help text instead
of help file name.
-rwxr-xr-xDemo/turtle/turtleDemo.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/Demo/turtle/turtleDemo.py b/Demo/turtle/turtleDemo.py
index 30b5e5bb34..88b9b201b9 100755
--- a/Demo/turtle/turtleDemo.py
+++ b/Demo/turtle/turtleDemo.py
@@ -5,11 +5,17 @@ import os
from Tkinter import *
from idlelib.Percolator import Percolator
from idlelib.ColorDelegator import ColorDelegator
-from idlelib.textView import TextViewer
+from idlelib.textView import view_file
import turtle
import time
+demo_dir = os.getcwd()
+if "turtleDemo.py" not in os.listdir(demo_dir):
+ print "Directory of turtleDemo must be current working directory!"
+ print "But in your case this is", demo_dir
+ sys.exit()
+
STARTUP = 1
READY = 2
RUNNING = 3
@@ -21,12 +27,7 @@ btnfont = ("Arial", 12, 'bold')
txtfont = ('Lucida Console', 8, 'normal')
def getExampleEntries():
- cwd = os.getcwd()
- if "turtleDemo.py" not in os.listdir(cwd):
- print "Directory of turtleDemo must be current working directory!"
- print "But in your case this is", cwd
- sys.exit()
- entries1 = [entry for entry in os.listdir(cwd) if
+ entries1 = [entry for entry in os.listdir(demo_dir) if
entry.startswith("tdemo_") and
not entry.endswith(".pyc")]
entries2 = []
@@ -34,7 +35,7 @@ def getExampleEntries():
if entry.endswith(".py"):
entries2.append(entry)
else:
- path = os.path.join(cwd,entry)
+ path = os.path.join(demo_dir, entry)
sys.path.append(path)
subdir = [entry]
scripts = [script for script in os.listdir(path) if
@@ -44,13 +45,16 @@ def getExampleEntries():
return entries2
def showDemoHelp():
- TextViewer(demo.root, "Help on turtleDemo", "demohelp.txt")
+ view_file(demo.root, "Help on turtleDemo",
+ os.path.join(demo_dir, "demohelp.txt"))
def showAboutDemo():
- TextViewer(demo.root, "About turtleDemo", "about_turtledemo.txt")
+ view_file(demo.root, "About turtleDemo",
+ os.path.join(demo_dir, "about_turtledemo.txt"))
def showAboutTurtle():
- TextViewer(demo.root, "About the new turtle module", "about_turtle.txt")
+ view_file(demo.root, "About the new turtle module.",
+ os.path.join(demo_dir, "about_turtle.txt"))
class DemoWindow(object):