def load_rules_screen(self) -> None: self.rules_title_text = Text( text=self.settings["rules_title_text_text"], width=self.settings["rules_title_text_width"], height=self.settings["rules_title_text_height"], position_x=self.settings["rules_title_text_pos_x"], position_y=self.settings["rules_title_text_pos_y"], text_font=self.settings["rules_title_text_text_font"], text_size=self.settings["rules_title_text_text_size"], screen=self.screen, text_color=tuple(self.settings["rules_title_text_text_color"])) self.back_button = Button( text=self.settings["back_button_text"], width=self.settings["back_button_width"], height=self.settings["back_button_height"], position_x=self.settings["back_button_pos_x"], position_y=self.settings["back_button_pos_y"], text_font=self.settings["back_button_text_font"], text_size=self.settings["back_button_text_size"], screen=self.screen, button_color=tuple(self.settings["back_button_color"]), text_color=tuple(self.settings["back_button_text_color"])) self.rules_text = Text( text=load_text(self.settings["rules_text_path"]), width=self.settings["rules_text_box_width"], height=self.settings["rules_text_box_height"], position_x=self.settings["rules_text_box_pos_x"], position_y=self.settings["rules_text_box_pos_y"], text_font=self.settings["rules_text_box_text_font"], text_size=self.settings["rules_text_box_text_size"], screen=self.screen, text_color=tuple(self.settings["rules_text_box_text_color"])) self.copyright_button = Button( text=self.settings["copyright_button_text"], width=self.settings["copyright_button_width"], height=self.settings["copyright_button_height"], position_x=self.settings["copyright_button_pos_x"], position_y=self.settings["copyright_button_pos_y"], text_font=self.settings["copyright_button_text_font"], text_size=self.settings["copyright_button_text_size"], screen=self.screen, button_color=tuple(self.settings["copyright_button_color"]), text_color=tuple(self.settings["copyright_button_text_color"])) self.rules_title_text.draw_text() self.back_button.draw_button() self.rules_text.draw_text() self.copyright_button.draw_button() pygame.display.flip()
def draw_text(x, y, t: str, style: str = 'normal', fg=None, bg=None, alpha=1.0, *args, **kwargs): label = Text(game, x, win.height - y, t, style, fg, bg, alpha=alpha) label.draw()
def load_game_screen(self) -> None: self.game_board = Board(width=self.settings["board_width"], height=self.settings["board_height"], position_x=self.settings["board_pos_x"], position_y=self.settings["board_pos_y"], screen=self.screen, board_color=tuple( self.settings["board_color"])) self.log_screen_title_text = Text( text=self.settings["log_screen_title_text_text"], width=self.settings["log_screen_title_text_width"], height=self.settings["log_screen_title_text_height"], position_x=self.settings["log_screen_title_text_pos_x"], position_y=self.settings["log_screen_title_text_pos_y"], text_font=self.settings["log_screen_title_text_text_font"], text_size=self.settings["log_screen_title_text_text_size"], screen=self.screen, text_color=tuple( self.settings["log_screen_title_text_text_color"])) self.log_screen = LogScreen( width=self.settings["log_screen_width"], height=self.settings["log_screen_height"], position_x=self.settings["log_screen_pos_x"], position_y=self.settings["log_screen_pos_y"], log_text=self.settings["log_screen_log_text"], text_font=self.settings["log_screen_text_font"], text_size=self.settings["log_screen_text_size"], screen=self.screen, log_screen_color=tuple(self.settings["log_screen_color"]), log_screen_text_color=tuple( self.settings["log_screen_text_color"])) self.confirm_button = Button( text=self.settings["confirm_button_text"], width=self.settings["confirm_button_width"], height=self.settings["confirm_button_height"], position_x=self.settings["confirm_button_pos_x"], position_y=self.settings["confirm_button_pos_y"], text_font=self.settings["confirm_button_text_font"], text_size=self.settings["confirm_button_text_size"], screen=self.screen, button_color=tuple(self.settings["confirm_button_color"]), text_color=tuple(self.settings["confirm_button_text_color"])) self.game_board.draw_board() self.log_screen.draw_log_screen() self.log_screen_title_text.draw_text() self.confirm_button.draw_button() pygame.display.flip()
'_6': '6', '_7': '7', '_8': '8', '_9': '9', } strkey = str(window.key.symbol_string(key)).lower() strkey = keymap.get(strkey, strkey) game.on_key_pressed(strkey) l_title = Text(game, win.width // 2, win.height - 20, 'Welcome to Super F**k You', 'normal', fg=0, bg=7) def draw_text(x, y, t: str, style: str = 'normal', fg=None, bg=None, alpha=1.0, *args, **kwargs):
def load_title_screen(self) -> None: self.game_title = Text(text=self.settings["title_text_text"], width=self.settings["title_text_width"], height=self.settings["title_text_height"], position_x=self.settings["title_text_pos_x"], position_y=self.settings["title_text_pos_y"], text_font=self.settings["title_text_text_font"], text_size=self.settings["title_text_text_size"], screen=self.screen, text_color=tuple( self.settings["title_text_text_color"])) self.play_button = Button( text=self.settings["start_button_text"], width=self.settings["start_button_width"], height=self.settings["start_button_height"], position_x=self.settings["start_button_pos_x"], position_y=self.settings["start_button_pos_y"], text_font=self.settings["start_button_text_font"], text_size=self.settings["start_button_text_size"], screen=self.screen, button_color=tuple(self.settings["start_button_color"]), text_color=tuple(self.settings["start_button_text_color"])) self.rules_button = Button( text=self.settings["rules_button_text"], width=self.settings["rules_button_width"], height=self.settings["rules_button_height"], position_x=self.settings["rules_button_pos_x"], position_y=self.settings["rules_button_pos_y"], text_font=self.settings["rules_button_text_font"], text_size=self.settings["rules_button_text_size"], screen=self.screen, button_color=tuple(self.settings["rules_button_color"]), text_color=tuple(self.settings["rules_button_text_color"])) self.quit_button = Button( text=self.settings["quit_button_text"], width=self.settings["quit_button_width"], height=self.settings["quit_button_height"], position_x=self.settings["quit_button_pos_x"], position_y=self.settings["quit_button_pos_y"], text_font=self.settings["quit_button_text_font"], text_size=self.settings["quit_button_text_size"], screen=self.screen, button_color=tuple(self.settings["quit_button_color"]), text_color=tuple(self.settings["quit_button_text_color"])) self.copyright_button = Button( text=self.settings["copyright_button_text"], width=self.settings["copyright_button_width"], height=self.settings["copyright_button_height"], position_x=self.settings["copyright_button_pos_x"], position_y=self.settings["copyright_button_pos_y"], text_font=self.settings["copyright_button_text_font"], text_size=self.settings["copyright_button_text_size"], screen=self.screen, button_color=tuple(self.settings["copyright_button_color"]), text_color=tuple(self.settings["copyright_button_text_color"])) self.game_title.draw_text() self.play_button.draw_button() self.rules_button.draw_button() self.copyright_button.draw_button() self.quit_button.draw_button() pygame.display.flip()
def load_middle_screen(self) -> None: self.game_title = Text(text=self.settings["title_text_text"], width=self.settings["title_text_width"], height=self.settings["title_text_height"], position_x=self.settings["title_text_pos_x"], position_y=self.settings["title_text_pos_y"], text_font=self.settings["title_text_text_font"], text_size=self.settings["title_text_text_size"], screen=self.screen, text_color=tuple( self.settings["title_text_text_color"])) self.play_button = Button( text=self.settings["play_button_text"], width=self.settings["play_button_width"], height=self.settings["play_button_height"], position_x=self.settings["play_button_pos_x"], position_y=self.settings["play_button_pos_y"], text_font=self.settings["play_button_text_font"], text_size=self.settings["play_button_text_size"], screen=self.screen, button_color=tuple(self.settings["play_button_color"]), text_color=tuple(self.settings["play_button_text_color"])) self.back_button = Button( text=self.settings["middle_back_button_text"], width=self.settings["middle_back_button_width"], height=self.settings["middle_back_button_height"], position_x=self.settings["middle_back_button_pos_x"], position_y=self.settings["middle_back_button_pos_y"], text_font=self.settings["middle_back_button_text_font"], text_size=self.settings["middle_back_button_text_size"], screen=self.screen, button_color=tuple(self.settings["middle_back_button_color"]), text_color=tuple(self.settings["middle_back_button_text_color"])) self.name_inputbox = InputBox( standard_text=self.settings["name_inputbox_standard_text"], width=self.settings["name_inputbox_width"], height=self.settings["name_inputbox_height"], position_x=self.settings["name_inputbox_pos_x"], position_y=self.settings["name_inputbox_pos_y"], text_font=self.settings["name_inputbox_text_font"], text_size=self.settings["name_inputbox_text_size"], max_character=self.settings["name_inputbox_max_character"], border_size=self.settings["name_inputbox_border_size"], border_color=self.settings["name_inputbox_border_color"], screen=self.screen, active_color=self.settings["name_inputbox_active_color"], inactive_color=self.settings["name_inputbox_inactive_color"], text_color=self.settings["name_inputbox_text_color"]) self.copyright_button = Button( text=self.settings["copyright_button_text"], width=self.settings["copyright_button_width"], height=self.settings["copyright_button_height"], position_x=self.settings["copyright_button_pos_x"], position_y=self.settings["copyright_button_pos_y"], text_font=self.settings["copyright_button_text_font"], text_size=self.settings["copyright_button_text_size"], screen=self.screen, button_color=tuple(self.settings["copyright_button_color"]), text_color=tuple(self.settings["copyright_button_text_color"])) self.game_title.draw_text() self.play_button.draw_button() self.back_button.draw_button() self.name_inputbox.draw_inputbox() self.copyright_button.draw_button() pygame.display.flip()
def getTweetText(self, tweetIndex): tweetLocator = MainPageLocators.STREAM_TWEETS + "[%s]" % tweetIndex + MainPageLocators.TEXT_IN_TWEET tweetText = Text(self.driver, tweetLocator) return tweetText.getText()