def __init__(self, c ): self.centroid= c self.borders= [ Border(c,oc) for oc in G.P if c!=oc ] #assert not True in [b.isLine for b in self.borders] for b in self.borders: b.verts= [p for p in list(b.seg) if self.RegionBorder(p)]
def render_xlsx(self, outfd, data): + BoldStyle = Style(font=Font(name='Calibri', + size=11, + bold=True, + italic=False, + vertAlign=None, + underline='none', + strike=False, + color='FFFFFFFF'), + fill=PatternFill(fill_type="solid", + start_color='FF000000', + end_color='FF000000')) + RedStyle = Style(font=Font(name='Calibri', + size=11, + bold=False, + italic=False, + vertAlign=None, + underline='none', + strike=False, + color='FF000000'), + border=Border(left=Side(border_style="thick", + color='FF000000'), + right=Side(border_style="thick", + color='FF000000'), + top=Side(border_style="thick", + color='FF000000'), + bottom=Side(border_style="thick", + color='FF000000'), + diagonal=Side(border_style="thick", + color='FF000000'), + diagonal_direction=0, + outline=Side(border_style="thick", + color='FF000000'), + vertical=Side(border_style="thick", + color='FF000000'), + horizontal=Side(border_style="thick", + color='FF000000')), + fill=PatternFill(start_color = 'FFFF0000', + end_color = 'FFFF0000', + fill_type = 'solid')) + GreenStyle = Style(font=Font(name='Calibri', + size=11, + bold=False, + italic=False, + vertAlign=None, + underline='none', + strike=False, + color='FF000000'), + fill=PatternFill(start_color = "FF00FF00", + end_color = "FF00FF00", + fill_type = "solid")) + wb = Workbook(optimized_write = True)
def __init__(self, parent, orientation, thickness=10, left=None, top=None, width=None, height=None, bg_color=None, fg_color=None, border=None, bd_color=None, bd_width=1): if orientation != "vertical" and orientation != "horizontal": raise TypeError, 'orientation' GUIObject.__init__(self, left, top, width, height) self.orientation = orientation self.bg_color = bg_color self.fg_color = fg_color self.thickness = thickness self.border = border self.bd_color = bd_color self.bd_width = bd_width if not self.bg_color: if self.skin_info_widget.rectangle.bgcolor: self.bg_color = Color(self.skin_info_widget.rectangle.bgcolor) else: self.bg_color = Color(self.osd.default_bg_color) if not self.fg_color: if self.skin_info_widget.font.color: self.fg_color = Color(self.skin_info_widget.font.color) else: self.fg_color = Color(self.osd.default_fg_color) if not self.bd_color: if self.skin_info_widget.rectangle.color: self.bd_color = Color(self.skin_info_widget.rectangle.color) else: self.bd_color = Color(self.osd.default_fg_color) if not self.border: self.border = Border(self, Border.BORDER_FLAT, self.bd_color, self.bd_width)
def main(lfile): # Initialisation de la fenêtre d'affichage pygame.init() Config.screen = pygame.display.set_mode((Config.screenWidth, Config.screenHeight), HWSURFACE | DOUBLEBUF) pygame.display.set_caption(Config.titre+' ('+Config.name_app+')') # le logo d'hommage ^^ Config.logo, Config.logo_r = Tools.load_png('logo.png') # les bords de la surface de jeu Config.bords = Border.Border() # le fond Config.bg, Config.bg_r = Tools.load_png('bg-editor.png') # on met à l'échelle le fond si besoin if (Config.bg_r.width, Config.bg_r.height) != (Config.bords.width, Config.bords.height): Config.bg = pygame.transform.scale(Config.bg, (Config.bords.width, Config.bords.height)) # la zone d'info Config.zinfo = pygame.Surface([(Config.screenWidth - Config.bords.width), Config.screenHeight]) Config.zinfo.fill(THECOLORS["black"]) # zone de saisie/affichage du fichier (centrée dans la zone d'info) lvx = Config.bords.width + ((Config.screenWidth - Config.bords.width) // 2) - (Config.zinfo.get_rect().width // 2) + 3 Ced.levelname = Gui.InputBox(lvx, Config.screenHeight - 55, Config.zinfo.get_rect().width - 10, 32, 'level-{0:03d}.txt'.format(Config.level)) RazLevel() # Affichage Config.screen.blit(Config.bg, (0, 0)) Config.bords.draw() if Ced.view_grid: DrawGrid() EditorMenu() DrawLevel() pygame.display.flip() if lfile is not None: # fichier à charger Ced.levelname.setText(lfile) LoadLevel() # Initialisation de l'horloge Config.clock = pygame.time.Clock() # Boucle d'évènements while True: event_handler() dt = Config.clock.tick(Config.FPS) / 1000 # affichages Config.screen.blit(Config.bg, (0, 0)) Config.bords.draw() if Ced.view_grid: DrawGrid() EditorMenu() DrawLevel() if Config.bossLevel: Ced.boss_sps.draw() if Ced.boss_brL is not None: Ced.boss_brL.draw() if Ced.boss_brR is not None: Ced.boss_brR.draw() Ced.levelname.draw() if Ced.z_select is not None: Ced.z_select.draw() pygame.display.flip()
def main(): # Initialisation de la fenêtre d'affichage pygame.init() Config.screen = pygame.display.set_mode( (Config.screenWidth, Config.screenHeight), HWSURFACE | DOUBLEBUF) pygame.display.set_caption(Config.titre) # le son pygame.mixer.init(44100, -16, 2, 4096) # le logo d'hommage ^^ Config.logo, Config.logo_r = Tools.load_png('logo.png') # les bords de la surface de jeu Config.bords = Border.Border() # le niveau Level.LoadLevel(Config.level) if Config.bossLevel: # niveau d'un boss Boss.doBossLevel() else: # le fond Tools.InitBG() Tools.ReadHighScore() # la zone d'info Config.zinfo = pygame.Surface([(Config.screenWidth - Config.bords.width), Config.screenHeight]) Config.zinfo.fill(THECOLORS["black"]) # Le joueur (la raquette) Config.player = Player.Bat('player-bat-02.png', 'player-bat-02-L.png', 'player-bat-02-S.png') # La première balle Ball.BallInit() # les ennemis Enemys.init() # les sons Tools.InitSounds() pygame.mixer.music.set_volume((Config.Volume / 100)) # Affichage Config.screen.blit(Config.bg, (0, 0)) Config.bords.draw() Tools.MsgInfo() Level.DrawLevel() Config.player.draw() Ball.Ballsdraw() Enemys.draw() pygame.display.flip() # Initialisation de l'horloge Config.clock = pygame.time.Clock() # timer user pour la màj des fps (déclenché 1 fois/seconde) pygame.time.set_timer(USEREVENT, 1000) # timer pour la génération des ennemis (déclenché toutes les 10s) pygame.time.set_timer((USEREVENT + 1), 10000) # timer pour la génération des bombes et missiles du boss (déclenché toutes les 5s) pygame.time.set_timer((USEREVENT + 2), 5000) Config.Sounds['intro'].play() # Boucle d'évènements while True: event_handler() dt = Config.clock.tick(Config.FPS) / 1000 Ball.Ballsupdate() if Config.Perdu: Config.life -= 1 if Config.life > 0: Tools.MsgCenter("Oops...", 28, Config.zinfo.get_rect().centery, "cyan", True) pygame.display.flip() # petite tempo pygame.time.wait(1500) Config.Perdu = False Bonus.initBonus() Config.player.reset() Ball.BallInit() else: # perdu... Tools.GameOver() else: if Config.bossLevel: if Config.boss.update(): Config.life -= 1 if Config.life <= 0: # perdu... Tools.GameOver() Config.player.update() Bonus.update() Enemys.update() if Config.bossLevel: if Config.boss.isDead: # niveau suivant Tools.MsgCenter("!! Bravo !!", 28, Config.zinfo.get_rect().centery, "blue", True) pygame.display.flip() # petite tempo pygame.time.wait(5000) Tools.NextLevel() if Level.FinishedLevel(): # niveau suivant Tools.MsgCenter("Level UP!", 28, Config.zinfo.get_rect().centery, "green", True) pygame.display.flip() # petite tempo pygame.time.wait(1500) Tools.NextLevel() # affichages Config.screen.blit(Config.bg, (0, 0)) Config.bords.draw() Tools.MsgInfo() Level.DrawLevel() Config.player.draw() Ball.Ballsdraw() Bonus.draw() Bonus.drawAdds() Enemys.draw() pygame.display.flip()