diff options
-rw-r--r-- | Demo/tkinter/README | 2 | ||||
-rwxr-xr-x | Demo/tkinter/guido/ManPage.py | 3 | ||||
-rwxr-xr-x | Demo/tkinter/guido/wish.py | 6 | ||||
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 18 | ||||
-rwxr-xr-x | Lib/tkinter/Tkinter.py | 18 | ||||
-rw-r--r-- | Misc/FAQ | 12 | ||||
-rw-r--r-- | README | 14 |
7 files changed, 37 insertions, 36 deletions
diff --git a/Demo/tkinter/README b/Demo/tkinter/README index 257c95a..9fa7cb4 100644 --- a/Demo/tkinter/README +++ b/Demo/tkinter/README @@ -1,7 +1,7 @@ Several collections of example code for Tkinter. See the toplevel README for an explanation of the difference between -Tkinter and tkinter, how to enable the Python Tk interface, and where +Tkinter and _tkinter, how to enable the Python Tk interface, and where to get Matt Conway's lifesaver document. Subdirectories: diff --git a/Demo/tkinter/guido/ManPage.py b/Demo/tkinter/guido/ManPage.py index b8b6682..4f0af8c 100755 --- a/Demo/tkinter/guido/ManPage.py +++ b/Demo/tkinter/guido/ManPage.py @@ -2,6 +2,7 @@ import regex from Tkinter import * +from Tkinter import _tkinter from ScrolledText import ScrolledText # XXX These fonts may have to be changed to match your system @@ -44,7 +45,7 @@ class EditableManPage(ScrolledText): # Parse a file, in the background def asyncparsefile(self, fp): self._startparser(fp) - self.tk.createfilehandler(fp, tkinter.READABLE, + self.tk.createfilehandler(fp, _tkinter.READABLE, self._filehandler) parsefile = asyncparsefile # Alias diff --git a/Demo/tkinter/guido/wish.py b/Demo/tkinter/guido/wish.py index eec4b69..4f6fdee 100755 --- a/Demo/tkinter/guido/wish.py +++ b/Demo/tkinter/guido/wish.py @@ -1,9 +1,9 @@ # This is about all it requires to write a wish shell in Python! -import tkinter +import _tkinter import os -tk = tkinter.create(os.environ['DISPLAY'], 'wish', 'Tk', 1) +tk = _tkinter.create(os.environ['DISPLAY'], 'wish', 'Tk', 1) tk.call('update') cmd = '' @@ -20,7 +20,7 @@ while 1: tk.record(line) try: result = tk.call('eval', cmd) - except tkinter.TclError, msg: + except _tkinter.TclError, msg: print 'TclError:', msg else: if result: print result diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index aace39a..3c2b0ab 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -1,15 +1,15 @@ # Tkinter.py -- Tk/Tcl widget wrappers -import tkinter -from tkinter import TclError +import _tkinter +from _tkinter import TclError from types import * from Tkconstants import * CallableTypes = (FunctionType, MethodType, BuiltinFunctionType, BuiltinMethodType) -TkVersion = eval(tkinter.TK_VERSION) -TclVersion = eval(tkinter.TCL_VERSION) +TkVersion = eval(_tkinter.TK_VERSION) +TclVersion = eval(_tkinter.TCL_VERSION) def _flatten(tuple): @@ -575,18 +575,18 @@ class Tk(Misc, Wm): import sys, os baseName = os.path.basename(sys.argv[0]) if baseName[-3:] == '.py': baseName = baseName[:-3] - self.tk = tkinter.create(screenName, baseName, className) + self.tk = _tkinter.create(screenName, baseName, className) # Version sanity checks tk_version = self.tk.getvar('tk_version') - if tk_version != tkinter.TK_VERSION: + if tk_version != _tkinter.TK_VERSION: raise RuntimeError, \ "tk.h version (%s) doesn't match libtk.a version (%s)" \ - % (tkinter.TK_VERSION, tk_version) + % (_tkinter.TK_VERSION, tk_version) tcl_version = self.tk.getvar('tcl_version') - if tcl_version != tkinter.TCL_VERSION: + if tcl_version != _tkinter.TCL_VERSION: raise RuntimeError, \ "tcl.h version (%s) doesn't match libtcl.a version (%s)" \ - % (tkinter.TCL_VERSION, tcl_version) + % (_tkinter.TCL_VERSION, tcl_version) if TkVersion < 4.0: raise RuntimeError, \ "Tk 4.0 or higher is required; found Tk %s" \ diff --git a/Lib/tkinter/Tkinter.py b/Lib/tkinter/Tkinter.py index aace39a..3c2b0ab 100755 --- a/Lib/tkinter/Tkinter.py +++ b/Lib/tkinter/Tkinter.py @@ -1,15 +1,15 @@ # Tkinter.py -- Tk/Tcl widget wrappers -import tkinter -from tkinter import TclError +import _tkinter +from _tkinter import TclError from types import * from Tkconstants import * CallableTypes = (FunctionType, MethodType, BuiltinFunctionType, BuiltinMethodType) -TkVersion = eval(tkinter.TK_VERSION) -TclVersion = eval(tkinter.TCL_VERSION) +TkVersion = eval(_tkinter.TK_VERSION) +TclVersion = eval(_tkinter.TCL_VERSION) def _flatten(tuple): @@ -575,18 +575,18 @@ class Tk(Misc, Wm): import sys, os baseName = os.path.basename(sys.argv[0]) if baseName[-3:] == '.py': baseName = baseName[:-3] - self.tk = tkinter.create(screenName, baseName, className) + self.tk = _tkinter.create(screenName, baseName, className) # Version sanity checks tk_version = self.tk.getvar('tk_version') - if tk_version != tkinter.TK_VERSION: + if tk_version != _tkinter.TK_VERSION: raise RuntimeError, \ "tk.h version (%s) doesn't match libtk.a version (%s)" \ - % (tkinter.TK_VERSION, tk_version) + % (_tkinter.TK_VERSION, tk_version) tcl_version = self.tk.getvar('tcl_version') - if tcl_version != tkinter.TCL_VERSION: + if tcl_version != _tkinter.TCL_VERSION: raise RuntimeError, \ "tcl.h version (%s) doesn't match libtcl.a version (%s)" \ - % (tkinter.TCL_VERSION, tcl_version) + % (_tkinter.TCL_VERSION, tcl_version) if TkVersion < 4.0: raise RuntimeError, \ "Tk 4.0 or higher is required; found Tk %s" \ @@ -113,7 +113,7 @@ Here's an overview of the questions per chapter: 3.14. Q. Under Solaris 2.x, using GCC, how do I use shared libraries? 3.15. Q. Errors when linking with a shared library containing C++ code. 3.16. Q. Tk menus or radiobuttons don't work properly in Python 1.2. - 3.17. Q. I built with tkintermodule.c enabled but get "Tkinter not found". + 3.17. Q. I built with _tkintermodule.c enabled but get "Tkinter not found". 3.18. Q. I built with Tk 4.0 but Tkinter complains about the Tk version. 3.19. Q. Tk doesn't work right on DEC Alpha. @@ -876,7 +876,7 @@ edit config.c slightly to make it compilable with C++. A. There's a bug in Tkinter.py; remove ClassType and InstanceType from the definition of CallableTypes near the top of Lib/tkinter/Tkinter.py. -3.17. Q. I built with tkintermodule.c enabled but get "Tkinter not found". +3.17. Q. I built with _tkintermodule.c enabled but get "Tkinter not found". A. Tkinter.py (note: upper case T) lives in a subdirectory of Lib, Lib/tkinter. If you are using the default module search path, you @@ -1111,10 +1111,10 @@ the module only works on specific platforms (e.g. gl only works on SGI machines). NOTE: if the complaint is about "Tkinter" (upper case T) and you have -already configured module "tkinter" (lower case t), the solution is -*not* to rename tkinter to Tkinter or vice versa. There is probably -something wrong with your module search path. Check out the value of -sys.path. +already configured module "_tkinter" (lower case t and underscore), +the solution is *not* to rename tkinter to Tkinter or vice versa. +There is probably something wrong with your module search path. Check +out the value of sys.path. For X-related modules (Xt and Xm) you will have to do more work: they are currently not part of the standard Python distribution. You will @@ -450,8 +450,8 @@ found in Lib/tk3inter/.) To enable the Python/Tk interface, once you've built and installed Tcl/Tk, all you need to do is edit two lines in Modules/Setup; search -for the string "tkinter". Un-comment one (normally the first) of the -lines beginning with "#tkinter" and un-comment the line beginning with +for the string "_tkinter". Un-comment one (normally the first) of the +lines beginning with "#_tkinter" and un-comment the line beginning with "#TKPATH". (If you have installed Tcl/Tk in unusual places you will have to edit the first line as well to fix the -I and -L options.) See the Build Instructions above for more details. @@ -463,15 +463,15 @@ the Demo/tkinter directory, in the subdirectories guido, matt and www. Note that there's a Python module called "Tkinter" (capital T) which lives in Lib/tkinter/Tkinter.py, and a C module called "tkinter" -(lower case t) which lives in Modules/tkintermodule.c. Demos and +(lower case t) which lives in Modules/_tkinter.c. Demos and normal Tk applications only import the Python Tkinter module -- only -the latter uses the C tkinter module directly. In order to find the C -tkinter module, it must be compiled and linked into the Python -interpreter -- the tkinter line in the Setup file does this. In order +the latter uses the C _tkinter module directly. In order to find the C +_tkinter module, it must be compiled and linked into the Python +interpreter -- the _tkinter line in the Setup file does this. In order to find the Python Tkinter module, sys.path must be set correctly -- the TKPATH assignment in the Setup file takes care of this, but only if you install Python properly ("make install libinstall"). (You can -also use dynamic loading for the C tkinter module, in which case you +also use dynamic loading for the C _tkinter module, in which case you must manually fix up sys.path or set $PYTHONPATH for the Python Tkinter module.) |