def do_init(self, db): self.btn_exit = self.text_button(0, 0, 150, 40, "Exit") # self.btn_exit.set_color("lightblue", "black") self.btn_new_game = self.text_button(self.WIN_WIDTH - 150, 0, 150, 40, "Neues Spiel") x = 0 w = 200 self.players = [] for i, opt in enumerate([self.SETTING_PLAYER1, self.SETTING_PLAYER2]): profile_image = get_next_icon_filename(None) profile_image = self.get_setting(opt, profile_image) y = 100 name = self.text_button(x, y, w, 40, "") name.set_font(self.STATUS_FONT) y += 60 icon = get_icon(profile_image) btn = ImageButton(self.canvas, x, y, w, 150, icon) btn.set_color("black", "black") y += 150 now_lbl = self.text_button(x, y, w, 60, "0") now_lbl.set_font(self.STATUS_FONT) now_lbl.set_color("green", "black") y += 60 all_lbl = self.text_button(x, y, w, 60, "0") all_lbl.set_color("gray", "black") player = { "name": name, "profile": btn, "profile_image": profile_image, "now_lbl": now_lbl, "all_lbl": all_lbl, "all_cnt": 0, "now_cnt": 0, } self.players.append(player) x = self.WIN_WIDTH - w # explicitly set player profile images for player in self.players: self.__set_player_profile(player, player["profile_image"]) left = (self.WIN_WIDTH - Memory.SIZE * self.BTN_SIZE) / 2 self.buttons = [] x = left y = (self.WIN_HEIGHT - Memory.SIZE * self.BTN_SIZE) / 2 for i in range(Memory.SIZE ** 2): btn = ImageButton(self.canvas, x, y, self.BTN_SIZE, self.BTN_SIZE) btn.set_font(self.BIG_BUTTON_FONT) btn.set_color("gray", "#336699") self.buttons.append(btn) x += self.BTN_SIZE if ((i+1) % Memory.SIZE) == 0: x = left y += self.BTN_SIZE self.do_reset(None)