diff options
author | Georg Brandl <georg@python.org> | 2008-05-20 07:13:37 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-05-20 07:13:37 (GMT) |
commit | 6634bf2919d855ccd821e878b8cc00c7209f1cbe (patch) | |
tree | 77ef2dfaaf00ec144e75ac19708e4dd457604ebc /Lib/lib-tk/tkFont.py | |
parent | 33cece05b918dff706a4298e33f84d8e8a0391d2 (diff) | |
download | cpython-6634bf2919d855ccd821e878b8cc00c7209f1cbe.zip cpython-6634bf2919d855ccd821e878b8cc00c7209f1cbe.tar.gz cpython-6634bf2919d855ccd821e878b8cc00c7209f1cbe.tar.bz2 |
Tkinter rename reversal: remove tkinter package, adapt imports and docs.
Diffstat (limited to 'Lib/lib-tk/tkFont.py')
-rw-r--r-- | Lib/lib-tk/tkFont.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/lib-tk/tkFont.py b/Lib/lib-tk/tkFont.py index c23f047..229f251 100644 --- a/Lib/lib-tk/tkFont.py +++ b/Lib/lib-tk/tkFont.py @@ -8,7 +8,7 @@ __version__ = "0.9" -import tkinter +import Tkinter # weight/slant NORMAL = "normal" @@ -31,7 +31,7 @@ class Font: name -- name to use for this font configuration (defaults to a unique name) exists -- does a named font by this name already exist? Creates a new named font if False, points to the existing font if True. - Raises _tkinter.TclError if the assertion is false. + Raises _Tkinter.TclError if the assertion is false. the following are ignored if font is specified: @@ -65,7 +65,7 @@ class Font: def __init__(self, root=None, font=None, name=None, exists=False, **options): if not root: - root = tkinter._default_root + root = Tkinter._default_root if font: # get actual settings corresponding to the given font font = root.tk.splitlist(root.tk.call("font", "actual", font)) @@ -79,7 +79,7 @@ class Font: self.delete_font = False # confirm font exists if self.name not in root.tk.call("font", "names"): - raise tkinter._tkinter.TclError, "named font %s does not already exist" % (self.name,) + raise Tkinter._tkinter.TclError, "named font %s does not already exist" % (self.name,) # if font config info supplied, apply it if font: root.tk.call("font", "configure", self.name, *font) @@ -166,13 +166,13 @@ class Font: def families(root=None): "Get font families (as a tuple)" if not root: - root = tkinter._default_root + root = Tkinter._default_root return root.tk.splitlist(root.tk.call("font", "families")) def names(root=None): "Get names of defined fonts (as a tuple)" if not root: - root = tkinter._default_root + root = Tkinter._default_root return root.tk.splitlist(root.tk.call("font", "names")) # -------------------------------------------------------------------- @@ -180,7 +180,7 @@ def names(root=None): if __name__ == "__main__": - root = tkinter.Tk() + root = Tkinter.Tk() # create a font f = Font(family="times", size=30, weight=NORMAL) @@ -202,10 +202,10 @@ if __name__ == "__main__": f = Font(font=("Courier", 20, "bold")) print f.measure("hello"), f.metrics("linespace") - w = tkinter.Label(root, text="Hello, world", font=f) + w = Tkinter.Label(root, text="Hello, world", font=f) w.pack() - w = tkinter.Button(root, text="Quit!", command=root.destroy) + w = Tkinter.Button(root, text="Quit!", command=root.destroy) w.pack() fb = Font(font=w["font"]).copy() @@ -213,4 +213,4 @@ if __name__ == "__main__": w.config(font=fb) - tkinter.mainloop() + Tkinter.mainloop() |