gym_splendor_code/envs/graphics/splendor_gui.py
def draw_card(self,
                      card: Card,
                      x_coord: int,
                      y_coord: int,
                      draw_buy_button: bool,
                      draw_reserve_button: bool,
                      state: State) -> None:

            """Draws a card in the main window.

            Parameters:
            _ _ _ _ _ _
            card: Card to draw.
            x_coord: Horizontal coordinate (from top left corner)
            y_coord: Vertical coordinate (from top left corner)
            draw_buy_button: Determines if create a buy action button associated with this card.
            draw_reserve_button: Determines if create a reserve action button associated with this card"""

            self.main_canvas.create_rectangle(x_coord, y_coord, x_coord + CARD_WIDTH, y_coord + CARD_HEIGHT,
                                              fill=CARD_BACKGROUND)
            self.main_canvas.create_text(x_coord + VICTORY_POINT_POSITION_X, y_coord + VICTORY_POINT_POSITION_Y,
                                         fill=CARD_VICTORY_POINTS_FONT_COLOR,
                                         font=CARD_VICTORY_POINTS_FONT, text=str(card.victory_points))

            self.main_canvas.create_rectangle(x_coord + PROFIT_BOX_POSITION_X, y_coord + PROFIT_BOX_POSITION_Y,
                                              x_coord + PROFIT_BOX_POSITION_X + PROFIT_BOX_SIZE,
                                              y_coord + PROFIT_BOX_POSITION_Y + PROFIT_BOX_SIZE,
                                              fill=color_dict_tkiter[card.discount_profit])
            self.main_canvas.create_line(x_coord + LINE_X, y_coord + LINE_Y,
                                         x_coord + LINE_X + LINE_LENGTH, y_coord + LINE_Y)
            for color_index, color in enumerate(card.price.non_empty_stacks()):
                position_index = 4 - color_index
                self.main_canvas.create_oval(x_coord + PRICE_COIN_START_X,
                                             y_coord + PRICE_COIN_START_Y +
                                             PRICE_COIN_SHIFT * position_index,
                                             x_coord + PRICE_COIN_START_X +
                                             PRICE_COIN_SIZE,
                                             y_coord + PRICE_COIN_START_Y +
                                             PRICE_COIN_SIZE +
                                             PRICE_COIN_SHIFT * position_index,
                                             fill=color_dict_tkiter[color])

                self.main_canvas.create_text(x_coord + PRICE_VALUE_X, y_coord + PRICE_VALUE_Y +
                                             PRICE_COIN_SHIFT * position_index, font=CARD_PRICE_FONT,
                                             fill=CARD_PRICE_FONT_COLOR, text=str(card.price.value(color)))

                self.main_canvas.create_text(x_coord + CARD_NAME_POSITION_X, y_coord + CARD_NAME_POSITION_Y,
                                             text=card.name, fill=CARD_NAME_COLOR, font=CARD_NAME_FONT)

            if draw_buy_button:
                buy_button = Button(self.main_window, font=BUY_BUTTON_FONT, text=BUY_BUTTON_TITLE,
                                    command=lambda: self.prepare_to_buy(card, state))
                buy_button.place(x=x_coord + BUY_BUTTON_X, y=y_coord + BUY_BUTTON_Y)
                self.drawn_buttons.add(buy_button)

            if draw_reserve_button:
                reserve_button = Button(self.main_window, font=RESERVE_BUTTON_FONT, text=RESERVE_BUTTON_TITLE,
                                        command=lambda: self.prepare_to_reserve(card, state))
                reserve_button.place(x=x_coord + RESERVE_BUTTON_X, y=y_coord + RESERVE_BUTTON_Y)
                self.drawn_buttons.add(reserve_button)
Draws a card in the main window.

            Parameters:
            _ _ _ _ _ _
            card: Card to draw.
            x_coord: Horizontal coordinate (from top left corner)
            y_coord: Vertical coordinate (from top left corner)
            draw_buy_button: Determines if create a buy action button associated with this card.
            draw_reserve_button: Determines if create a reserve action button associated with this card
