[chimera-dev] volume display in my gui
Tom Goddard
goddard at sonic.net
Fri Mar 6 15:27:14 PST 2015
Hi Stu,
The gui.py file I mentioned is shown with Chimera menu entry Tools / Volume Data / Values at Atom Positions. It does not embed volume images though.
Chimera is not designed to handle multiple interactive 3-d renderings, so you cannot in any simple way embed the Chimera graphics in your own Tk window. The graphics is shown as a Togl widget (Tk OpenGL widget) that is drawn by Chimera C++ code. Why do you want do that? Why not just manipulate the view in the main Chimera graphics window? The only example of embedding 3d data display in another window is the Chimera side view (menu Favorites / Side View) which has Python code in
chimera/share/chimera/viewing.py
But it uses C++ code to handle the drawing.
If your aim is to make a custom app with Chimera graphics and your own set of controls you could modify the Chimera main window with Python code in
chimera/share/chimera/tkgui.py
All of this is quite hard. Another route is to take a snapshot image from the main Chimera window to put it in your own window, but then you could not rotate it.
Tom
> On Mar 6, 2015, at 3:11 PM, hy liao wrote:
>
> Hi Tom:
>
> Thank you for your prompt reply. Sorry for my ignorance, but how can I run the script chimera/share/AtomDensity/gui.py and see the gui it actually produces?
>
> Alternatively, this might be another way of formulating my question: to display a picture in a gui using tkinter, one can create a frame object, then a canvas object, then set the position of the canvas, then create a photoimage object, and then indicate that the picture goes in the canvas. Now, instead of a picture, how do I do the same for a chimera type of volume display? Do I have to also go through creating a frame, a canvas, and then indicate that the volume must reside in the just created canvas. It would be great if you know of any example out there. I have been relying on examples so far.
>
> Thanks again!
>
> Stu
>
>
> On Friday, March 6, 2015 4:26 PM, Tom Goddard wrote:
>
>
> Hi Stu,
>
> To find out about Python functions that control volume display in Chimera that you could use from your Tkinter gui take a look at the Chimera Python scripts web page:
>
> http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts <http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts>
>
> for example the readvol.py example shows how to access volume data values. In Python you can make use of commands that would be normally typed at the Chimera command-line in the following way
>
> from chimera import runCommand
> runCommand(‘volume #0 level 12.5 color pink’)
>
> or you could directly call functions in Python that change volume display, for example,
>
> import VolumeViewer as vv
> v0 = vv.volume_list()[0]
> v0.set_parameters(surface_levels = [12.5], surface_colors = [(1,.5,.5,1)])
>
> To find those functions you can look at the Chimera Volume class Python code in your Chimera distribution
>
> chimera/share/VolumeViewer/volume.py
>
> (on Mac in Chimera.app/Contents/Resources/share/VolumeViewer/volume.py), and you can look at how the Chimera “volume” command does it
>
> chimera/share/VolumeViewer/volumecommand.py
>
> For making a Tk GUI look at a simple example in the Chimera distribution, for example, the values at atom positions dialog
>
> chimera/share/AtomDensity/gui.py
>
>
> Tom
>
>
>
>> On Mar 6, 2015, at 12:16 PM, hy liao wrote:
>>
>> Hi, I am developing a GUI with Tkinter, using anaconda's python 2.7.9. I like how chimera displays volumes (density maps), so I would like to a chimera-volume-display in my GUI. I am now disregarding anaconda and developing all within chimera's IDLE. However, I do not know which chimera commands I could use for my purpose; could you please point to some choices?
>>
>> I am new with developing chimera extension and tkinter, and I mostly look for code examples. I had a look at http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/ <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/>, "Working with the Chimera Extension Manager," but I do not know which commands I could use to have chimera display a volume in a grid of my GUI.
>>
>> Thanks!
>> Stu
>> _______________________________________________
>> Chimera-dev mailing list
>> Chimera-dev at cgl.ucsf.edu <mailto:Chimera-dev at cgl.ucsf.edu>
>> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20150306/b2a53d5c/attachment.html>
More information about the Chimera-dev
mailing list