Exemple #1
0
    def buttons(self):
        button_setup = b.ButtonSetup(int(self.x / 2), self.y, 5)
        back_button_setup = b.ButtonSetup(self.x, self.y, 5)

        buttons = []

        for i in range(int(len(self.cell_size_options) / 2)):
            size = button_setup.position(i + 1)
            buttons.append(
                b.Button(size, self.colour_button,
                         str(self.cell_size_options[i])))

        for j in range(int(len(self.cell_size_options) / 2)):
            size = button_setup.position(j + 1)
            size[0] = int(size[0] + self.x / 2)
            buttons.append(
                b.Button(
                    size, self.colour_button,
                    str(self.cell_size_options[
                        j + int(len(self.cell_size_options) / 2)])))

        back_button = b.Button(back_button_setup.position(5),
                               self.colour_button, 'back')

        for k in range(len(self.cell_size_options)):
            if self.settings[1] == self.cell_size_options[k]:
                buttons[k].colour = self.colour_button_chosen
        buttons.append(back_button)

        return buttons
    def buttons(self):
        button_setup = b.ButtonSetup(self.x,
                                     self.y,
                                     rows=5,
                                     columns=9,
                                     x_margin=0)
        survive_text = b.Button(
            button_setup.position(row=1, column=1, column_size=9),
            self.screen_fill, 'When cell survive')

        survive_buttons = []
        for i in range(9):
            survive_buttons.append(
                b.Button(button_setup.position(row=2, column=i + 1),
                         self.colour_button, '{}'.format(i)))

        alive_text = b.Button(
            button_setup.position(row=3, column=1, column_size=9),
            self.screen_fill, 'When cell is born')

        alive_buttons = []
        for j in range(9):
            alive_buttons.append(
                b.Button(button_setup.position(row=4, column=j + 1),
                         self.colour_button, '{}'.format(j)))

        back_button = b.Button(
            button_setup.position(row=5, column=1, column_size=9),
            self.colour_button, 'back')

        buttons = [
            survive_text, survive_buttons, alive_text, alive_buttons,
            back_button
        ]
        return buttons
Exemple #3
0
    def buttons(self):
        button_setup = b.ButtonSetup(self.x, self.y, rows=6, y_margin=0.02)

        resolution_button = b.Button(button_setup.position(1),
                                     self.colour_button, 'resolution')
        cellsize_button = b.Button(button_setup.position(2),
                                   self.colour_button, 'cell size')
        if not self.settings[2]:
            random_button = b.Button(button_setup.position(3),
                                     self.colour_button, ' no random board')
        else:
            random_button = b.Button(button_setup.position(3),
                                     self.colour_button_chosen, 'random board')

        if not self.settings[3]:
            aging_button = b.Button(button_setup.position(4),
                                    self.colour_button, 'no cell aging')
        else:
            aging_button = b.Button(button_setup.position(4),
                                    self.colour_button_chosen, 'cell aging')

        rules_button = b.Button(button_setup.position(5), self.colour_button,
                                'rules')
        back_button = b.Button(button_setup.position(6), self.colour_button,
                               'back')

        buttons = [
            resolution_button, cellsize_button, random_button, aging_button,
            rules_button, back_button
        ]

        return buttons
Exemple #4
0
    def buttons(self):
        x = self.x - self.y
        y = self.y

        buttons_setup = button.ButtonSetup(x, y, 7)
        startstop_button = button.Button(buttons_setup.position(2),
                                         self.colour_button, 'Start')
        clear_button = button.Button(buttons_setup.position(3),
                                     self.colour_button, 'Clear')
        turn_button = button.Button(buttons_setup.position(4),
                                    self.colour_button, 'Turn')
        random_button = button.Button(buttons_setup.position(5),
                                      self.colour_button, 'Random')
        menu_button = button.Button(buttons_setup.position(6),
                                    self.colour_button, 'Menu')

        buttons = [
            startstop_button, clear_button, turn_button, random_button,
            menu_button
        ]

        for i in range(len(buttons)):
            buttons[i].x = buttons[i].x + self.y

        return buttons
Exemple #5
0
    def buttons(self):
        buttons = []
        buttons_setup = b.ButtonSetup(self.x, self.y,
                                      len(self.resolution_options) + 1)
        for i in range(len(self.resolution_options)):
            if self.resolution_options[i] == self.settings[0]:
                buttons.append(
                    b.Button(buttons_setup.position(i + 1),
                             self.colour_button_chosen,
                             str(self.resolution_options[i])))
            else:
                buttons.append(
                    b.Button(buttons_setup.position(i + 1), self.colour_button,
                             str(self.resolution_options[i])))

        apply_button = b.Button(
            buttons_setup.position(len(self.resolution_options) + 1),
            self.colour_button, 'apply')

        buttons.append(apply_button)

        return buttons