<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hi Eric and Tom,<br><br>Thanks for the pointers - I figured there was some kind of loop that needed to be kicked off.<br><br>I have modified the script to call `session.update_loop.start_redraw_timer()` before firing up the IPython shell.<br><br>I haven't noticed any unpredictability (yet) but I'm now able to directly evaluate Python code from Emacs and ChimeraX seems to behave like normal with 3D graphics!<br>This should save me a lot of time!<br><br>Thanks again,<br><br>Tom<br><br><br><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>From: </b>"Eric Pettersen" <pett@cgl.ucsf.edu><br><b>To: </b>"Tom Mulvaney" <thomas.mulvaney@cssb-hamburg.de><br><b>Cc: </b>"ChimeraX Users Help" <chimerax-users@cgl.ucsf.edu><br><b>Sent: </b>Thursday, 21 October, 2021 23:54:23<br><b>Subject: </b>Re: [chimerax-users] Running ChimeraX and a REPL<br></div><div><br></div><div data-marker="__QUOTED_TEXT__">Hi Tom,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Your shell runs its own event loop, which prevents ChimeraX's normal event loop from running, which will make using the interface directly unpredictable. For instance, the Model Panel never shows any models open. The redrawing of the 3D graphics depends on a QTimer event, which it never receives, so it never gets drawn. You can force it to draw however. You can either use the "wait" command (I recommend "wait 2", i.e. draw two frames, which might be necessary to get the Rapid Access interface to disappear <i class="">and</i><span style="font-style:normal" class=""> a redraw to happen), or directly in Python with session.</span>update_loop.draw_new_frame().</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Note that you can concatenate commands by separating them with semi-colon (;), so you could open 1gcn and get the redraw with "open 1gcn ; wait 2".</div><div class=""><br class=""></div><div class=""><div class="">--Eric</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Eric Pettersen</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>UCSF Computer Graphics Lab</div><div class=""><br class=""></div><div><br class=""><blockquote class=""><div class="">On Oct 21, 2021, at 4:00 AM, Tom Mulvaney via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" target="_blank" rel="nofollow noopener noreferrer">chimerax-users@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi all,<br class=""><br class="">I'm wondering if anyone has any experience running ChimeraX with either a standard REPL or IPython REPL?<br class=""><br class="">ChimeraX already has a 'shell' tool that allows interacting with ChimeraX through a Python REPL which I've found invaluable for testing out ideas and poking around in ChimeraX in general.<br class=""><br class="">It would be really nice though if I could send Python code directly from my IDE to be evaluated. In order to make this work, it would be great if ChimeraX could be run from a terminal and provide a Python (or preferably IPython) REPL. As it stands, I've managed to nearly make this work with the following script:<br class=""><br class=""> import IPython.terminal.embed<br class=""> IPython.terminal.embed.embed()<br class=""><br class="">I then run:<br class=""><br class=""> ChimeraX --script repl.py<br class=""><br class="">After typing, `%gui qt5`, the ChimeraX GUI appears. <br class=""><br class="">I can then interact with the REPL directly from the comfort of Emacs and evaluate things - but! - the main 3D view does not end up being displayed.<br class=""><br class="">Does anyone know how to get the REPL and 3D stuff to work side-by-side?<br class=""><br class=""><br class="">Kind regards,<br class=""><br class="">Tom<br class=""><br class="">_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" target="_blank" rel="nofollow noopener noreferrer">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users<br class=""></div></div></blockquote></div><br class=""></div><br></div></div></body></html>