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

Make arcade 2.x python 3.12 compatible #1953

Open
einarf opened this issue Jan 16, 2024 · 8 comments
Open

Make arcade 2.x python 3.12 compatible #1953

einarf opened this issue Jan 16, 2024 · 8 comments
Milestone

Comments

@einarf
Copy link
Member

einarf commented Jan 16, 2024

Bumping some depedencies with minor code changes is the only thing needed to make this happen.

See #1950

@professorwade
Copy link

What is the timeframe for this change?

@einarf
Copy link
Member Author

einarf commented Jan 17, 2024

What is the timeframe for this change?

I'm looking into if this is even possible at the moment

@einarf
Copy link
Member Author

einarf commented Jan 17, 2024

There seems to by pyglet issues related to text with pygket 2.0dev23 meaning making a 2.x verison with python 12 support is a bit more challenging than just bumping Pillow and Pymunk.

Traceback (most recent call last):
  File "C:\Users\efors\projects\moderngl\arcade\arcade\examples\sprite_bullets.py", line 177, in <module>
    main()
  File "C:\Users\efors\projects\moderngl\arcade\arcade\examples\sprite_bullets.py", line 173, in main
    arcade.run()
  File "\arcade\arcade\window_commands.py", line 323, in run
    pyglet.app.run()
  File "site-packages\pyglet\app\__init__.py", line 107, in run
    event_loop.run(interval)
  File "site-packages\pyglet\app\base.py", line 184, in run
    timeout = self.idle()
              ^^^^^^^^^^^
  File "site-packages\pyglet\app\base.py", line 245, in idle
    self.clock.call_scheduled_functions(dt)
  File "site-packages\pyglet\clock.py", line 277, in call_scheduled_functions
    item.func(now - item.last_ts, *item.args, **item.kwargs)
  File "site-packages\pyglet\app\base.py", line 154, in _redraw_windows
    window.dispatch_event('on_draw')
  File "site-packages\pyglet\window\__init__.py", line 1361, in dispatch_event
    super().dispatch_event(*args)
  File "site-packages\pyglet\event.py", line 422, in dispatch_event
    if getattr(self, event_type)(*args):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "arcade\examples\sprite_bullets.py", line 110, in on_draw
    arcade.draw_text(f"Score: {self.score}", 10, 20, arcade.color.WHITE, 14)
  File "arcade\text_pyglet.py", line 724, in draw_text
    label = pyglet.text.Label(
            ^^^^^^^^^^^^^^^^^^
  File "site-packages\pyglet\text\__init__.py", line 474, in __init__
    super().__init__(doc, x, y, width, height, anchor_x, anchor_y, multiline, dpi, batch, group, rotation)
  File "site-packages\pyglet\text\__init__.py", line 274, in __init__
    super().__init__(document, width, height, multiline, dpi, batch, group)
  File "site-packages\pyglet\text\layout.py", line 940, in __init__
    self.document = document
    ^^^^^^^^^^^^^
  File "site-packages\pyglet\text\layout.py", line 984, in document
    self._init_document()
  File "site-packages\pyglet\text\layout.py", line 1428, in _init_document
    self._update()
  File "site-packages\pyglet\text\layout.py", line 1342, in _update
    lines = self._get_lines()
            ^^^^^^^^^^^^^^^^^
  File "site-packages\pyglet\text\layout.py", line 1319, in _get_lines
    glyphs = self._get_glyphs()
             ^^^^^^^^^^^^^^^^^^
  File "site-packages\pyglet\text\layout.py", line 1476, in _get_glyphs
    glyphs.extend(font.get_glyphs(text[start:end]))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages\pyglet\font\base.py", line 385, in get_glyphs
    glyph_renderer = self.glyph_renderer_class(self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages\pyglet\font\win32.py", line 100, in __init__
    self._create_bitmap(width, height)
  File "site-packages\pyglet\font\win32.py", line 324, in _create_bitmap
    gdiplus.GdipCreateBitmapFromScan0(width, height, width * 4,
ctypes.ArgumentError: argument 5: TypeError: expected LP_c_ubyte instance instead of c_byte_Array_3520

@einarf
Copy link
Member Author

einarf commented Jan 17, 2024

I created a branch here : https://github.com/pythonarcade/arcade/tree/2.6-py312

This is simply just bumped dependencies (pyglet, pymunk, pillow). The basic examples are working fine. More testing likely needed. Be free to give it a spin @professorwade

@professorwade
Copy link

Thank you, I'll check it out.

@pushfoo
Copy link
Member

pushfoo commented Feb 24, 2024

This branch seems to work under:

  • Debian 11 (Tested by me)
  • Arch Linux (Tested by @Xexxar)

@einarf
Copy link
Member Author

einarf commented Feb 24, 2024

I do think the old pyglet version can case some platform specific issues. It would be ideal bumping to the latest stable version.

Might not be too much work wrapping that up.

@pushfoo
Copy link
Member

pushfoo commented Apr 17, 2024

If pymunk is consistently the thing holding us back from supporting the latest Python, the easiest thing to do would be to make it an optional dependency.

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