示例#1
0
文件: video.py 项目: dmaccarthy/sc8pr
 def __getitem__(self, n):
     "Return a frame as an Image instance"
     if n != self._current[0]:
         self._current = n, self._costumes[n].img
     img = self._current[1]
     srf = img.original
     if self.alpha and not hasAlpha(srf):
         img = Image(srf.convert_alpha())
         self._current = n, img
     return img.config(size=self.size, angle=self.angle)
示例#2
0
 def __init__(self, size=(128,16), knob="grey", lower=0, upper=1, steps=0):
     super().__init__(size)
     self.steps = steps
     if not isinstance(knob, Graphic): knob = Image(self._knobSize(), knob)
     self += knob.bind(ondrag=_knobDrag, onrelease=_knobRelease)
     self.knob = knob.config(_dragRel=None)
     if upper < lower:
         self._flip = True
         upper, lower = lower, upper
     else: self._flip = False
     self.lower = lower
     self.upper = upper
     self.val = lower
示例#3
0
文件: video.py 项目: swipswaps/sc8pr
 def __getitem__(self, n):
     "Return a frame as an Image instance, or a slice as a new Video instance"
     if type(n) is slice:
         r = range(n.start, n.stop, n.step) if n.step else range(n.start, n.stop)
         return self.clip(r)
     if n != self._current[0]:
         self._current = n, self._costumes[n].img
     img = self._current[1]
     srf = img.original
     if self.alpha and not hasAlpha(srf):
         img = Image(srf.convert_alpha())
         self._current = n, img
     return img.config(size=self.size, angle=self.angle)