From 456b2b8777533ce0edf1690203ee50e6e59d9fab Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 4 Oct 2012 22:10:09 +0300 Subject: Issue #14446: Remove deprecated tkinter functions Thanks to Michael Driscoll --- Doc/library/tkinter.rst | 26 --------------- Lib/tkinter/__init__.py | 39 ---------------------- Modules/_tkinter.c | 88 ------------------------------------------------- 3 files changed, 153 deletions(-) diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index 83a5375..377694f 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -750,32 +750,6 @@ Entry widget indexes (index, view index, etc.) displayed. You can use these :mod:`tkinter` functions to access these special points in text widgets: -.. function:: AtEnd() - refers to the last position in the text - - .. deprecated:: 3.3 - -.. function:: AtInsert() - refers to the point where the text cursor is - - .. deprecated:: 3.3 - -.. function:: AtSelFirst() - indicates the beginning point of the selected text - - .. deprecated:: 3.3 - -.. function:: AtSelLast() - denotes the last point of the selected text and finally - - .. deprecated:: 3.3 - -.. function:: At(x[, y]) - refers to the character at pixel location *x*, *y* (with *y* not used in the - case of a text entry widget, which contains a single line of text). - - .. deprecated:: 3.3 - Text widget indexes The index notation for Text widgets is very rich and is best described in the Tk man pages. diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 8063dd6..917eba4 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -2146,45 +2146,6 @@ class Button(Widget): """ return self.tk.call(self._w, 'invoke') - -# Indices: -# XXX I don't like these -- take them away -def AtEnd(): - warnings.warn("tkinter.AtEnd will be removed in 3.4", - DeprecationWarning, stacklevel=2) - return 'end' - - -def AtInsert(*args): - warnings.warn("tkinter.AtInsert will be removed in 3.4", - DeprecationWarning, stacklevel=2) - s = 'insert' - for a in args: - if a: s = s + (' ' + a) - return s - - -def AtSelFirst(): - warnings.warn("tkinter.AtSelFirst will be removed in 3.4", - DeprecationWarning, stacklevel=2) - return 'sel.first' - - -def AtSelLast(): - warnings.warn("tkinter.AtSelLast will be removed in 3.4", - DeprecationWarning, stacklevel=2) - return 'sel.last' - - -def At(x, y=None): - warnings.warn("tkinter.At will be removed in 3.4", - DeprecationWarning, stacklevel=2) - if y is None: - return '@%r' % (x,) - else: - return '@%r,%r' % (x, y) - - class Canvas(Widget, XView, YView): """Canvas widget to display graphical elements like lines or text.""" def __init__(self, master=None, cnf={}, **kw): diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 70f4703..c39d73f 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1332,42 +1332,6 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) static PyObject * -Tkapp_GlobalCall(PyObject *self, PyObject *args) -{ - /* Could do the same here as for Tkapp_Call(), but this is not used - much, so I can't be bothered. Unfortunately Tcl doesn't export a - way for the user to do what all its Global* variants do (save and - reset the scope pointer, call the local version, restore the saved - scope pointer). */ - - char *cmd; - PyObject *res = NULL; - - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "globalcall is deprecated and will be removed in 3.4", - 1) < 0) - return 0; - - CHECK_TCL_APPARTMENT; - - cmd = Merge(args); - if (cmd) { - int err; - ENTER_TCL - err = Tcl_GlobalEval(Tkapp_Interp(self), cmd); - ENTER_OVERLAP - if (err == TCL_ERROR) - res = Tkinter_Error(self); - else - res = PyUnicode_FromString(Tkapp_Result(self)); - LEAVE_OVERLAP_TCL - ckfree(cmd); - } - - return res; -} - -static PyObject * Tkapp_Eval(PyObject *self, PyObject *args) { char *script; @@ -1391,34 +1355,6 @@ Tkapp_Eval(PyObject *self, PyObject *args) } static PyObject * -Tkapp_GlobalEval(PyObject *self, PyObject *args) -{ - char *script; - PyObject *res = NULL; - int err; - - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "globaleval is deprecated and will be removed in 3.4", - 1) < 0) - return 0; - - if (!PyArg_ParseTuple(args, "s:globaleval", &script)) - return NULL; - - CHECK_TCL_APPARTMENT; - - ENTER_TCL - err = Tcl_GlobalEval(Tkapp_Interp(self), script); - ENTER_OVERLAP - if (err == TCL_ERROR) - res = Tkinter_Error(self); - else - res = PyUnicode_FromString(Tkapp_Result(self)); - LEAVE_OVERLAP_TCL - return res; -} - -static PyObject * Tkapp_EvalFile(PyObject *self, PyObject *args) { char *fileName; @@ -1961,27 +1897,6 @@ Tkapp_Split(PyObject *self, PyObject *args) return v; } -static PyObject * -Tkapp_Merge(PyObject *self, PyObject *args) -{ - char *s; - PyObject *res = NULL; - - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "merge is deprecated and will be removed in 3.4", - 1) < 0) - return 0; - - s = Merge(args); - - if (s) { - res = PyUnicode_FromString(s); - ckfree(s); - } - - return res; -} - /** Tcl Command **/ @@ -2695,9 +2610,7 @@ static PyMethodDef Tkapp_methods[] = {"willdispatch", Tkapp_WillDispatch, METH_NOARGS}, {"wantobjects", Tkapp_WantObjects, METH_VARARGS}, {"call", Tkapp_Call, METH_VARARGS}, - {"globalcall", Tkapp_GlobalCall, METH_VARARGS}, {"eval", Tkapp_Eval, METH_VARARGS}, - {"globaleval", Tkapp_GlobalEval, METH_VARARGS}, {"evalfile", Tkapp_EvalFile, METH_VARARGS}, {"record", Tkapp_Record, METH_VARARGS}, {"adderrorinfo", Tkapp_AddErrorInfo, METH_VARARGS}, @@ -2716,7 +2629,6 @@ static PyMethodDef Tkapp_methods[] = {"exprboolean", Tkapp_ExprBoolean, METH_VARARGS}, {"splitlist", Tkapp_SplitList, METH_VARARGS}, {"split", Tkapp_Split, METH_VARARGS}, - {"merge", Tkapp_Merge, METH_VARARGS}, {"createcommand", Tkapp_CreateCommand, METH_VARARGS}, {"deletecommand", Tkapp_DeleteCommand, METH_VARARGS}, #ifdef HAVE_CREATEFILEHANDLER -- cgit v0.12