tkinter to mpeg
schliep at molgen.mpg.de
Wed Oct 4 10:50:34 CEST 2006
claird at lairds.us (Cameron Laird) writes:
> In article <efrf8m$q4b$00$1 at news.t-online.com>,
> Thomas Jollans <nospam at jollans.com> wrote:
>>On Mon, 02 Oct 2006 09:18:13 -0700, "dug" <mm2ps at yahoo.co.uk> let this
>>> I have a small program that moves some shapes around a tkinter canvas.
>>> Is there any way to save the output in a movie file, maybe mpeg?
>>you can record any app with special programs designed for the job, such as
>>vnc2swf (which produces macromedia flash), vncrec (which produces a
>>special format readable by transcode) or istanbul (which produces
>>ogg/theora). I doubt Tk would have a special mechanism to do this.
> I've actually been thinking about implementing just such a special
> mechanism. Let me know if there's sufficient interest.
I think it would be most helpful to have a general way to dump the contents
of a Tkinter canvas including animated elements to some sort of file.
However, I would think that mpeg will look pretty bad compared to SVG.
In fact, as SVG renders much prettier (anti-aliasing etc.) than Tkinter,
the exported file would look much better.
I actually started coding SVG output for Gato (http://gato.sf.net). Some
of the things I realized:
- SVG support is somewhat limited on *nix.
- The SMIL type animations are even less supported. One would have to
subset for Firefox 2.0?
- Due to a bug in the SVG 1.1 specification multi-colored lines with
same color arrow-heads are difficult to draw. Supposedly, this will
be fixed in 1.2.
- The geometry works differently in SVG compared to Tk. Arrow heads
are stuck onto the end of a line for example.
It would be trivial to wrap the Tkinter canvas in an object which
records what function is called when. For the basic canvas
items mapping this to SVG is quite straightforward.
PS: There is some python code to output SVG, which I didn't use since
I wanted to work on my applications abstraction level.
Alexander Schliep schliep at molgen.mpg.de
More information about the Python-list