[chimerax-users] pause/wait read user input in chimerax script

Elaine Meng meng at cgl.ucsf.edu
Fri Mar 12 09:09:40 PST 2021


Hi Andrew,
Chimera had a "pause" command that waited for a key press, but ChimeraX does not have that command currently.

If you want to have a list of commands that you control when each one executes, you can instead make a special HTML file so that the commands will execute only when you click them, like some of our tutorials.  You have to open the HTML file in ChimeraX (e.g. with command "open <URL>" or "open localfile.html") for this mechanism to work.

There is a special "execute command" HTML tag described here:
<https://www.rbvi.ucsf.edu/chimerax/docs/user/tools/helpviewer.html>

It's a bit more work than just listing the commands, but mostly you would just have to enter each command twice, both in the displayed text and in the execution tag for that text.

For more examples, you can view source of the tutorials that use this capability, e.g.:

Protein-Ligand Binding Sites:
<https://www.rbvi.ucsf.edu/chimerax/docs/user/tutorials/binding-sites.html>

CryoEM Visualization:
<https://www.rbvi.ucsf.edu/chimerax/data/stanford-jul2019/tutorial2.html>

I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.                       
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On Mar 12, 2021, at 5:31 AM, andrew <atmp1 at protonmail.com> wrote:
> 
> Greetings,
> I would be grateful for help with a script.
> I made a .cxc script.
> Now, I would like to show somebody the steps, one by one as in
>   I download this [return]
>   I select that [return]
>   colour these [return]
> 
> but I cannot see how to insert a pause/wait or something that waits on keyboard input. I did try to insert a "runscript" and put some lines in a python script that reads from the keyboard, but it looks as if chimerax has redirected the script's stdin.
> I have a feeling, that if I knew what I was doing, I could put another line in the python script "import chimerax.core" and read until the next newline from the command line.
> 
> Is there a way to pause after each line in a script ?
> Many thanks for any advice.
> 
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users




More information about the ChimeraX-users mailing list