printing from custom loop
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 38/100
Piste de recherche
Commencez par lire ipykernel/eventloops.py avec l’appel à cb() de la boucle personnalisée et la gestion de kernel.shell_stream.flush(limit=1). Reproduisez le flux %gui imgui dans la Jupyter web UI ou dans IntelliJ IDEA, puis vérifiez que print('123') de imgui_app() s’affiche avant la fermeture de l’application.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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 🙏
- Langage dominant
- Python
- Étoiles
- 734
- Forks
- 411
- Merge moyen
- 1 j 6 h
- PR mergées (30 j)
- 10
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de ipython/ipykernel
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 68/100
-
ipython/ipykernel#1550 · 1 commentaire · 1 réaction · 1 personne assignée ·
Toutes les issues de ipython/ipykernel
Issues similaires
-
agent-ready documentation needs-triage
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
-
documentation
Difficulté 1/5 Moins d'une heure Accessibilité débutants 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
-
Add https://search.jeremyh.xyz/ Ouverteinstance instance add
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
searxng/searx-instances#939 · 1 commentaire ·
-
area-deployment area-integrations triage:bot-seen
Difficulté 2/5 Une demi-journée Accessibilité débutants 86/100