[pypy-issue] Issue #1834: Some _tkinter functions that are available on CPython aren't exported (pypy/pypy)

eli.boyarski issues-reply at bitbucket.org
Sat Aug 2 17:38:31 CEST 2014


New issue 1834: Some _tkinter functions that are available on CPython aren't exported
https://bitbucket.org/pypy/pypy/issue/1834/some-_tkinter-functions-that-are-available

eli.boyarski:

On CPython 2.7.5, the exported names from Tkinter._tkinter are:

```
#!python

>>> dir(Tkinter._tkinter)
['ALL_EVENTS', 'DONT_WAIT', 'EXCEPTION', 'FILE_EVENTS', 'IDLE_EVENTS',
'READABLE', 'TCL_VERSION', 'TIMER_EVENTS', 'TK_VERSION', 'TclError', 'Tcl_Obj',
'TkappType', 'TkttType', 'WINDOW_EVENTS', 'WRITABLE', '__doc__', '__file__',
'__name__', '__package__', '_flatten', 'create', 'createfilehandler', 'createtimerhandler',
'deletefilehandler', 'dooneevent', 'getbusywaitinterval', 'mainloop', 'quit',
'setbusywaitinterval']
```
Whlie on Pypy 2.2.1 we get:

```
#!python

>>>> dir(Tkinter._tkinter)
['DONT_WAIT', 'EXCEPTION', 'READABLE', 'TCL_VERSION', 'TK_VERSION', 'TclError',
'TkApp', 'WRITABLE', '__builtins__', '__doc__', '__file__', '__name__', '__package__',
'__path__', '_flatten', 'app', 'cffi', 'create', 'createfilehandler', 'deletefilehandler', 'tclobj', 'tkffi', 'tklib']

```
Notice dooneevent is missing, for example.

There's a Python 2.X pattern of using dooneevent directly, as can be seen [here](https://s3-us-west-2.amazonaws.com/cs188websitecontent/projects/reinforcement/docs/graphicsUtils.html), which is part of [this project](http://inst.eecs.berkeley.edu/~cs188/pacman/html/navigation.html?page=overview).

Adding the line:

```
#!python

dooneevent = tklib.Tcl_DoOneEvent
```
to lib_pypy/\_tkinter/\_\_init\_\_.py enabled running the code, as 

```
#!python

int Tcl_DoOneEvent(int flags);
```
appears in lib_pypy/_tkinter/tklib.py.

It's worth mentioning that dooneevent isn't exported from tkinter._tkinter in CPython 3.3.2, so the fix might not be very long lived.




More information about the pypy-issue mailing list