Skip to content

'tuple' object has no attribute 'x' #1479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alderven opened this issue Jan 26, 2023 · 7 comments
Closed

'tuple' object has no attribute 'x' #1479

alderven opened this issue Jan 26, 2023 · 7 comments

Comments

@alderven
Copy link

Steps to reproduce

Run code from the following example:
https://api.arcade.academy/en/latest/examples/sprite_move_scrolling_shake.html

Getting error:

"C:\Program Files\Python310\python.exe" D:\PROGRAMMING\temp\arcade_sprite_move_scrolling_shake\arcade_sprite_move_scrolling_shake.py 
Traceback (most recent call last):
  File "D:\PROGRAMMING\temp\arcade_sprite_move_scrolling_shake\arcade_sprite_move_scrolling_shake.py", line 224, in <module>
    main()
  File "D:\PROGRAMMING\temp\arcade_sprite_move_scrolling_shake\arcade_sprite_move_scrolling_shake.py", line 220, in main
    arcade.run()
  File "C:\Program Files\Python310\lib\site-packages\arcade\window_commands.py", line 323, in run
    pyglet.app.run()
  File "C:\Program Files\Python310\lib\site-packages\pyglet\app\__init__.py", line 107, in run
    event_loop.run(interval)
  File "C:\Program Files\Python310\lib\site-packages\pyglet\app\base.py", line 186, in run
    timeout = self.idle()
  File "C:\Program Files\Python310\lib\site-packages\pyglet\app\base.py", line 247, in idle
    self.clock.call_scheduled_functions(dt)
  File "C:\Program Files\Python310\lib\site-packages\pyglet\clock.py", line 262, in call_scheduled_functions
    item.func(now - item.last_ts, *item.args, **item.kwargs)
  File "C:\Program Files\Python310\lib\site-packages\arcade\application.py", line 318, in _dispatch_updates
    self.dispatch_event('on_update', delta_time)
  File "C:\Program Files\Python310\lib\site-packages\pyglet\window\__init__.py", line 1363, in dispatch_event
    super().dispatch_event(*args)
  File "C:\Program Files\Python310\lib\site-packages\pyglet\event.py", line 427, in dispatch_event
    raise e
  File "C:\Program Files\Python310\lib\site-packages\pyglet\event.py", line 422, in dispatch_event
    if getattr(self, event_type)(*args):
  File "D:\PROGRAMMING\temp\arcade_sprite_move_scrolling_shake\arcade_sprite_move_scrolling_shake.py", line 185, in on_update
    self.camera_sprites.shake(shake_vector,
  File "C:\Program Files\Python310\lib\site-packages\arcade\camera.py", line 152, in shake
    self.shake_velocity += velocity
  File "C:\Program Files\Python310\lib\site-packages\pyglet\math.py", line 106, in __add__
    return Vec2(self.x + other.x, self.y + other.y)
AttributeError: 'tuple' object has no attribute 'x'

System Info

OS: Win 11
Python: 3.10
Arcade: 2.6.17

@einarf
Copy link
Member

einarf commented Jan 27, 2023

That looks like a mismatching pyglet version. you should have 2.0.dev23 installed. Optionally just grab the latest 2.7 version.

@alderven
Copy link
Author

That looks like a mismatching pyglet version. you should have 2.0.dev23 installed. Optionally just grab the latest 2.7 version.

I do have pyglet 2.0.3 installed. Didn't help.

@einarf
Copy link
Member

einarf commented Jan 27, 2023

Well. If you are using 2.6.17 the package requirements states only pyglet 2.0.dev23 works. If you do a pip install -I arcade==2.6.17 it should downgrade your pyglet version.

If you want to use pylget 2.0.3 you need to use the latest development branch.

You should have seen a lot of stern warnings from pip about the mismatching pyglet version.

@alderven
Copy link
Author

I've downgraded pyglet and Arcade window is running now but when the player touches the bombs, same error appears:

AttributeError: 'tuple' object has no attribute 'x'

@einarf
Copy link
Member

einarf commented Jan 28, 2023

Are you absolutely sure you have the right pyglet version? What did pip list show? This should not happen unless you ingore some stern warnings during arcade install.

@alderven
Copy link
Author

Are you absolutely sure you have the right pyglet version? What did pip list show? This should not happen unless you ingore some stern warnings during arcade install.

pip list shows me following:

Package                   Version
------------------------- -----------
arcade                    2.6.17
pyglet                    2.0.dev23

Can you check on your side that colliding with bomb does not throw you this error?

@pvcraven
Copy link
Member

The example code is outdated. It needs these changes. Thanks for the report, we'll work at getting that updated.

pvcraven added a commit that referenced this issue Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants