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

Crash with minimal window size #54

Open
lordmauve opened this issue Jul 27, 2020 · 0 comments
Open

Crash with minimal window size #54

lordmauve opened this issue Jul 27, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@lordmauve
Copy link
Owner

In some cases pygame.display.set_mode() will return a size different to the one requested for reasons other than scaling. This can cause a crash:

Traceback (most recent call last):
  File "pingplot.py", line 16, in <module>
    scene = w2d.Scene(150, 100, title="Ping plot")
  File "C:\WorkFolders\mauve\My Documents\dev\pingplot\venv\lib\site-packages\wasabi2d\scene.py", line 94, in __init__
    ctx = self.ctx = self._make_context(width, height)
  File "C:\WorkFolders\mauve\My Documents\dev\pingplot\venv\lib\site-packages\wasabi2d\scene.py", line 176, in _make_context
    self.drawer = self._make_scaler(ctx, (width, height))
  File "C:\WorkFolders\mauve\My Documents\dev\pingplot\venv\lib\site-packages\wasabi2d\scene.py", line 185, in _make_scaler
    }[self._scaler]
KeyError: False

(I added some debug output. It turns out that this is because Windows has a certain minimum window width in order to fit the title bar controls.)

Traceback (most recent call last):
  File "pingplot.py", line 16, in <module>
    scene = w2d.Scene(150, 100, title="Ping plot")
  File "C:\WorkFolders\mauve\My Documents\dev\pingplot\venv\lib\site-packages\wasabi2d\scene.py", line 94, in __init__
    ctx = self.ctx = self._make_context(width, height)
  File "C:\WorkFolders\mauve\My Documents\dev\pingplot\venv\lib\site-packages\wasabi2d\scene.py", line 176, in _make_context
    self.drawer = self._make_scaler(ctx, (width, height))
  File "C:\WorkFolders\mauve\My Documents\dev\pingplot\venv\lib\site-packages\wasabi2d\scene.py", line 183, in _make_scaler
    f"No scaler set but display size {self._real_size} != "
KeyError: 'No scaler set but display size (176, 100) != requested size (150, 100)'
@lordmauve lordmauve added the bug Something isn't working label Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant