diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 11:51:27 (GMT) |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 11:51:27 (GMT) |
commit | fc170b1fd5db978f4e8d4c23c138a7b59df681ec (patch) | |
tree | 3c73ffcba8f5ece8c64a086a362b7fbe65368048 /Lib/lib-tk | |
parent | d8c628bd59f70b5389c39fd9e6a15cb3e2d46f27 (diff) | |
download | cpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.zip cpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.tar.gz cpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.tar.bz2 |
String method conversion.
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 12 | ||||
-rw-r--r-- | Lib/lib-tk/tkFont.py | 7 | ||||
-rw-r--r-- | Lib/lib-tk/tkSimpleDialog.py | 6 |
3 files changed, 10 insertions, 15 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index c4e78a2..da436c1 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -37,14 +37,13 @@ tkinter = _tkinter # b/w compat for export TclError = _tkinter.TclError from types import * from Tkconstants import * -import string; _string = string; del string try: import MacOS; _MacOS = MacOS; del MacOS except ImportError: _MacOS = None -TkVersion = _string.atof(_tkinter.TK_VERSION) -TclVersion = _string.atof(_tkinter.TCL_VERSION) +TkVersion = float(_tkinter.TK_VERSION) +TclVersion = float(_tkinter.TCL_VERSION) READABLE = _tkinter.READABLE WRITABLE = _tkinter.WRITABLE @@ -782,7 +781,7 @@ class Misc: return t[:1] + tuple(map(self.__winfo_getint, t[1:])) def __winfo_getint(self, x): """Internal function.""" - return _string.atoi(x, 0) + return int(x, 0) def winfo_vrootheight(self): """Return the height of the virtual root window associated with this widget in pixels. If there is no virtual root window return the @@ -850,7 +849,7 @@ class Misc: % (add and '+' or '', funcid, - _string.join(self._subst_format))) + " ".join(self._subst_format))) self.tk.call(what + (sequence, cmd)) return funcid elif sequence: @@ -972,9 +971,8 @@ class Misc: if name[0] == '.': w = w._root() name = name[1:] - find = _string.find while name: - i = find(name, '.') + i = name.find('.') if i >= 0: name, tail = name[:i], name[i+1:] else: diff --git a/Lib/lib-tk/tkFont.py b/Lib/lib-tk/tkFont.py index a41e368..169c529 100644 --- a/Lib/lib-tk/tkFont.py +++ b/Lib/lib-tk/tkFont.py @@ -18,7 +18,6 @@ __version__ = "0.9" import Tkinter -import string # weight/slant NORMAL = "normal" @@ -120,7 +119,7 @@ class Font: def measure(self, text): "Return text width" - return string.atoi(self._call("font", "measure", self.name, text)) + return int(self._call("font", "measure", self.name, text)) def metrics(self, *options): """Return font metrics. @@ -129,14 +128,14 @@ class Font: using this font before calling this method.""" if options: - return string.atoi( + return int( self._call("font", "metrics", self.name, self._get(options)) ) else: res = self._split(self._call("font", "metrics", self.name)) options = {} for i in range(0, len(res), 2): - options[res[i][1:]] = string.atoi(res[i+1]) + options[res[i][1:]] = int(res[i+1]) return options def families(root=None): diff --git a/Lib/lib-tk/tkSimpleDialog.py b/Lib/lib-tk/tkSimpleDialog.py index 0dc5c84..15ff544 100644 --- a/Lib/lib-tk/tkSimpleDialog.py +++ b/Lib/lib-tk/tkSimpleDialog.py @@ -157,8 +157,6 @@ class Dialog(Toplevel): # -------------------------------------------------------------------- # convenience dialogues -import string - class _QueryDialog(Dialog): def __init__(self, title, prompt, @@ -236,7 +234,7 @@ class _QueryDialog(Dialog): class _QueryInteger(_QueryDialog): errormessage = "Not an integer." def getresult(self): - return string.atoi(self.entry.get()) + return int(self.entry.get()) def askinteger(title, prompt, **kw): '''get an integer from the user @@ -255,7 +253,7 @@ def askinteger(title, prompt, **kw): class _QueryFloat(_QueryDialog): errormessage = "Not a floating point value." def getresult(self): - return string.atof(self.entry.get()) + return float(self.entry.get()) def askfloat(title, prompt, **kw): '''get a float from the user |