You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Mike, I'm having an issue with the plot_board() function. I have followed the instructions in your video and logged in with -x to enable X11 forwarding; despite this, I am still running into an issue with the $DISPLAY variable. I even tried to use -y to no desired effect.
Here is my code:
from risk.board import Board,Territory
import copy
# define boards for the tests
# HINT: I recommend you plot these boards
board0 = Board([Territory(territory_id=i, player_id=1, armies=i%5+1) for i in range(42)])
board1 = copy.deepcopy(board0)
board1.set_owner(3,0)
board1.set_armies(3,500)
board1.set_armies(4,500)
board1.set_armies(34,500)
board1.set_armies(39,500)
board1.set_armies(35,500)
board2 = copy.deepcopy(board1)
board2.set_owner(34, 0)
board2.set_armies(34,1)
board2.set_owner(35, 0)
board2.set_armies(35,1)
board2.set_owner(39, 0)
board2.set_armies(39,1)
board3 = copy.deepcopy(board2)
board3.set_owner(34, 1)
board4 = copy.deepcopy(board2)
board4.set_owner(4, 0)
board4.set_armies(4, 1)
board4.set_owner(1, 0)
board5 = Board([Territory(territory_id=i, player_id=i%5, armies=i%5+1) for i in range(42)])
Like pulsar-heart in Issue #525, when I run this file, I receive a similar error code:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/Adam.Terenyi.25/risk/risk/board.py", line 410, in plot_board
fig, ax = plt.subplots(figsize=(img_width/dpi, 300/dpi), dpi=dpi)
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 1176, in subplots
fig = figure(**fig_kw)
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 539, in figure
**kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 171, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 1049, in new_figure_manager_given_figure
window = Tk.Tk(className="matplotlib")
File "/usr/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
I have no idea what to do, as I have tried to fix this using online tutorials and have followed your instructions.
Thank you.
The text was updated successfully, but these errors were encountered:
Hey Mike, I'm having an issue with the
plot_board()
function. I have followed the instructions in your video and logged in with-x
to enable X11 forwarding; despite this, I am still running into an issue with the$DISPLAY
variable. I even tried to use-y
to no desired effect.Here is my code:
Like pulsar-heart in Issue #525, when I run this file, I receive a similar error code:
I have no idea what to do, as I have tried to fix this using online tutorials and have followed your instructions.
Thank you.
The text was updated successfully, but these errors were encountered: