comparison pyink/tween.py @ 1227:983442b2698c

Fix the exception for object without opacity.
author wycc
date Fri, 07 Jan 2011 15:58:45 +0800
parents a05c8deb6523
children 447cd3359cf2
comparison
equal deleted inserted replaced
1226:bdc2ed94ea37 1227:983442b2698c
10 f = a.split(':') 10 f = a.split(':')
11 if f[0] == 'opacity': 11 if f[0] == 'opacity':
12 return float(f[1]) 12 return float(f[1])
13 return 1 13 return 1
14 14
15 def change_opacity(obj,opacity): 15 def change_opacity(obj, opacity):
16 style = obj.getAttribute("style") 16 try:
17 style = obj.getAttribute("style")
18 except:
19 obj.setAttribute("style","opacity:%g" % opacity)
20 return
17 arr = style.split(';') 21 arr = style.split(';')
18 s='' 22 s=''
19 for a in arr: 23 for a in arr:
20 f = a.split(':') 24 f = a.split(':')
21 f[0] = f[0].replace(' ','') 25 f[0] = f[0].replace(' ','')