[chimerax-users] Running ChimeraX and a REPL
Eric Pettersen
pett at cgl.ucsf.edu
Thu Oct 21 14:54:23 PDT 2021
Hi Tom,
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 and a redraw to happen), or directly in Python with session.update_loop.draw_new_frame().
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".
--Eric
Eric Pettersen
UCSF Computer Graphics Lab
> On Oct 21, 2021, at 4:00 AM, Tom Mulvaney via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>
> Hi all,
>
> I'm wondering if anyone has any experience running ChimeraX with either a standard REPL or IPython REPL?
>
> 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.
>
> 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:
>
> import IPython.terminal.embed
> IPython.terminal.embed.embed()
>
> I then run:
>
> ChimeraX --script repl.py
>
> After typing, `%gui qt5`, the ChimeraX GUI appears.
>
> 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.
>
> Does anyone know how to get the REPL and 3D stuff to work side-by-side?
>
>
> Kind regards,
>
> Tom
>
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20211021/f62ec389/attachment.html>
More information about the ChimeraX-users
mailing list