[Python-checkins] cpython: reformat code to follow PEP8
andrew.svetlov
python-checkins at python.org
Tue Apr 3 08:48:12 CEST 2012
http://hg.python.org/cpython/rev/db0063ce8a5c
changeset: 76088:db0063ce8a5c
user: Andrew Svetlov <andrew.svetlov at gmail.com>
date: Tue Apr 03 09:39:47 2012 +0300
summary:
reformat code to follow PEP8
files:
Lib/tkinter/font.py | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Lib/tkinter/font.py b/Lib/tkinter/font.py
--- a/Lib/tkinter/font.py
+++ b/Lib/tkinter/font.py
@@ -10,19 +10,21 @@
import tkinter
+
# weight/slant
NORMAL = "normal"
ROMAN = "roman"
BOLD = "bold"
ITALIC = "italic"
+
def nametofont(name):
"""Given the name of a tk named font, returns a Font representation.
"""
return Font(name=name, exists=True)
+
class Font:
-
"""Represents a named font.
Constructor options are:
@@ -63,7 +65,8 @@
options[args[i][1:]] = args[i+1]
return options
- def __init__(self, root=None, font=None, name=None, exists=False, **options):
+ def __init__(self, root=None, font=None, name=None, exists=False,
+ **options):
if not root:
root = tkinter._default_root
if font:
@@ -138,8 +141,7 @@
*self._set(options))
else:
return self._mkdict(
- self._split(self._call("font", "config", self.name))
- )
+ self._split(self._call("font", "config", self.name)))
configure = config
@@ -155,8 +157,7 @@
if options:
return int(
- self._call("font", "metrics", self.name, self._get(options))
- )
+ self._call("font", "metrics", self.name, self._get(options)))
else:
res = self._split(self._call("font", "metrics", self.name))
options = {}
@@ -164,18 +165,21 @@
options[res[i][1:]] = int(res[i+1])
return options
+
def families(root=None):
"Get font families (as a tuple)"
if not 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
return root.tk.splitlist(root.tk.call("font", "names"))
+
# --------------------------------------------------------------------
# test stuff
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list