Beispiel #1
0
def main():
    # Initialisation de pygame
    pygame.init()

    # Creation d'un window builder
    builder = WindowBuilder(1000)
    builder.makeWindow()
    builder.createGrid()

    # Creation d'un modifier
    modifier = WindowModifier(builder.fenetre, builder.rect_width, builder.rect_height, builder.margin)

    # Controleur de la boucle
    continuer = True
    gameOn = False

    while continuer:
        for event in pygame.event.get():
            if event.type == QUIT:
                continuer = False
            if event.type == MOUSEBUTTONDOWN and event.button == 1:
                modifier.modifyColors(event.pos[0], event.pos[1])
            if event.type == KEYDOWN and event.key == K_SPACE:
                game = GameOfLife(modifier)
                gameOn = not gameOn
        if gameOn:
            game.nextGen()
            modifier.colors = game.colors
            time.sleep(0.3)
        modifier.redrawGrid()
    def on_notebook_properties(self, action):
        builder = WindowBuilder('notebook-properties')
        builder.dialog.set_transient_for(self.window)
        builder.dialog.set_title("%s - Properties" % self.notebook.info.name)
        builder.name_entry.set_text(self.notebook.info.name)
        builder.name_entry.set_sensitive(False)
        builder.description_text_view.get_buffer(
        ).props.text = self.notebook.info.description

        response = builder.dialog.run()
        if response == gtk.RESPONSE_OK:
            self.notebook.info.description = builder.description_text_view.get_buffer(
            ).props.text

        builder.dialog.destroy()