Skip to content

Commit

Permalink
Avoid importing GUI by default to avoid issues on headless systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjyoung committed Oct 7, 2021
1 parent 45cd8a9 commit 4f81cb8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ This is the simplest way to visualize the environments, unless you need to handl
### Using GUI class
We also include a slightly more complex GUI to visualize the environments and optionally handle user input. This GUI is used in examples/human_play.py to play as a human and examples/agent_play.py to visualize the performance of trained agents. To use the GUI you can import it in your code with:
```python
from minatar import GUI
from minatar.gui import GUI
```
Initialize an instance of the GUI class by providing a name for the window, and the integer number of input channels for the minatar environment to be visualized. For example:
```python
Expand Down
3 changes: 2 additions & 1 deletion examples/agent_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import torch
import argparse, numpy

from minatar import Environment, GUI
from minatar import Environment
from minatar.gui import GUI
from dqn import QNetwork, get_state
from AC_lambda import ACNetwork

Expand Down
3 changes: 2 additions & 1 deletion examples/human_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import argparse
import tkinter as Tk
from minatar import Environment, GUI
from minatar import Environment
from minatar.gui import GUI

################################################################################################################
# Script that allows a human to play any of the MinAtar games. Use arrow keys to move and space to fire.
Expand Down
3 changes: 1 addition & 2 deletions minatar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from .environment import Environment
from .gui import GUI
from .environment import Environment
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

setup(
name='MinAtar',
version='1.0.8',
version='1.0.9',
description='A miniaturized version of the arcade learning environment.',
url='https://github.com/kenjyoung/MinAtar',
author='Kenny Young',
Expand Down

1 comment on commit 4f81cb8

@kenjyoung
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing code using GUI class should replace "from minatar import GUI" with "from minatar.gui import GUI" to work with this version.

Please sign in to comment.