summaryrefslogtreecommitdiffstats
path: root/Tools/idle
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-10-12 21:01:37 (GMT)
committerGuido van Rossum <guido@python.org>1998-10-12 21:01:37 (GMT)
commit2aeeb55949c725aa2c28f11902afcd4eaefbb34a (patch)
treebf84640f86a09a506679691367dbf89cc4fb6d72 /Tools/idle
parentd8d676c289e76171480765eb2e60d1e981c21af2 (diff)
downloadcpython-2aeeb55949c725aa2c28f11902afcd4eaefbb34a.zip
cpython-2aeeb55949c725aa2c28f11902afcd4eaefbb34a.tar.gz
cpython-2aeeb55949c725aa2c28f11902afcd4eaefbb34a.tar.bz2
Added a menu bar to every window.
Diffstat (limited to 'Tools/idle')
-rw-r--r--Tools/idle/EditorWindow.py46
1 files changed, 45 insertions, 1 deletions
diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py
index 2028ed1..a17354d 100644
--- a/Tools/idle/EditorWindow.py
+++ b/Tools/idle/EditorWindow.py
@@ -2,7 +2,16 @@ import sys
import os
import string
from Tkinter import *
+import tkMessageBox
+about_title = "About IDLE"
+about_text = """\
+IDLE 0.1
+
+A not totally unintegrated development environment for Python
+
+by Guido van Rossum
+"""
class EditorWindow:
@@ -14,12 +23,18 @@ class EditorWindow:
from AutoIndent import AutoIndent
from AutoExpand import AutoExpand
import Bindings
+
+ about_title = about_title
+ about_text = about_text
def __init__(self, root, filename=None):
- self.top = top = Toplevel(root)
+ self.root = root
+ self.menubar = Menu(root)
+ self.top = top = Toplevel(root, menu=self.menubar)
self.vbar = vbar = Scrollbar(top, name='vbar')
self.text = text = Text(top, name='text')
+ self.createmenubar()
self.Bindings.apply_bindings(text)
self.top.protocol("WM_DELETE_WINDOW", self.close)
@@ -60,6 +75,35 @@ class EditorWindow:
self.saved_change_hook()
+ def createmenubar(self):
+ mbar = self.menubar
+
+ self.filemenu = Menu(mbar)
+
+ self.editmenu = Menu(mbar)
+
+ self.helpmenu = Menu(mbar, name="help")
+ self.helpmenu.add_command(label="Help...", command=self.help_dialog)
+ self.helpmenu.add_separator()
+ self.helpmenu.add_command(label="About...", command=self.about_dialog)
+
+ mbar.add_cascade(label="File", menu=self.filemenu)
+ mbar.add_cascade(label="Edit", menu=self.editmenu)
+ mbar.add_cascade(label="Help", menu=self.helpmenu)
+
+ dict = {"file": self.filemenu,
+ "edit": self.editmenu,
+ "help": self.helpmenu}
+ self.Bindings.fill_menus(self.text, dict)
+
+ def about_dialog(self):
+ tkMessageBox.showinfo(self.about_title, self.about_text,
+ master=self.text)
+
+ def help_dialog(self):
+ from HelpWindow import HelpWindow
+ HelpWindow(root=self.root)
+
def gotoline(self, lineno):
if lineno is not None and lineno > 0:
self.text.mark_set("insert", "%d.0" % lineno)