diff options
Diffstat (limited to 'Lib/lib-tk')
-rwxr-xr-x | Lib/lib-tk/Tix.py | 10 | ||||
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 23 | ||||
-rw-r--r-- | Lib/lib-tk/tkCommonDialog.py | 2 | ||||
-rw-r--r-- | Lib/lib-tk/tkFont.py | 2 | ||||
-rw-r--r-- | Lib/lib-tk/turtle.py | 20 |
5 files changed, 27 insertions, 30 deletions
diff --git a/Lib/lib-tk/Tix.py b/Lib/lib-tk/Tix.py index a91b003..f523d7a 100755 --- a/Lib/lib-tk/Tix.py +++ b/Lib/lib-tk/Tix.py @@ -31,7 +31,7 @@ from Tkinter import _flatten, _cnfmerge, _default_root # WARNING - TkVersion is a limited precision floating point number if TkVersion < 3.999: - raise ImportError, "This version of Tix.py requires Tk 4.0 or higher" + raise ImportError("This version of Tix.py requires Tk 4.0 or higher") import _tkinter # If this fails your Python may not be configured for Tk @@ -323,7 +323,7 @@ class TixWidget(Tkinter.Widget): def __getattr__(self, name): if name in self.subwidget_list: return self.subwidget_list[name] - raise AttributeError, name + raise AttributeError(name) def set_silent(self, value): """Set a variable without calling its action routine""" @@ -334,7 +334,7 @@ class TixWidget(Tkinter.Widget): the sub-class).""" n = self._subwidget_name(name) if not n: - raise TclError, "Subwidget " + name + " not child of " + self._name + raise TclError("Subwidget " + name + " not child of " + self._name) # Remove header of name and leading dot n = n[len(self._w)+1:] return self._nametowidget(n) @@ -385,7 +385,7 @@ class TixWidget(Tkinter.Widget): if not master: master = Tkinter._default_root if not master: - raise RuntimeError, 'Too early to create image' + raise RuntimeError('Too early to create image') if kw and cnf: cnf = _cnfmerge((cnf, kw)) elif kw: cnf = kw options = () @@ -475,7 +475,7 @@ class DisplayStyle: master = _default_root # global from Tkinter if not master and 'refwindow' in cnf: master=cnf['refwindow'] elif not master and 'refwindow' in kw: master= kw['refwindow'] - elif not master: raise RuntimeError, "Too early to create display style: no root window" + elif not master: raise RuntimeError("Too early to create display style: no root window") self.tk = master.tk self.stylename = self.tk.call('tixDisplayStyle', itemtype, *self._options(cnf,kw) ) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 144be0a..f6c1ab4 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -158,7 +158,7 @@ def _tkerror(err): def _exit(code='0'): """Internal function. Calling it will throw the exception SystemExit.""" - raise SystemExit, code + raise SystemExit(code) _varnum = 0 class Variable: @@ -1401,7 +1401,7 @@ class CallWrapper: args = self.subst(*args) return self.func(*args) except SystemExit as msg: - raise SystemExit, msg + raise SystemExit(msg) except: self.widget._report_exception() @@ -1652,19 +1652,16 @@ class Tk(Misc, Wm): # Version sanity checks tk_version = self.tk.getvar('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) + raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)" + % (_tkinter.TK_VERSION, tk_version)) # Under unknown circumstances, tcl_version gets coerced to float tcl_version = str(self.tk.getvar('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) + raise RuntimeError("tcl.h version (%s) doesn't match libtcl.a version (%s)" \ + % (_tkinter.TCL_VERSION, tcl_version)) if TkVersion < 4.0: - raise RuntimeError, \ - "Tk 4.0 or higher is required; found Tk %s" \ - % str(TkVersion) + raise RuntimeError("Tk 4.0 or higher is required; found Tk %s" + % str(TkVersion)) # Create and register the tkerror and exit commands # We need to inline parts of _register here, _ register # would register differently-named commands. @@ -3182,7 +3179,7 @@ class OptionMenu(Menubutton): if 'command' in kwargs: del kwargs['command'] if kwargs: - raise TclError, 'unknown option -'+kwargs.keys()[0] + raise TclError('unknown option -'+kwargs.keys()[0]) menu.add_command(label=value, command=_setit(variable, value, callback)) for v in values: @@ -3208,7 +3205,7 @@ class Image: if not master: master = _default_root if not master: - raise RuntimeError, 'Too early to create image' + raise RuntimeError('Too early to create image') self.tk = master.tk if not name: Image._last_id += 1 diff --git a/Lib/lib-tk/tkCommonDialog.py b/Lib/lib-tk/tkCommonDialog.py index 2cd9be4..a5815c6 100644 --- a/Lib/lib-tk/tkCommonDialog.py +++ b/Lib/lib-tk/tkCommonDialog.py @@ -18,7 +18,7 @@ class Dialog: # FIXME: should this be placed on the module level instead? if TkVersion < 4.2: - raise TclError, "this module requires Tk 4.2 or newer" + raise TclError("this module requires Tk 4.2 or newer") self.master = master self.options = options diff --git a/Lib/lib-tk/tkFont.py b/Lib/lib-tk/tkFont.py index ce50397..4b4dc67 100644 --- a/Lib/lib-tk/tkFont.py +++ b/Lib/lib-tk/tkFont.py @@ -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) diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py index fcde9af..434579e 100644 --- a/Lib/lib-tk/turtle.py +++ b/Lib/lib-tk/turtle.py @@ -231,7 +231,7 @@ class RawPen: >>> turtle.color(0, .5, 0) """ if not args: - raise Error, "no color arguments" + raise Error("no color arguments") if len(args) == 1: color = args[0] if type(color) == type(""): @@ -239,18 +239,18 @@ class RawPen: try: id = self._canvas.create_line(0, 0, 0, 0, fill=color) except Tkinter.TclError: - raise Error, "bad color string: %r" % (color,) + raise Error("bad color string: %r" % (color,)) self._set_color(color) return try: r, g, b = color except: - raise Error, "bad color sequence: %r" % (color,) + raise Error("bad color sequence: %r" % (color,)) else: try: r, g, b = args except: - raise Error, "bad color arguments: %r" % (args,) + raise Error("bad color arguments: %r" % (args,)) assert 0 <= r <= 1 assert 0 <= g <= 1 assert 0 <= b <= 1 @@ -520,12 +520,12 @@ class RawPen: try: x, y = args[0] except: - raise Error, "bad point argument: %r" % (args[0],) + raise Error("bad point argument: %r" % (args[0],)) else: try: x, y = args except: - raise Error, "bad coordinates: %r" % (args[0],) + raise Error("bad coordinates: %r" % (args[0],)) x0, y0 = self._origin self._goto(x0+x, y0-y) @@ -752,25 +752,25 @@ def setup(**geometry): if width >= 0 or width == None: _width = width else: - raise ValueError, "width can not be less than 0" + raise ValueError("width can not be less than 0") height = geometry.get('height',_height) if height >= 0 or height == None: _height = height else: - raise ValueError, "height can not be less than 0" + raise ValueError("height can not be less than 0") startx = geometry.get('startx', _startx) if startx >= 0 or startx == None: _startx = _startx else: - raise ValueError, "startx can not be less than 0" + raise ValueError("startx can not be less than 0") starty = geometry.get('starty', _starty) if starty >= 0 or starty == None: _starty = starty else: - raise ValueError, "startx can not be less than 0" + raise ValueError("startx can not be less than 0") if _root and _width and _height: |