Repository: openai/gym

Issue:
[Bug Report] Non-Integer smaller_cell_scale causes FrozenLake to crash on Render
If you are submitting a bug report, please fill in the following details and use the tag [bug].

**Describe the bug**

A clear and concise description of what the bug is.

**Code example**

On a Mac running python3:

```
import gym # loading the Gym library
env = gym.make("FrozenLake-v1")
env.reset()                    
while(True):
    env.render()
```

crashes with error:

 start_img = pygame.transform.scale(self.start_img, (small_cell_w, small_cell_h))
TypeError: integer argument expected, got float


**System Info**
Describe the characteristic of your environment:

MacOS running Python 3.8


**Additional context**

I could eliminate the problem by manually changing smaller_cell_scale to 1

### Checklist

- [x] I have checked that there is no similar [issue](https://github.com/openai/gym/issues) in the repo (**required**)

[Bug Report] Non-Integer smaller_cell_scale causes FrozenLake to crash on Render
If you are submitting a bug report, please fill in the following details and use the tag [bug].

**Describe the bug**

A clear and concise description of what the bug is.

**Code example**

On a Mac running python3:

```
import gym # loading the Gym library
env = gym.make("FrozenLake-v1")
env.reset()                    
while(True):
    env.render()
```

crashes with error:

 start_img = pygame.transform.scale(self.start_img, (small_cell_w, small_cell_h))
TypeError: integer argument expected, got float


**System Info**
Describe the characteristic of your environment:

MacOS running Python 3.8


**Additional context**

I could eliminate the problem by manually changing smaller_cell_scale to 1

### Checklist

- [x] I have checked that there is no similar [issue](https://github.com/openai/gym/issues) in the repo (**required**)



Discussion:
I have run this with the current main branch on MacOS, Python 3.9 and pygame 2.1.2 and I can't replicate this issue

Are you running on the latest gym and pygame version? 

I have run this with the current main branch on MacOS, Python 3.9 and pygame 2.1.2 and I can't replicate this issue

Are you running on the latest gym and pygame version? 


Resolving patch:
diff --git a/gym/envs/toy_text/frozen_lake.py b/gym/envs/toy_text/frozen_lake.py
--- a/gym/envs/toy_text/frozen_lake.py
+++ b/gym/envs/toy_text/frozen_lake.py
@@ -276,12 +276,11 @@ def _render_gui(self, desc, mode):
             ]
             self.elf_images = [pygame.image.load(f_name) for f_name in elfs]
 
-        board = pygame.Surface(self.window_size, flags=SRCALPHA)
         cell_width = self.window_size[0] // self.ncol
         cell_height = self.window_size[1] // self.nrow
         smaller_cell_scale = 0.6
-        small_cell_w = smaller_cell_scale * cell_width
-        small_cell_h = smaller_cell_scale * cell_height
+        small_cell_w = int(smaller_cell_scale * cell_width)
+        small_cell_h = int(smaller_cell_scale * cell_height)
 
         # prepare images
         last_action = self.lastaction if self.lastaction is not None else 1
@@ -319,7 +318,7 @@ def _render_gui(self, desc, mode):
                 else:
                     self.window_surface.blit(ice_img, (rect[0], rect[1]))
 
-                pygame.draw.rect(board, (180, 200, 230), rect, 1)
+                pygame.draw.rect(self.window_surface, (180, 200, 230), rect, 1)
 
         # paint the elf
         bot_row, bot_col = self.s // self.ncol, self.s % self.ncol
@@ -335,7 +334,6 @@ def _render_gui(self, desc, mode):
             elf_rect = self._center_small_rect(cell_rect, elf_img.get_size())
             self.window_surface.blit(elf_img, elf_rect)
 
-        self.window_surface.blit(board, board.get_rect())
         if mode == "human":
             pygame.event.pump()
             pygame.display.update()


Test patch: