1

I just installed Python 3 and the arcade module on my MacBook and am trying to follow a simple Hello World tutorial: https://opensource.com/article/18/4/easy-2d-game-creation-python-and-arcade

Importing arcade works, but as soon as I put add the next line to open a blank window, it only returns an AttributeError:

Traceback (most recent call last):
  File "/Users/nitrox/Code/spielereien/arc-test.py", line 2, in <module>
    arcade.open_window(600, 300, "Drawing Example")
  File "/usr/local/lib/python3.7/site-packages/arcade/application.py", line 384, in open_window
    _window = Window(width, height, window_title, resizable, update_rate=None)
  File "/usr/local/lib/python3.7/site-packages/arcade/application.py", line 53, in __init__
    resizable=resizable, config=config)
  File "/usr/local/lib/python3.7/site-packages/pyglet/window/__init__.py", line 643, in __init__
    self._create()
  File "/usr/local/lib/python3.7/site-packages/arcade/monkey_patch_pyglet.py", line 81, in _create
    self.context.attach(self.canvas)
  File "/usr/local/lib/python3.7/site-packages/pyglet/gl/cocoa.py", line 289, in attach
    self._nscontext.setView_(canvas.nsview)
AttributeError: 'NoneType' object has no attribute 'setView_'

Unfortunately the solution suggested in AttributeError with Pyglet and https://github.com/pvcraven/arcade/issues/264 didn't work. I don't have any files named arcade.py etc in my working directory.

How can I make this work?

Code:

import arcade

arcade.open_window(600, 600, "Drawing Example")
arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE)
arcade.start_render()
arcade.draw_lrtb_rectangle_filled(5, 35, 590, 570, arcade.color.BITTER_LIME)
arcade.finish_render()
arcade.run()
Alderven
  • 7,569
  • 5
  • 26
  • 38
DK2AX
  • 265
  • 5
  • 16

1 Answers1

2

The problem seems to be the specific version of arcade (2.0.1). I have removed the current version:

pip3 uninstall arcade

and re-installed the previous version (2.0.0):

pip3 install arcade==2.0.0

This fixes the problem and runs the example.

DK2AX
  • 265
  • 5
  • 16