ipython / ipython/ipykernel

tkinter gui event loop integration in ipykernel

Offen
#518 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
734
Forks
412
Ø Merge
1 T. 5 Std.
Gemergte PRs (30 T.)
8

Beschreibung

python version: 3.7.7
ipython version: 7.15.0
ipykernel version: 5.3.0

I've been trying to integrate the tkinter event loop in the jupyter notebook following:
[docs](https://ipython.readthedocs.io/en/stable/config/eventloops.html
)
I am running the following commands in order:

```
%gui tk
import example
canvas = example.create_canvas()
```

where the implementation of example.py:

import tkinter as tk

```
def create_canvas():
root = tk.Tk()
root.resizable(False, False)
root.title("Karel")
frame = tk.Frame(root)
frame.pack()
canvas = tk.Canvas(frame, bg="white", width=500,
height=500)
canvas.pack()
return canvas
```

but when I execute `%gui tk` I get an error:

`AttributeError: '_tkinter.tkapp' object has no attribute 'createfilehandler'`

but when I downgrade the ipykernel version to 4.10 (everything works fine).

from what I can assume, it's a bug in the latest version of ipykernel and I was wondering if there was any work around or a fix to this issue.

Similar to: [issue](https://github.com/ipython/ipykernel/issues/358)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.