尝试使用tkinter动画一系列PIL图像.我的帧持续时间(ms)的图形如下所示:

任何人都知道是什么原因导致这种尖尖的锯齿模式?
这是一个重现的脚本:
from PIL import Image, ImageTk
import Tkinter
import time
import sys
def generate_frames(n):
"""
keep n under 101 * 101
"""
out = []
last_pil = None
for i in range(n):
if last_pil:
pil_image = last_pil.copy()
else:
pil_image = Image.new('L', (101, 101), 255)
x = i / 101
y = i % 101
pil_image.load()[x, y] = 0
out.append(ImageTk.PhotoImage(pil_image))
last_pil = pil_image
return out
def draw():
FRAME_COUNT =5000
master = Tkinter.Tk()
w = Tkinter.Canvas(master, width=302, height=302)
w.create_rectangle(49, 49, …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
import re
r = re.compile(r'[*-/]')
print r.match('.') is not None
Run Code Online (Sandbox Code Playgroud)
它打印True,表示'.'匹配给定的正则表达式,但它不匹配.我是否遗漏了正则表达式中明显的东西?
我2.7.3在osx上使用cpython10.8.2
如果[]删除集合中的三个字符中的任何一个,它就可以工作.