Skip to content

Commit

Permalink
Allow easier access to raw ctypes bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
a-hurst committed Apr 2, 2022
1 parent 8854552 commit 5d17d22
Show file tree
Hide file tree
Showing 6 changed files with 293 additions and 279 deletions.
8 changes: 8 additions & 0 deletions doc/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ This describes the latest changes between the PySDL2 releases.

Released on XXXX-XX-XX.

New Features:

* The raw ctypes function bindings for the :mod:`~sdl2.sdlttf`,
:mod:`~sdl2.sdlmixer`, :mod:`~sdl2.sdlimage`, and :mod:`~sdl2.sdlgfx` modules
can now be accessed through the ``_ctypes`` object in each module. For
example, ``sdlttf._ctypes.TTF_Linked_Version`` will return the unwrapped
ctypes function pointer for that function.

Fixed Bugs:

* Fixed a bug in :func:`~sdl2.rw_from_object` where calling
Expand Down
6 changes: 6 additions & 0 deletions sdl2/dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def __init__(self, name, args=None, returns=None, added=None):
self.added = added


# Defines a type of dict that allows getting (but not setting) keys as attributes
class AttributeDict(dict):
def __getattr__(self, key):
return self[key]


def _using_ms_store_python():
"""Checks if the Python interpreter was installed from the Microsoft Store."""
return 'WindowsApps\\PythonSoftwareFoundation.' in sys.executable
Expand Down

0 comments on commit 5d17d22

Please sign in to comment.