printing from custom loop
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 38/100
Rechercherichtung
Lesen Sie zunächst ipykernel/eventloops.py zusammen mit dem cb()-Aufruf der benutzerdefinierten Schleife und der Behandlung von kernel.shell_stream.flush(limit=1). Reproduzieren Sie den %gui imgui-Ablauf entweder in der Jupyter web UI oder in IntelliJ IDEA und überprüfen Sie anschließend, dass print('123') aus imgui_app() erscheint, bevor die App geschlossen wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
I made a custom event loop for Dear ImGui. Everything works fine, except i can not find a way to produce any output from within the loop where UI code runs. This is the loop:
from ipykernel.eventloops import register_integration
@register_integration('imgui')
def loop_imgui(kernel):
import imgui
app = None
try:
while not kernel.shell.exit_now:
if len(imgui._ipython_callbacks) > 0:
title, cb = imgui._ipython_callbacks[0]
if app is None:
app = imgui.DearImGuiApp(title)
do_continue = False
if app.begin_frame():
try:
do_continue = cb()
finally:
app.end_frame()
if not do_continue:
app.close()
app = None
del imgui._ipython_callbacks[0]
if kernel.shell_stream.flush(limit=1):
break
except Exception as e:
kernel.log.exception(e)
finally:
imgui._ipython_callbacks = []
if app is not None:
app.close()
app = None
@loop_imgui.exit
def loop_imgui_exit(kernel):
pass
def load_ipython_extension(ipython):
pass
def unload_ipython_extension(ipython):
pass
I use it as follows:
%load_ext imgui_loop
%gui imgui
import imgui
@imgui.ipython_window('Charts')
def imgui_app():
print('123')
return False
Im sorry about this code not being testable as i do not have all parts available on github.. But basically imgui_app() gets called on the line do_continue = cb() in the loop code. It should print '123' and then imgui app gets closed. I do not see any text printed though, documentation mentions nothing about it either and ipykernel/eventloops.py does imply printing should just work..? But somehow it does not. I tested it from IntelliJ IDEA as well as from Jupyter web UI - result is same. Other than this, imgui UI works just fine. Any ideas what i could be missing?
Thanks 🙏
- Vorherrschende Sprache
- Python
- Sterne
- 734
- Forks
- 411
- Ø Merge
- 1 T. 11 Std.
- Gemergte PRs (30 T.)
- 12
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus ipython/ipykernel
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 68/100
-
ipython/ipykernel#1550 · 1 Kommentar · 1 Reaktion · 1 zugewiesene Person ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 66/100
Alle Issues in ipython/ipykernel
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 75/100
-
hcocena Offenpolicies-accepted pre-review precheck-passed
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
Bioconductor/BiocContributions#214 · 5 Kommentare ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
TencentCloud/Octop#1169 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
521xueweihan/HelloGitHub#3778 ·
-
The version checker's trailing attribute region has no control for a less-than inside a quoted value Offenarea: dashboard area: tests bug perceived difficulty: 2 python
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Nitjsefnie-Harness-Commons/daedalus#1105 · 1 Kommentar ·