Esempio n. 1
0
 def __init__(self, posx, posy):
     Sprite.__init__(self)
     self.move = Movement(self, thrust_strength = 15000,
                          accelx = 3800,
                          maxspeedx = 2000,
                          maxspeedy = 2500,
                          posx=posx,
                          posy=posy)
     self.brain = None
     self.fairy_wingup = media.load_image('fairy_wingup.png')
     self.fairy_wingmid = media.load_image('fairy_wingmid.png')
     self.fairy_wingdown = media.load_image('fairy_wingdown.png')
     self.image = self.fairy_wingup
     self.rect = self.image.get_rect()
     self.currentframe = 1
Esempio n. 2
0
 def __init__(self, posx, posy):
     Sprite.__init__(self)
     self.move = Movement(self, thrust_strength = 1000,
                          accelx = 1000,
                          accely = 1000,
                          maxspeedx = 60,
                          maxspeedy = 60,
                          gravity = 0,
                          posx = posx,
                          posy = posy)
     self.ghost1 = media.load_image('ghost1.png')
     self.ghost2 = media.load_image('ghost2.png')
     self.image = self.ghost1
     self.rect = self.image.get_rect()
     self.currentframe = 1
Esempio n. 3
0
    def __init__(self):
        self.move = Movement(self, thrust_strength = 100000,
                             accelx = 100000,
                             accely = 100000,
                             maxspeedx = 120,
                             maxspeedy = 120,
                             gravity = 0,
                             posx=200,
                             posy=200)
        self.hunter = media.load_image('hunter.png').convert_alpha()
        self.firstupdate = False
        self.image = self.hunter
        self.rect = self.image.get_rect()
        self.imgflip = False
        self.dir = 1

        self.fuel = 10000
        self.lives = 3
        self.score = 0
        
        self.caught_fairies = Group()
        self.fairies_to_catch = Group()

        self.out_of_fuel_event = None
        self.no_more_life_event = None
        self.all_fairies_caught_event = None
        self.moveright(1000)
Esempio n. 4
0
 def modify_toolbar(self):
     # Modify Toolbar
     def add_icon(text='Button', command=None, image=None):
         self.images.append(Tk.PhotoImage(data=image))
         b = Tk.Button(self.fig.canvas.toolbar,
                       text=text, command=command, image=self.images[-1],
                       height=40, compound="top")
         b.pack(side=Tk.LEFT)
         return b
 
     def add_separator(width=10):
         Tk.Frame(self.fig.canvas.toolbar, width=width).pack(side=Tk.LEFT)
 
     add_separator()
     add_icon('Lade', lambda: self.ladeSequenz(), load_image('icon_open.gif'))
     add_icon('Speichere', lambda: self.speichereSequenz(), load_image('icon_save.gif'))
     add_separator()
     self.verbindungButton = add_icon('Verbindung', lambda: self.verbindungToggleButton(),
              load_image('icon_laptop.gif'))
     self.aufnahmeButton = add_icon('Aufnahme', lambda: self.aufnahme(),
                                            load_image('icon_oszi.gif'))
     add_icon('Messung', lambda: self.messung(),
              load_image('icon_measure.gif'))
     #add_icon('Analyse', lambda: self.analyse(),
     #         load_image('icon_calculator.gif'))
     add_icon('Pruefe', lambda: self.pruefeDaten(),
              load_image('icon_abacus.gif'))
     add_icon('Bereinigen', lambda: self.plot(),
              load_image('icon_close.gif'))
     add_separator()
Esempio n. 5
0
File: loop.py Progetto: auroua/test
def pic_process():
    pic = media.load_image("/home/auroua/workspace/lena.jpg")
    width,height = media.get_width(pic),media.get_height(pic)
    for x in range(0,height,2):
        for y in range(0,width+1):
            p = media.get_pixel(pic,x,y)
            media.set_color(p,media.black)

    media.show(pic)
Esempio n. 6
0
 def create_layer(self):
     bgimg = media.load_image('bg.png').convert()
     rbgimg = bgimg.get_rect()
     rows = int(600 / rbgimg.height) + 2
     
     layer = Surface((rbgimg.width, 600))
     for y in xrange(rows):
         layer.blit(bgimg, rbgimg)
         rbgimg = rbgimg.move([0, rbgimg.height])
     return layer
