Skip to content
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

AttributeError: 'Window' object has no attribute 'get_viewport_size' on Ubuntu 18.04 LTS (64-Bit) with system-provided pyglet package #102

Open
juozaspo opened this issue Jul 30, 2019 · 3 comments

Comments

@juozaspo
Copy link

juozaspo commented Jul 30, 2019

While trying to run the game in Ubuntu Linux 18.04 (64-bit) with system-provided pyglet package (python-pyglet), game fails with the following error:

$ python main.py 
Traceback (most recent call last):
  File "main.py", line 902, in <module>
    main()
  File "main.py", line 898, in main
    pyglet.app.run()
  File "/usr/lib/python2.7/dist-packages/pyglet/app/__init__.py", line 138, in run
    event_loop.run()
  File "/usr/lib/python2.7/dist-packages/pyglet/app/base.py", line 142, in run
    self._run()
  File "/usr/lib/python2.7/dist-packages/pyglet/app/base.py", line 154, in _run
    timeout = self.idle()
  File "/usr/lib/python2.7/dist-packages/pyglet/app/base.py", line 281, in idle
    window.dispatch_event('on_draw')
  File "/usr/lib/python2.7/dist-packages/pyglet/window/__init__.py", line 1220, in dispatch_event
    if EventDispatcher.dispatch_event(self, *args) != False:
  File "/usr/lib/python2.7/dist-packages/pyglet/event.py", line 367, in dispatch_event
    if getattr(self, event_type)(*args):
  File "main.py", line 814, in on_draw
    self.set_3d()
  File "main.py", line 796, in set_3d
    viewport = self.get_viewport_size()
AttributeError: 'Window' object has no attribute 'get_viewport_size'

Pyglet and other package versions to be installed in ubuntu

libjs-underscore 1.8.3~dfsg-1
libjs-sphinxdoc 1.6.7-1ubuntu1
python-configparser 3.5.0-1
python-future 0.15.2-4ubuntu2
python-pyglet 1.3.0-1

After uninstalling system-provided pyglet package and installing pyglet through pip game works fine, also pip provides newer versions (pyglet-1.4.1 and future-0.17.1) instead.

@jakubthedeveloper
Copy link

I created a pull request that fixes this problem: #109
It is not a perfect solution, because it uses window size, not viewport size, but it works for me.

@OneSharpAce
Copy link
Contributor

I'll look into this later today. Your commit unfortunately reverts the commit I made 8 months ago to fix an issue that using window size causes on Mac. It shouldn't be to much trouble to implement a check and apply different solutions so that one package can work for both Mac and Linux.

@jakubthedeveloper
Copy link

I think you can check if method get_viewport_size exists and depending on the result of the check use this method or window size.

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