Draws a card in the main window.
Parameters:
card: Card to draw.
x_coord: Horizontal coordinate (from top left corner)
y_coord: Vertical coordinate (from top left corner)
draw_buy_button: Determines if create a buy action button associated with this card.
draw_reserve_button: Determines if create a reserve action button associated with this card
Draws a card in the main window . Parameters : card : Card to draw . x_coord : Horizontal coordinate ( from top left corner ) y_coord : Vertical coordinate ( from top left corner ) draw_buy_button : Determines if create a buy action button associated with this card . draw_reserve_button : Determines if create a reserve action button associated with this card
def draw_card(self,
                      card: Card,
                      x_coord: int,
                      y_coord: int,
                      draw_buy_button: bool,
                      draw_reserve_button: bool,
                      state: State) -> None:
            self.main_canvas.create_rectangle(x_coord, y_coord, x_coord + CARD_WIDTH, y_coord + CARD_HEIGHT,
                                              fill=CARD_BACKGROUND)
            self.main_canvas.create_text(x_coord + VICTORY_POINT_POSITION_X, y_coord + VICTORY_POINT_POSITION_Y,
                                         fill=CARD_VICTORY_POINTS_FONT_COLOR,
                                         font=CARD_VICTORY_POINTS_FONT, text=str(card.victory_points))
            self.main_canvas.create_rectangle(x_coord + PROFIT_BOX_POSITION_X, y_coord + PROFIT_BOX_POSITION_Y,
                                              x_coord + PROFIT_BOX_POSITION_X + PROFIT_BOX_SIZE,
                                              y_coord + PROFIT_BOX_POSITION_Y + PROFIT_BOX_SIZE,
                                              fill=color_dict_tkiter[card.discount_profit])
            self.main_canvas.create_line(x_coord + LINE_X, y_coord + LINE_Y,
                                         x_coord + LINE_X + LINE_LENGTH, y_coord + LINE_Y)
            for color_index, color in enumerate(card.price.non_empty_stacks()):
                position_index = 4 - color_index
                self.main_canvas.create_oval(x_coord + PRICE_COIN_START_X,
                                             y_coord + PRICE_COIN_START_Y +
                                             PRICE_COIN_SHIFT * position_index,
                                             x_coord + PRICE_COIN_START_X +
                                             PRICE_COIN_SIZE,
                                             y_coord + PRICE_COIN_START_Y +
                                             PRICE_COIN_SIZE +
                                             PRICE_COIN_SHIFT * position_index,
                                             fill=color_dict_tkiter[color])
                self.main_canvas.create_text(x_coord + PRICE_VALUE_X, y_coord + PRICE_VALUE_Y +
                                             PRICE_COIN_SHIFT * position_index, font=CARD_PRICE_FONT,
                                             fill=CARD_PRICE_FONT_COLOR, text=str(card.price.value(color)))
                self.main_canvas.create_text(x_coord + CARD_NAME_POSITION_X, y_coord + CARD_NAME_POSITION_Y,
                                             text=card.name, fill=CARD_NAME_COLOR, font=CARD_NAME_FONT)
            if draw_buy_button:
                buy_button = Button(self.main_window, font=BUY_BUTTON_FONT, text=BUY_BUTTON_TITLE,
                                    command=lambda: self.prepare_to_buy(card, state))
                buy_button.place(x=x_coord + BUY_BUTTON_X, y=y_coord + BUY_BUTTON_Y)
                self.drawn_buttons.add(buy_button)
            if draw_reserve_button:
                reserve_button = Button(self.main_window, font=RESERVE_BUTTON_FONT, text=RESERVE_BUTTON_TITLE,
                                        command=lambda: self.prepare_to_reserve(card, state))
                reserve_button.place(x=x_coord + RESERVE_BUTTON_X, y=y_coord + RESERVE_BUTTON_Y)
                self.drawn_buttons.add(reserve_button)
def draw_card ( self , card : Card , x_coord : int , y_coord : int , draw_buy_button : bool , draw_reserve_button : bool , state : State ) -> None : self . main_canvas . create_rectangle ( x_coord , y_coord , x_coord + CARD_WIDTH , y_coord + CARD_HEIGHT , fill = CARD_BACKGROUND ) self . main_canvas . create_text ( x_coord + VICTORY_POINT_POSITION_X , y_coord + VICTORY_POINT_POSITION_Y , fill = CARD_VICTORY_POINTS_FONT_COLOR , font = CARD_VICTORY_POINTS_FONT , text = str ( card . victory_points ) ) self . main_canvas . create_rectangle ( x_coord + PROFIT_BOX_POSITION_X , y_coord + PROFIT_BOX_POSITION_Y , x_coord + PROFIT_BOX_POSITION_X + PROFIT_BOX_SIZE , y_coord + PROFIT_BOX_POSITION_Y + PROFIT_BOX_SIZE , fill = color_dict_tkiter [ card . discount_profit ] ) self . main_canvas . create_line ( x_coord + LINE_X , y_coord + LINE_Y , x_coord + LINE_X + LINE_LENGTH , y_coord + LINE_Y ) for color_index , color in enumerate ( card . price . non_empty_stacks ( ) ) : position_index = 4 - color_index self . main_canvas . create_oval ( x_coord + PRICE_COIN_START_X , y_coord + PRICE_COIN_START_Y + PRICE_COIN_SHIFT * position_index , x_coord + PRICE_COIN_START_X + PRICE_COIN_SIZE , y_coord + PRICE_COIN_START_Y + PRICE_COIN_SIZE + PRICE_COIN_SHIFT * position_index , fill = color_dict_tkiter [ color ] ) self . main_canvas . create_text ( x_coord + PRICE_VALUE_X , y_coord + PRICE_VALUE_Y + PRICE_COIN_SHIFT * position_index , font = CARD_PRICE_FONT , fill = CARD_PRICE_FONT_COLOR , text = str ( card . price . value ( color ) ) ) self . main_canvas . create_text ( x_coord + CARD_NAME_POSITION_X , y_coord + CARD_NAME_POSITION_Y , text = card . name , fill = CARD_NAME_COLOR , font = CARD_NAME_FONT ) if draw_buy_button : buy_button = Button ( self . main_window , font = BUY_BUTTON_FONT , text = BUY_BUTTON_TITLE , command = lambda : self . prepare_to_buy ( card , state ) ) buy_button . place ( x = x_coord + BUY_BUTTON_X , y = y_coord + BUY_BUTTON_Y ) self . drawn_buttons . add ( buy_button ) if draw_reserve_button : reserve_button = Button ( self . main_window , font = RESERVE_BUTTON_FONT , text = RESERVE_BUTTON_TITLE , command = lambda : self . prepare_to_reserve ( card , state ) ) reserve_button . place ( x = x_coord + RESERVE_BUTTON_X , y = y_coord + RESERVE_BUTTON_Y ) self . drawn_buttons . add ( reserve_button )
Draws a card in the main window.
Draws a card in the main window .
"""Draws a card in the main window.

            Parameters:
            _ _ _ _ _ _
            card: Card to draw.
            x_coord: Horizontal coordinate (from top left corner)
            y_coord: Vertical coordinate (from top left corner)
            draw_buy_button: Determines if create a buy action button associated with this card.
            draw_reserve_button: Determines if create a reserve action button associated with this card"""
self
card
Card
x_coord
int
y_coord
int
draw_buy_button
bool
draw_reserve_button
bool
state
State