def __init__(self, filename, reveal_number):
        tk.Tk.__init__(self)

        tk.Tk.wm_title(self, "Catchphrase!")  # GUI title
        self.option_add("*Font", FONT)

        # Import image with catchphrase_main() function
        self.images = catchphrase_main(filename, reveal_number)
        # Rescale the image to make sure it is not too big for the screen
        self.images = self.image_rescale(self.images, IMG_MAX_DIMENSION)

        container = tk.Frame(self, padx=10, pady=10, bg=COLORS['highlight'])
        container.pack(expand=True)

        self.frames = {}
        # Frames/pages of the GUI
        for f in (StartPage, GamePage, FinalReveal):
            frame = f(container, self, self.images, reveal_number)
            self.frames[f] = frame
            frame.config(bg=COLORS['background'], padx=20, pady=20)
            frame.grid(row=0, column=0, sticky="nsew")
            # Center the frames
            frame.columnconfigure(0, weight=1)
            frame.columnconfigure(2, weight=1)
            frame.rowconfigure(0, weight=1)
            frame.rowconfigure(2, weight=1)

        self.show_frame(StartPage)
def test_catchphrase_image_color():
    # Test color image
    test_filename = 'test_image_color.jpeg'
    test_img = os.path.join(test_image_folder, test_filename)
    test_path = os.path.join('images', test_img)
    result = catchphrase_module.catchphrase_main(test_img)
    original_img = imageio.imread(test_path)
    assert (result[4] == original_img).all() == True
def test_catchphrase_image_bw():
    # Test greyscale image
    test_filename = 'test_image_greyscale.jpeg'
    test_img = os.path.join(test_image_folder, test_filename)
    test_path = os.path.join('images', test_img)
    result = catchphrase_module.catchphrase_main(test_img)
    # read original image
    original_img = imageio.imread(test_path)
    assert (result[4] == original_img).all() == True
def test_catchphrase_gui_invalid_too_bit_reveal_number():
    with pytest.raises(ValueError):
        catchphrase_module.catchphrase_main(filename, 10)
def test_catchphrase_gui_invalid_reveal_number():
    with pytest.raises(TypeError):
        catchphrase_module.catchphrase_main(filename, 'three')