def __init__(self): MainWindow.__init__(self, title=f"Navy - v{__version__}", size=(1280, 720), resources=RESOURCES, config=WINDOW_CONFIG_FILE) self.bg = Image(RESOURCES.IMG["menu_bg"], size=self.size) self.logo = Image(RESOURCES.IMG["logo"]) Button.set_default_theme("default") Button.set_theme("default", { "bg": GREEN, "hover_bg": GREEN_LIGHT, "active_bg": GREEN_DARK, "highlight_color": YELLOW, "outline": 3, }) Button.set_theme("title", { "font": (None, 100), }) Button.set_theme("option", { "font": ("calibri", 30), }) Scale.set_default_theme("default") Scale.set_theme("default", { "color": TRANSPARENT, "scale_color": GREEN, "highlight_color": YELLOW, "outline": 3 }) params_for_dialogs = { "outline": 5, "hide_all_without": [self.bg, self.logo] } self.start_game = NavySetup() self.multiplayer_server = PlayerServer(self, **params_for_dialogs) self.multiplayer_client = PlayerClient(self, **params_for_dialogs) self.dialog_credits = Credits(self, **params_for_dialogs) self.menu_buttons = ButtonListVertical(offset=30) self.menu_buttons.add( Button(self, "Play against AI", theme="title", callback=lambda: self.start_game.start(1)), Button(self, "Play as P1", theme="title", callback=self.multiplayer_server.mainloop), Button(self, "Play as P2", theme="title", callback=self.multiplayer_client.mainloop), Button(self, "Quit", theme="title", callback=self.stop) ) self.button_credits = Button(self, "Credits", font=("calibri", 50), callback=self.dialog_credits.mainloop)
def __init__(self): MainWindow.__init__(self, title=f"4 in a row - v{__version__}", size=(1280, 720), bg_color=BACKGROUND_COLOR, resources=RESOURCES, config=WINDOW_CONFIG_FILE) self.logo = Image(RESOURCES.IMG["logo"]) Text.set_default_theme("default") Text.set_theme( "default", { "font": RESOURCES.font("heavy", 45), "color": YELLOW, "shadow": True, "shadow_x": 3, "shadow_y": 3 }) Text.set_theme("form", { "font": RESOURCES.font("heavy", 35), }) Button.set_default_theme("default") Button.set_theme( "default", { "fg": YELLOW, "disabled_fg": WHITE, "shadow": True, "shadow_x": 3, "shadow_y": 3, "bg": BLUE, "hover_bg": (0, 175, 255), "active_bg": BLUE, "outline": 0, "highlight_color": WHITE, "highlight_thickness": 1, "border_bottom_left_radius": 45, "border_top_right_radius": 45, "x_add_size": 150, "offset": (0, -5), "hover_offset": (-10, 0), "active_offset": (0, 10), }) Button.set_theme("title", { "font": RESOURCES.font("heavy", 70), "y_add_size": -50 }) Button.set_theme("option", { "font": RESOURCES.font("heavy", 40), "y_add_size": -20 }) Button.set_theme("section", { "bg": BLUE_DARK, "active_bg": BLUE_DARK, "disabled_bg": GRAY_LIGHT }) Entry.set_default_theme("default") Entry.set_theme( "default", { "width": 12, "font": RESOURCES.font("afterglow", 25), "highlight_color": BLACK, "highlight_thickness": 3 }) gameplay = FourInARowGameplay(self) ai_level_selector = AILevelSelectorSection(self, gameplay) local_playing = LocalPlayingSection(self, gameplay) lan_playing_server = LANPlayingP1(self, gameplay) lan_playing_client = LANPlayingP2(self, gameplay) self.buttons = ButtonListVertical(offset=80, justify="right") self.buttons.add( Button(self, "Play against AI", theme="title", callback=ai_level_selector.mainloop), Button(self, "Multiplayer", theme="title", callback=local_playing.mainloop), Button(self, "Play as P1 (LAN)", theme="title", callback=lan_playing_server.mainloop), Button(self, "Play as P2 (LAN)", theme="title", callback=lan_playing_client.mainloop), Button(self, "Quit", theme="title", callback=self.stop), )