コード例 #1
0
    def setup(self):
        self.circle1 = scene.Rect(50, 50, 50, 50)
        self.circle2 = scene.Rect(150, 50, 50, 50)

        self.circle1_layer = scene.Layer(self.circle1)
        circle1 = Image.new('RGBA', (101, 101))
        draw1 = ImageDraw.Draw(circle1)
        draw1.ellipse((0, 0, 100, 100), fill=(0, 255, 0, 255))
        self.circle1_layer.image = scene.load_pil_image(circle1)
        self.circle1_layer.animate('alpha',
                                   0.0,
                                   duration=1.0,
                                   autoreverse=True,
                                   repeat=3)  # alpha animation
        self.add_layer(self.circle1_layer)  # touch handling

        self.circle2_layer = scene.Layer(self.circle2)
        circle2 = Image.new('RGBA', (101, 101))
        draw2 = ImageDraw.Draw(circle2)
        draw2.ellipse((0, 0, 100, 100), fill=(255, 0, 0, 255))
        self.circle2_layer.image = scene.load_pil_image(circle2)
        self.circle2_layer.animate('scale_x',
                                   2.0,
                                   duration=1.0,
                                   autoreverse=True,
                                   repeat=sys.maxint)  # alpha animation
        self.circle2_layer.animate('scale_y',
                                   2.0,
                                   duration=1.0,
                                   autoreverse=True,
                                   repeat=sys.maxint)  # alpha animation
コード例 #2
0
 def setup(self):
     self.rect1 = scene.Rect(50, 50, 50, 50)
     self.rect2 = scene.Rect(150, 50, 50, 50)
     self.rect1_layer = scene.Layer(self.rect1)
     self.add_layer(self.rect1_layer)
     self.rect2_layer = scene.Layer(self.rect2)
     self.add_layer(self.rect2_layer)
コード例 #3
0
 def setup(self):
     self.rect1 = scene.Rect(50, 50, 50, 50)
     self.circle2 = scene.Rect(150, 50, 50, 50)
     self.rect1_layer = scene.Layer(self.rect1)
     self.rect1_layer.background = scene.Color(0, 1, 0)
     self.rect1_layer.animate('alpha',
                              0.0,
                              duration=1.0,
                              autoreverse=True,
                              repeat=3)  # alpha animation
     self.add_layer(self.rect1_layer)  # touch handling
     self.circle2_layer = scene.Layer(self.circle2)
     self.add_layer(self.circle2_layer)
コード例 #4
0
ファイル: photo_text.py プロジェクト: itdvl/photo_text
    def setup(self):
        self.button_dict = collections.OrderedDict([
            ('+', self.increase_font_size), ('—', self.decrease_font_size),
            ('Font', self.next_font), ('Color', self.next_color),
            ('Save', self.save_image), ('Cancel', self.cancel)
        ])

        fgColor = scene.Color(*color('black'))
        bgColor = scene.Color(*color('grey'))
        loc = [0, 0]
        for button_text in self.button_dict:
            if button_text == '+':
                button_text = '  +  '  # double spaces around '+'
            else:  # single space around others
                button_text = ' ' + button_text + ' '
            theButton = TextButton(self, loc, button_text, fgColor, bgColor)
            self.btn_height = max(self.btn_height, theButton.frame.h)
            loc[0] += theButton.frame.w + 4  # 4 pixels between each button

        self.picratio = self.picsize.w / (self.picsize.h * 1.0)
        usable_space = self.bounds.h - self.btn_height
        x = usable_space * self.picratio
        if x <= self.bounds.w:
            y = usable_space
        else:
            x = self.bounds.w
            y = self.bounds.w / self.picratio
        self.position = scene.Size(x / 2, y / 2)  # no ...y/2+self.btn_height
        self.picscale = self.picsize[0] / (x * 1.0)
        self.layer = scene.Layer(scene.Rect(0, self.btn_height, x, y))
        self.layer.image = scene.load_pil_image(self.img)
        self.add_layer(self.layer)
コード例 #5
0
 def setup(self):
     (imageName, imageSize) = self.getImageNameAndSize()
     theRect = scene.Rect(0, 0, *imageSize)
     theRect.center(self.bounds.center())
     print(theRect),
     print(self.bounds)
     self.add_layer(scene.Layer(theRect))
     self.root_layer.image = imageName
コード例 #6
0
 def setup(self):
     # Setup screen with top 200 pixels reserved for text
     w = self.col_width = self.size.w / 4
     h = self.row_height = (self.size.h - 200) / 4
     for animal in animals:
         layer = scene.Layer(scene.Rect(0, 0, w, h))
         layer.image = animal
         self.add_layer(layer)
     self.shuffle_layer_locations()
     self.current_animal = self.different_layer()
コード例 #7
0
ファイル: photo_frame.py プロジェクト: cclauss/Pythonista-4
 def setup(self):
     self.photo_layer = scene.Layer(self.bounds)
     self.add_layer(self.photo_layer)
     self.frame_count = 0
コード例 #8
0
 def setup(self):
     self.layer = scene.Layer(self.bounds)
     self.layer.image = scene.load_pil_image(self.img)
     self.add_layer(self.layer)
コード例 #9
0
 def setup(self):
     w, h = self.picsize
     self.textPosition = scene.Size(w/2/self.scale, h/2/self.scale)
     self.layer = scene.Layer(scene.Rect(0, 0, w/2, h/2))
     self.layer.image = scene.load_pil_image(self.img)
     self.add_layer(self.layer)