[Chimera-users] Flushing output during the script execution

Eric Pettersen pett at cgl.ucsf.edu
Mon Oct 27 11:44:52 PDT 2008

Hi Lukas,
	The runCommand function immediately executes the given command and  
does not wait for a redraw to occur before going on to the next  
command in your script.  In order to allow Chimera to draw the map  
you've opened you need to insert a run('wait 1') in front of your  
sleep() call -- asking Chimera to draw one frame.


                         Eric Pettersen
                         UCSF Computer Graphics Lab

On Oct 27, 2008, at 9:42 AM, Lukas Palatinus wrote:

> Hello all,
> I am using Chimera as a visualization tool for small-molecule  
> electron densities obtained by ab initio structure solution. I want  
> to create a small script that will make Chimera read and display the  
> intermediate electron densities as they are produced during the  
> iterative structure solution process. I am not skilled in Python,  
> but I could make a simple Python script by copying and modifying  
> scripts previously posted in this list. Here is the script:
> from chimera import runCommand as run
> from os.path import exists
> from time import sleep
> map_file= 'test.xplor'
> while exists(map_file):
>    run('close all')
>    run('open ' + map_file)
>    sleep(1)
> I am sure this is not the most elegant way to achieve what I need,  
> but it should do the job. What the script should in my opinion do is  
> to read and display the file test.xplor, then wait one second, close  
> the map and reopen it again, until the file test.xplor is deleted.  
> The script does >>almost<< that, it opens the volume viewer, reads  
> the map, but it does not display the map in the main Chimera window.  
> Only after the file test.xplor is deleted, the last map is  
> displayed. Can anybody give me a hint what am I doing wrong? I am  
> using Chimera 1.2540 on Mac OS X 10.4.
> Thanks in advance for any help.
> Best regards
> Lukas
> Lukas Palatinus
> Laboratoire de Cristallographie
> EPFL Lausanne
> Tel.: +41 (0)21 693 0639
> mailto: palat at fzu.cz
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20081027/52f39d41/attachment.html>

More information about the Chimera-users mailing list