-
Notifications
You must be signed in to change notification settings - Fork 6
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
Error while running the code from text input tutorial #55
Comments
I get the same error. Commenting out the |
Sorry, this dropped off my radar. I'll try to look into in this weekend. |
Specifically, I've narrowed it down to EditableLabel as what's causing the issue. Even trying to use it on its own causes the ArgumentError. Replacing the EditableLabel in Form with Label also causes Form to stop breaking (though it does cause Form not to work in the expected manner). |
OK, so the specific issue here is that in pyglet's text/layout.py, a glScissor is called with (float, float, int, int), instead of (int, int, int, int). That is because the _clip_x and _clip_y, which is set from the rect, is float values. They're float values because in widget.py, line 1447, you do That's incorrect- if you look at vecrec/shapes.py line 709, which is Rect's round() function, it's this: def round(self, digits=0):
""" Round the dimensions of the given rectangle to the given number of digits. """
self._left = round(self._left, digits)
self._bottom = round(self._bottom, digits)
self._width = round(self._width, digits)
self._height = round(self._height, digits)
>>> round(5.3, 0)
5.0 What we actually need is for line 1447 to be replaced with aligned_rect._bottom = int(aligned_rect._bottom)
aligned_rect._height = int(aligned_rect._height)
aligned_rect._left = int(aligned_rect._left)
aligned_rect._width = int(aligned_rect._width) |
I've got an error while trying to run the code from the tutorial:
How to fix this error? I'm using Python 3.9.7, pyglet 1.5.21 and glooey 0.3.6.
The text was updated successfully, but these errors were encountered: