Ejemplo n.º 1
0
    def _createbuttons(self):
        self.addplayerbutton = button("Add", self.font,
                                      [self.addxpos, self.buttonypos],
                                      self.buttonwidth, self.uiheight,
                                      self.buttoncolor, self.hovercolor,
                                      self.pressedcolor, self.inactivecolor,
                                      self._addplayer)
        self.buttonlist.append(self.addplayerbutton)

        self.removeplayerbutton = button("Remove", self.font,
                                         [self.removexpos, self.buttonypos],
                                         self.buttonwidth, self.uiheight,
                                         self.buttoncolor, self.hovercolor,
                                         self.pressedcolor, self.inactivecolor,
                                         self._removeplayer)
        self.buttonlist.append(self.removeplayerbutton)

        startbutton = button("Start", self.startfont,
                             [self.startxpos, self.startypos], self.startwidth,
                             self.startheight, self.buttoncolor,
                             self.hovercolor, self.pressedcolor,
                             self.inactivecolor, self._start)
        self.buttonlist.append(startbutton)

        backbutton = button("< Back", self.font, [
            self.backbuttonmargin + self.uiwidth * 0.3 / 2,
            self.backbuttonmargin + self.uiheight / 2
        ], self.uiwidth * 0.3, self.uiheight, self.buttoncolor,
                            self.hovercolor, self.pressedcolor,
                            self.inactivecolor, self._goback)
        self.buttonlist.append(backbutton)

        self._activatedeactivatebuttons()
Ejemplo n.º 2
0
 def _createbuttons(self):
     backbutton = button("< Back", self.font, [
         self.backbuttonmargin + self.uiwidth * 0.3 / 2,
         self.backbuttonmargin + self.uiheight / 2
     ], self.uiwidth * 0.3, self.uiheight, self.buttoncolor,
                         self.hovercolor, self.pressedcolor,
                         self.inactivecolor, self._goback)
     self.buttons.append(backbutton)
Ejemplo n.º 3
0
    def _creategameoverbuttons(self):
        if self.gamestate == self.gamestates["draw"]:
            ypos = self.screensize[1] * 0.5
        else:
            ypos = self.screensize[1] * 0.7

        self.buttons.append(
            button("Next round", self.font, [self.screensize[0] / 2, ypos],
                   self.uiwidth * 0.8, self.uiheight, self.buttoncolor,
                   self.hovercolor, self.pressedcolor, self.inactivecolor,
                   self._restartbuttonpressed))

        self.buttons.append(
            button("Main menu", self.font,
                   [self.screensize[0] / 2, ypos + self.uiheight * 1.3],
                   self.uiwidth * 0.8, self.uiheight, self.buttoncolor,
                   self.hovercolor, self.pressedcolor, self.inactivecolor,
                   self._returnmainmenu))
Ejemplo n.º 4
0
    def _createbuttons(self):
        offsetcenter = self.screensize[1]*0.07
        height = self.screensize[1]*0.059
        width = self.screensize[0]*0.3
        marginbetween = height * 0.3

        startbutton = button("Start", self.buttonfont, [self.screensize[0]/2, self.screensize[1]/2+offsetcenter], width, height,
                                self.buttoncolor, self.hovercolor,
                                self.pressedcolor, self.inactivecolor, self._switchtoplayercreation)
        self.buttonlist.append(startbutton)

        settingsbutton = button("Settings", self.buttonfont, [self.screensize[0] / 2, self.screensize[1] / 2+offsetcenter+height+marginbetween], width, height,
                                self.buttoncolor, self.hovercolor,
                                self.pressedcolor, self.inactivecolor, self._switchtosettings)
        self.buttonlist.append(settingsbutton)

        quitbutton = button("Quit", self.buttonfont, [self.screensize[0] / 2, self.screensize[1] / 2+offsetcenter+2 * height+ 2*marginbetween], width, height,
                                self.buttoncolor, self.hovercolor,
                                self.pressedcolor, self.inactivecolor, self._quit)
        self.buttonlist.append(quitbutton)
Ejemplo n.º 5
0
    def _createbuttons(self):
        # key as passing value
        for j, item in enumerate(self.items):
            dropdownitem = button(
                self._itemtotext(item), self.font,
                [self.pos[0], self.pos[1] + (self.h - 1) * (j + 1)], self.w,
                self.h, self.color, self.hovercolor, self.clickedcolor,
                self.hovercolor, self._dropbuttonspressed, j)
            self.buttons.append(dropdownitem)

            self.activerect = self.activerect.union(dropdownitem.rect)

        self._changeactive()
Ejemplo n.º 6
0
    def _createbuttons(self, tabnames):
        #create tabb buttons
        for index, item in enumerate(tabnames):
            xpos = (self.buttonwidth + 3) * index
            tabbutton = button(
                item, self.font,
                [self.pos[0] + self.buttonwidth / 2 + xpos, self.pos[1]],
                self.buttonwidth, self.uiheight, self.buttoncolor,
                self.hovercolor, self.pressedcolor, self.labelcolor,
                self._switchtab, index)
            self.buttons.append(tabbutton)
            self.tabbuttons.append(tabbutton)
        self.tabbuttons[0].active = False

        #create reset button
        ypos = self.pos[1] + (self.uiheight +
                              self.uimarginbetween) * (self.maxlength + 1)
        self.buttons.append(
            button("Reset", self.font, [self.pos[0] + self.uiwidth / 2, ypos],
                   self.buttonwidth, self.uiheight, self.buttoncolor,
                   self.hovercolor, self.pressedcolor, self.labelcolor,
                   self._resetsettings))