This python script crashes py24/25, but not 23

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have build python extension mingc.pyd against ming 3(ming-0.3.0) and
4(ming-0.4.0.beta5) on windows with mingw
but this script lets python 2.4 and 2.5 crash, however, not 2.3
don't know why

import os
import sys
import glob

from ming import *

# jpg slideshow 2.0 : grab jpgs from specified directories and create
a swf slideshow...
# code by gazb : gazb dot ming at NOSPAM gmail dot com
# http://www16.brinkster.com/gazb/ming/
# October 2003 version 1
# December 2003 version 2
# just put the directories with the jpgs here and compile
#
# ported to python by Lee June, 2006
# http://blender.bokee.com

pathtojpgs= []
pathtojpgs.append('./resource')

# some typical movie variables
Ming_setScale(20.00000000);
Ming_useSWFVersion(6);
movie=SWFMovie();
movie.setBackground(33,33,33);
movie.setRate(31);
movie.setDimension(550,400);

#// easing equation converted to php from Actionscript @
# http://www.robertpenner.com/easing_equations.as
# use of which are subject to the license @
# http://www.robertpenner.com/easing_terms_of_use.html
def easeInQuad(t, b, c, d):
	t/=d;
	return c*t*t + b;

def easeOutQuad (t, b, c, d):
	t/=d;
	return -c *(t)*(t-2) + b;


# basic actionscript control of playback using mouse
strAction="""
if(!init){
	init=true;
	stopped=false;
	controls = {
		onMouseDown: function () {
			if(!stopped){
				stop();
				stopped=true;
			}else{
				play();
				stopped=false;
			}
		}
	};
	Mouse.addListener(controls);
}
"""
movie.add(SWFAction(strAction));

# grab the jpgs
f = []
for i in pathtojpgs:
	t=glob.glob(i+'/*.*')
	t=filter(lambda e: e.upper()[-3:] in ['JPG', 'PNG', 'GIF'], t)
	f.append(map(os.path.realpath, t))


# add the jpgs to the movie with basic fade in/out
movie.nextFrame();
for i in f:
	for k in i:
		img = SWFBitmap(k);
		print 'k=',k
		pic=movie.add(img);
		pic.moveTo( (275-img.getWidth()/2),(200-img.getHeight()/2));
		transition=20;
		cnt=1; startpos=0; offset=1; duration=transition;

		while (cnt<=duration):
			inc=easeInQuad (cnt, startpos, offset, duration);
			cnt+=1
			pic.multColor(1,1,1,inc);
			movie.nextFrame();

		for j in range(1, transition*2+1):
			movie.nextFrame();

		cnt=1; startpos=1; offset=-1; duration=transition;
		while (cnt<=duration):

			inc=easeOutQuad (cnt, startpos, offset, duration);
			cnt+=1
			pic.multColor(1,1,1,inc);
			movie.nextFrame();

		movie.remove(pic);

	movie.nextFrame();


# save swf with same name as this file
swfname = sys.argv[0][:-3] + '.swf'
movie.save(swfname)

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Ming-users mailing list
Ming-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ming-users

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux