summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1996-07-23 17:47:21 (GMT)
committerFred Drake <fdrake@acm.org>1996-07-23 17:47:21 (GMT)
commit4dd0bf92e613433cdd7806d46002a9bfe5e53fda (patch)
treec27686aed683dbf7d27d09d32a2f82b484880c4c /Demo
parent99aa2a413258895725e0fe96a2ac182a024318f8 (diff)
downloadcpython-4dd0bf92e613433cdd7806d46002a9bfe5e53fda.zip
cpython-4dd0bf92e613433cdd7806d46002a9bfe5e53fda.tar.gz
cpython-4dd0bf92e613433cdd7806d46002a9bfe5e53fda.tar.bz2
(rmt.py): Updated to "modern" python coding conventions, somewhat. Keyword
arguments and explicit calls to .pack() are used; no more dictionaries are being passed to Tkinter constructors. Otherwise, the example is unchanged. (The app isn't implemented as a Python object.)
Diffstat (limited to 'Demo')
-rwxr-xr-xDemo/tkinter/guido/rmt.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/Demo/tkinter/guido/rmt.py b/Demo/tkinter/guido/rmt.py
index 25b84e2..f9f1785 100755
--- a/Demo/tkinter/guido/rmt.py
+++ b/Demo/tkinter/guido/rmt.py
@@ -12,37 +12,38 @@
# XXX This should be written in a more Python-like style!!!
from Tkinter import *
+import sys
# 1. Create basic application structure: menu bar on top of
# text widget, scrollbar on right.
root = Tk()
tk = root.tk
-mBar = Frame(root, {'relief': 'raised', 'bd': 2,
- Pack: {'side': 'top', 'fill': 'x'}})
+mBar = Frame(root, relief=RAISED, borderwidth=2)
+mBar.pack(fill=X)
+
f = Frame(root)
-f.pack({'expand': 1, 'fill': 'both'})
-s = Scrollbar(f, {'relief': 'flat',
- Pack: {'side': 'right', 'fill': 'y'}})
-t = Text(f, {'relief': 'raised', 'bd': 2, 'yscrollcommand': (s, 'set'),
- 'setgrid': 1,
- Pack: {'side': 'left', 'fill': 'both', 'expand': 1}})
-
-t.tag_config('bold', {'font': '-Adobe-Courier-Bold-R-Normal-*-120-*'})
-s['command'] = (t, 'yview')
+f.pack(expand=1, fill=BOTH)
+s = Scrollbar(f, relief=FLAT)
+s.pack(side=RIGHT, fill=Y)
+t = Text(f, relief=RAISED, borderwidth=2, yscrollcommand=s.set, setgrid=1)
+t.pack(side=LEFT, fill=BOTH, expand=1)
+t.tag_config('bold', font='-Adobe-Courier-Bold-R-Normal-*-120-*')
+s['command'] = t.yview
+
root.title('Tk Remote Controller')
root.iconname('Tk Remote')
# 2. Create menu button and menus.
-file = Menubutton(mBar, {'text': 'File', 'underline': 0,
- Pack: {'side': 'left'}})
+file = Menubutton(mBar, text='File', underline=0)
+file.pack(side=LEFT)
file_m = Menu(file)
file['menu'] = file_m
-file_m_apps = Menu(file_m)
-file_m.add('cascade', {'label': 'Select Application', 'underline': 0,
- 'menu': file_m_apps})
-file_m.add('command', {'label': 'Quit', 'underline': 0, 'command': 'exit'})
+file_m_apps = Menu(file_m, tearoff=0)
+file_m.add_cascade(label='Select Application', underline=0,
+ menu=file_m_apps)
+file_m.add_command(label='Quit', underline=0, command=sys.exit)
# 3. Create bindings for text widget to allow commands to be
# entered and information to be selected. New characters
@@ -142,10 +143,9 @@ def fillAppsMenu():
# Inoperative window -- ignore it
pass
else:
- file_m_apps.add('command', {'label': name,
- 'command':
- lambda name=name:
- newApp(name)})
+ file_m_apps.add_command(
+ label=name,
+ command=lambda name=name: newApp(name))
file_m_apps['postcommand'] = fillAppsMenu
mBar.tk_menuBar(file)