Esempio n. 1
0
    def draw(self, surface, interpol, time_sec):
        val = (self.place.right - self.place.left) * self._value

        if self.button is not None:
            self.button.pos = Vec2D(self.place.left + val,
                                    self.place.top + self.place.height / 2)

        rect = Rectangle(0, 0, val, self.place.height)
        self.sprite.nr = 1
        self.sprite.draw(surface, self.place.pos, rect)

        rect = Rectangle(val, 0, self.place.width - val, self.place.height)
        self.sprite.nr = 0
        pos = self.place.pos + Vec2D(val, 0)
        self.sprite.draw(surface, pos, rect)

        Component.draw(self, surface, interpol, time_sec)
Esempio n. 2
0
    def draw(self, surface, interpol, time_sec):
        Component.draw(self, surface, interpol, time_sec)

        draw.rect(surface, (255, 255, 255), self.place.get_tuple(), 2)

        val = (self.place.get_right() - self.place.pos.x) * self._value

        slide = Rectangle(self.place.pos.x + val - 1, self.place.pos.y, 3,
                          self.place.size.y)
        draw.rect(surface, (255, 255, 255), slide.get_tuple(), 2)
Esempio n. 3
0
    def __init__(self, sprite, pos=Vec2D(0, 0)):
        """Create a new instance

        sprite is a gfx.Sprite with 5 frames:
        normal, selected, normal-active, selected-active, disabled
        """
        Checkbox.__init__(self,
                          Rectangle(pos.x, pos.y, sprite.width, sprite.height))

        self.sprite = sprite
        self.sprite.nr = 1
        self.animTimer = PingPongTimer(20, 1, 3)
Esempio n. 4
0
    def __init__(self, sprite, pos=Vec2D(0, 0)):
        """Create a new instance

        sprite is a gfx.Sprite with 3 frames: normal, active, disabled
        """
        Button.__init__(
            self,
            Rectangle(
                pos.x,  # - sprite.center.x,
                pos.y,  # - sprite.center.y,
                sprite.width,
                sprite.height))

        self.sprite = sprite
        self.sprite.nr = 0
        self.label = None
Esempio n. 5
0
 def __init__(self):
     """Creates new instance"""
     self.subs = []
     self.is_enabled = True
     self.is_visible = True
     self.place = Rectangle(0, 0, 0, 0)
Esempio n. 6
0
 def __init__(self, place=Rectangle(0, 0, 0, 0)):
     InteractiveComponent.__init__(self, place)
     self._value = 0.5
     self._old_value = self._value
     self._is_sliding = False
Esempio n. 7
0
    def __init__(self, place=Rectangle(0, 0, 0, 0), selected=False):
        Button.__init__(self, place)

        self.selected = selected
Esempio n. 8
0
 def __init__(self, place=Rectangle(0, 0, 0, 0)):
     InteractiveComponent.__init__(self, place)
     self.label = None
     self._went_down = False
     self.is_down = False
     self.active = False
Esempio n. 9
0
    return pdf


from PIL import Image
if __name__ == "__main__":
    files = list(
        get_files_in_dir("C:/Users/andris/Desktop/00066_stabilized_adjusted"))
    step = int(len(files) / 20)
    files = files[::step]
    n = len(files)

    print("create pdf...")
    pdf = PDF(orientation='P', unit='in', format='A4')
    pdf.line_width = 0

    print("create rectangles...")
    image = Image.open(files[0])
    image_rect = Rectangle(0, 0, image.height, image.width)
    page_rect = Rectangle(0, 0, pdf.h, pdf.w)
    print_rect = page_rect.shrink(0.5)
    rect = image_rect.fitIn(print_rect)
    rectangles = [persp(rect, k=400, distance=i * step) for i in range(n)]

    print("put images on pdf...")
    compose_pdf(files, rectangles, pdf)

    pdf.output("platasorok.pdf", 'F')
    import os
    os.startfile("platasorok.pdf")