Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5af3e1a

Browse files
committed
reformat code to follow PEP8
1 parent e50d6ab commit 5af3e1a

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

Lib/tkinter/font.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@
1010

1111
import tkinter
1212

13+
1314
# weight/slant
1415
NORMAL = "normal"
1516
ROMAN = "roman"
1617
BOLD = "bold"
1718
ITALIC = "italic"
1819

20+
1921
def nametofont(name):
2022
"""Given the name of a tk named font, returns a Font representation.
2123
"""
2224
return Font(name=name, exists=True)
2325

24-
class Font:
2526

27+
class Font:
2628
"""Represents a named font.
2729
2830
Constructor options are:
@@ -63,7 +65,8 @@ def _mkdict(self, args):
6365
options[args[i][1:]] = args[i+1]
6466
return options
6567

66-
def __init__(self, root=None, font=None, name=None, exists=False, **options):
68+
def __init__(self, root=None, font=None, name=None, exists=False,
69+
**options):
6770
if not root:
6871
root = tkinter._default_root
6972
if font:
@@ -138,8 +141,7 @@ def config(self, **options):
138141
*self._set(options))
139142
else:
140143
return self._mkdict(
141-
self._split(self._call("font", "config", self.name))
142-
)
144+
self._split(self._call("font", "config", self.name)))
143145

144146
configure = config
145147

@@ -155,27 +157,29 @@ def metrics(self, *options):
155157

156158
if options:
157159
return int(
158-
self._call("font", "metrics", self.name, self._get(options))
159-
)
160+
self._call("font", "metrics", self.name, self._get(options)))
160161
else:
161162
res = self._split(self._call("font", "metrics", self.name))
162163
options = {}
163164
for i in range(0, len(res), 2):
164165
options[res[i][1:]] = int(res[i+1])
165166
return options
166167

168+
167169
def families(root=None):
168170
"Get font families (as a tuple)"
169171
if not root:
170172
root = tkinter._default_root
171173
return root.tk.splitlist(root.tk.call("font", "families"))
172174

175+
173176
def names(root=None):
174177
"Get names of defined fonts (as a tuple)"
175178
if not root:
176179
root = tkinter._default_root
177180
return root.tk.splitlist(root.tk.call("font", "names"))
178181

182+
179183
# --------------------------------------------------------------------
180184
# test stuff
181185

0 commit comments

Comments
 (0)