Esempio n. 7
0
 def create_bottom(self):
     bgimg = media.load_image('tile_wall.png').convert()
     bgimg = pygame.transform.flip(bgimg, False, True)
     rbgimg = bgimg.get_rect()
     cols = int(1000 / rbgimg.width)
     
     top = Surface((1000, rbgimg.height))
     for x in xrange(cols):
         top.blit(bgimg, rbgimg)
         rbgimg = rbgimg.move([rbgimg.width, 0])
     return top
Esempio n. 8
0
 def create_top(self):
     bgimg = media.load_image('tile_wall.png').convert()
     rbgimg = bgimg.get_rect()
     self.top_size = rbgimg.width
     cols = int(1000 / rbgimg.width)
     
     top = Surface((1000, rbgimg.height))
     for x in xrange(cols):
         top.blit(bgimg, rbgimg)
         rbgimg = rbgimg.move([rbgimg.width, 0])
     return top
Esempio n. 9
0
    def __init__(self, posx, posy):
        Sprite.__init__(self)
        self.move = Movement(self, thrust_strength = 1000,
                             accelx = 1000,
                             accely = 1000,
                             maxspeedx = 153,
                             maxspeedy = 153,
                             gravity = 0,
                             posx = posx,
                             posy = posy)

        if random.randint(0, 2) == 1:        
            self.image = media.load_image('Cone.png')
            self.rect = self.image.get_rect()
            self.image = pygame.transform.scale(self.image, (int(self.rect.width*1.5), int(self.rect.height*1.5)))
        else:
            self.image = media.load_image('Trou.png')
            self.rect = self.image.get_rect()
            self.image = pygame.transform.scale(self.image, (self.rect.width*2, self.rect.height*2))
            
        self.rect = self.image.get_rect()
Esempio n. 10
0
 def create_bg(self):
     rbg = self.bg.get_rect()
     bgimg = media.load_image('bg.png').convert()
     rbgimg = bgimg.get_rect()
     columns = int(rbg.width / rbgimg.width) + 1
     rows = int(rbg.height / rbgimg.height) + 1
     
     for y in xrange(rows):
         for x in xrange(columns):
             if x == 0 and y > 0:
                 rbgimg = rbgimg.move([-(columns -1 ) * rbgimg.width, rbgimg.height])
             if x > 0:
                 rbgimg = rbgimg.move([rbgimg.width, 0])
             self.bg.blit(bgimg, rbgimg)
Esempio n. 11
0
 def __init__(self, x, y, h, w):
     Sprite.__init__(self)
     tile = media.load_image('tile_wall.png').convert()
     rtile = tile.get_rect()
     self.rect = pygame.rect.Rect(x, y, h, w)
     self.image = pygame.surface.Surface((self.rect.width, self.rect.height))
                     
     columns = int(self.rect.width / rtile.width) + 1
     rows = int(self.rect.height / rtile.height) + 1
     
     for y in xrange(rows):
         for x in xrange(columns):
             if x == 0 and y > 0:
                 rtile = rtile.move([-(columns -1 ) * rtile.width, rtile.height])
             if x > 0:
                 rtile = rtile.move([rtile.width, 0])
             self.image.blit(tile, rtile)
Esempio n. 12
0
    def modify_toolbar(self):
        # Modify Toolbar
        def add_icon(text='Button', command=None, image=None):
            self.images.append(Tk.PhotoImage(data=image))
            b = Tk.Button(self.fig.canvas.toolbar,
                          text=text,
                          command=command,
                          image=self.images[-1],
                          height=40,
                          compound="top")
            b.pack(side=Tk.LEFT)
            return b

        def add_separator(width=10):
            Tk.Frame(self.fig.canvas.toolbar, width=width).pack(side=Tk.LEFT)

        add_separator()
        add_icon('Lade', lambda: self.ladeSequenz(),
                 load_image('icon_open.gif'))
        add_icon('Speichere', lambda: self.speichereSequenz(),
                 load_image('icon_save.gif'))
        add_separator()
        self.verbindungButton = add_icon('Verbindung',
                                         lambda: self.verbindungToggleButton(),
                                         load_image('icon_laptop.gif'))
        self.aufnahmeButton = add_icon('Aufnahme', lambda: self.aufnahme(),
                                       load_image('icon_oszi.gif'))
        add_icon('Messung', lambda: self.messung(),
                 load_image('icon_measure.gif'))
        #add_icon('Analyse', lambda: self.analyse(),
        #         load_image('icon_calculator.gif'))
        add_icon('Pruefe', lambda: self.pruefeDaten(),
                 load_image('icon_abacus.gif'))
        add_icon('Bereinigen', lambda: self.plot(),
                 load_image('icon_close.gif'))
        add_separator()