From: William C. W. <ww...@la...> - 2008-04-17 04:19:56
|
Hi Lornezo, Your best bet might be to forgo a Python-based solution and use something like ffmpeg to encode screen activity directly while the window is active. (ffmpeg is an open source command line encoding application that can also do video capture). You should be able to find a number of references, for example: http://ubuntu.wordpress.com/2006/06/08/how-to-create-a-screencast-in-ubuntu/ Good luck! Bill Ward > Dear All, > Quite some time ago I asked some questions abut how to make a movie in > Visual Python. > Among the various answers I got, I was trying this suggestion: > > > On 14/01/2008, Kadir Haldenbilen <kha...@ya...> wrote: > > > > Lorenzo Isella wrote: > > > > > I managed to get some decent animations on my laptop (running Debian > > > testing); now my question is how to get at least a set of png (or any > > > other decent format; pdf, eps, jpg etc...) files with the "snapshots" > > > of my system. > > > > I can answer your question for Windows environment. Same or similar > solution > > MAY or > > MAY NOT apply for Linux, I have no experience in Linux environment. > > > > First you need to install Python Image Library, PIL, if you have not > done so > > already. You may be using it already, if you are using TEXTURE feature > of > > the recent Beta versions of VPython. > > > > Then in your source code you need to add some lines, like the > followings: > > > > import Image > > import ImageGrab > > ... > > > > Your animation code goes here > > > > ... > > > > while looping: > > > > im = > > ImageGrab.grab((24,30,ImageWidth-4,ImageHeight-4)) > > fn = "Cat"+str(pn)+".png" > > im.save(fn) > > > > fn is the filename in Windows environment. > > > > IF THIS SYSTEM WORKS in LINUX, then someting similar to that of > filename > > should be sufficient. > > ImageGrab needs the display location (upper-left corner) and display > > sizedefined to it, so it picks up > > the image from the screen for you. > > > > You need to set up some sort of a counter in the loop like the > str(pn), to > > get a unique > > file name for each snapshot. > > > > Hope it works... > > > > Kadir > > > > > > ________________________________ > > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try > it > > now. > > > > Now, unfortunately I do not think this works for linux. Consider the > small example given below: > > > #! /usr/bin/env python > > import scipy as s > import numpy as n > import pylab as p > > import visual as v > > > import Image > import ImageGrab > > x_list=s.arange(10) > y_list=s.zeros(10) > y_list[:]=1. > z_list=y_list > > > > box_size=100. > > #v.scene = v.display(title="System Snapshot", width=box_size, > height=box_size, x=0, y=0, > # range=box_size, center=(0.,0.,0.)) > > my_rad=1. > > particles=[v.sphere(pos=loc,radius=my_rad,color=v.color.blue)\ > for loc in zip(x_list,y_list,z_list)] > > > im = ImageGrab.grab((24,30,ImageWidth-4,ImageHeight-4)) > fn = "Cat"+str(pn)+".png" > im.save(fn) > > > If I run it on my machine (Debian testing) then I got the following > error message: > > Traceback (most recent call last): > File "<stdin>", line 11, in ? > File "/usr/lib/python2.4/site-packages/PIL/ImageGrab.py", line 34, in ? > import _grabscreen > ImportError: No module named _grabscreen > > Is the module ImageGrab available for Debian (or for linux in general)? > Or does anyone know of a workaround for this? > Many thanks > > Lorenzo > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://physics.syr.edu/~salgado/software/vpython/EMWave.py > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |