コード例 #1
0
    def __init__(self):
        self.turn = 0
        self.stop = False
        self.simulate_games = 0

        self.players = {}
        self.end = False
        self.current_player_id = None
        self.current_coord = {}

        root = Tk()
        root.option_add("*font", DEFAULT_FONT)
        root.option_add("*foreground", DEFAULT_FONT_COLOUR)

        # Default root attributes
        width = (SQUARE_SIZE + SQUARE_DST) * 3
        height = width + 2 * SQUARE_SIZE

        root.configure(bg=BG_COLOUR)
        root.geometry(str(width) + "x" + str(height) + WINDOW_COORD)
        root.title("TicTacToe")
        root.iconbitmap("Images/game_icon.ico")
        root.bind("<Key>", self.key_listener)

        self.state = State(root, "Settings")

        settings_state = self.state.states[STATES[SETTINGS]]
        settings_state.start_button.configure(command=self.start_game)

        root.mainloop()