Pygame

Latest version: v2.6.0

Safety actively analyzes 641024 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 11

2.0.2.dev4

Not secure
`python3 -m pip install pygame==2.0.2.dev4 --pre`

<img alt="pygame" src="https://github.com/pygame/pygame/raw/main/docs/pygame_logo.svg" style="max-width: 100%;">

The previous pre-release 2.0.2.dev2 was aimed to test whether our new build machinery for releasing pygame worked. And it worked great, except on Mac. Now mac wheels are hopefully fixed in this pre-release. In fact, we now have Mac wheels that support down to MacOS 10.9, unlike previous 2.x releases, that only supported 10.13 and above.

Apart from that there's a bunch of other nice stuff in here too. Including python 3.10 support, a new Windows camera module, support for rumble controllers/joysticks, support for building on windows with MSYS2 (gcc and friends for windows), and significant documentation improvements and even a new SVG/vector version of the logo (as you can see above).

Hopefully this will be the last pre release. Next up we can do the real 2.0.2 release...
Unless people find some serious issues when testing this one?


Docs + Type Hints + Examples

rethanon fixed up some type hint and documentation errors in 2697 and 2717.

rethanon fixed up the playmus examples, and added a good note to the mixer.music docs in 2745. rethanon continued tidying the music docs in 2751.

vnmabus enhanced the type hints by moving to use `Sequence` in places. (2682)

New contributor Mega-JC made some beautiful upscaled logos for us in 2704. I mean, just check out the README now ๐Ÿ˜.

bydariogamer spruced up the docs in 2715.

Grimmys made it much easier to generate the documentation locally in 2714. No need to install build tools now!

Grimmys got us up to date with our docs build tooling. We can now generate the docs on Sphinx 4.0. (2666)

Starbuck5 wrote a docs README for new contributors in 2667.

Bug Fixes

ankith26 fixed a regression where a few modules would return `True` instead of `None` on init() and quit(). (2719)

MightyJosip fixed a bug where rotating a Surface with no width or no height (or both) would cause a segmentation fault. (2725)

njbradley, Starbuck5, and illume collaborated to get mp3 support for mixer.music on Linux. (2712)

zaphodikus Fixed broken unicode len checking in examples/textinput.py https://github.com/pygame/pygame/pull/2567


Devops

bydariogamer simplified the implementations of surfarray and sndarray in 2708.

ankith26 improved our Github Actions system significantly, also allowing us to generate Python 3.10 wheels on Mac and Windows. (2605)

illume fixed an issue with downloading the jpeg library on windows. (2743)

illume added python 3.10 builds to appveyor in 2757.

Many thanks to illume, assisted by ankith26, for fixing the mac dependency situation that was the primary release blocker for this release. (2742). Mac builds should support MP3 music now!

New contributor Pycryptor10 made sure the metadata in setup.cfg reflects that we support Python 3.10. (2753)

Many thanks to new contributor dciabrin, who added support for MSYS2 windows builds. (2592)

Thanks to Starbuck5, ankith26, and illume for coordinating the 2.0.2.dev4 pre-release.


Additions

Starbuck5 added a namehint argument to `music.queue`. (2750)

Starbuck5 added built in webcam support for Windows to the pygame.camera module. (2630)

zoldalma999 added rumble support to the joystick and controller modules. https://github.com/pygame/pygame/pull/2741




---

- [merged PRs](https://github.com/pygame/pygame/pulls?q=is%3Apr+is%3Aclosed+merged%3A2021-07-22..2021-10-09+sort%3Aupdated-desc+) since we started the pygame 2.0.2 series on the 24th of December 2020, but 2.0.0.dev2 was released 2021-07-22.
- [124 Commits since 2.0.2.dev2 pre release](https://github.com/pygame/pygame/compare/2.0.2.dev2...2.0.2.dev4)
- [previous pygame release notes](https://github.com/pygame/pygame/releases)

2.0.2.dev2

๐Ÿ’๐Ÿ’๐Ÿ˜‰๐Ÿ˜Š๐Ÿ’๐Ÿ’
โ˜• Cheer Up! ๐Ÿต
๐Ÿ‚ โœจ )) โœจ ๐Ÿ‚
๐Ÿ‚โ”ƒ (( * โ”ฃโ”“ ๐Ÿ‚ we have a `python3 -m pip install pygame==2.0.2.dev2`
๐Ÿ‚โ”ƒ*๐Ÿ’— โ”ฃโ”› ๐Ÿ‚
๐Ÿ‚โ”—โ”โ”โ”› ๐Ÿ‚
๐ŸŽ‚ For YOU ๐Ÿฐ
๐Ÿ’๐Ÿ’๐Ÿ˜Œ๐Ÿ˜Š๐Ÿ’๐Ÿ’


Hello internet strangers. Weโ€™re back with a new release, packed with tons of mundane bug fixes and unexciting improvements! Itโ€™s been a while since the last release, but in that time pygame development has been moving ahead. This release, 36 contributors (25 new ones!) contributed over 75 pull requests. Since 2.0.1, over 200 files were edited, with more than 16,000 lines added, and more than 7,000 lines deleted.

This is a development pre-release, so we can test out new release machinery. Probably we will do a couple more dev pre-releases, but we hope to have a full 2.0.2 release soon. There's a bunch of PRs still open that we want to help resolve and merge in before that.

css
So grab a beverage,
and doom scroll our release notes,
we prepared just for you,
(&& those other interweb weirdos)


Bug Fixes ๐Ÿ›

Artisanal source code like ours has the best intentions, but there's nothing like computers to bamboozle our best efforts.
It used to be actual bugs climbing inside the pipe organs programmed to play and the looms programmed to weave, but these days that excuse doesn't really work. Our bad.

<p align="center">
<img src="https://www.scienceandindustrymuseum.org.uk/sites/default/files/styles/embedded_image/public/2019-06/Mount-Street-Mill-2.jpg?itok=Nvw2JGy7" width="320" />
</p>

<p align="center">
<small><i>Bugs in this 1910 Jacquard loom would be actual bugs</i></small>
</p>

New contributor mhollands fixed an issue where arcs wouldnโ€™t fully draw in 2480
[![arc drawing image](https://img.youtube.com/vi/1PBd3VJrfDw/0.jpg)](https://www.youtube.com/watch?v=1PBd3VJrfDw)
<p align="center">(See more the video at <a href="https://www.youtube.com/watch?v=1PBd3VJrfDw">https://www.youtube.com/watch?v=1PBd3VJrfDw</a> if you're interested)</p>

ankith26 fixed
- the init systems to prevent bugs from init-quit-init (2428)
- an error handling bug in pixelarray in 2444
- the pygame default font would break when packaged with PyInstaller (2604)

Starbuck5 fixed:
- 20 second load times for SysFont on Mac, and also gave Windows SysFont some love (2594, 2640).
- A bug where `freetype` would think coordinates of -1 represented an error was fixed in 2576.
- A rare segfault in `mixer.pre_init()` on Mac, in 2494
- Where window size couldn't be reduced after leaving `SCALED` mode on Windows (2587)
- Exiting fullscreen would put your window at (0, 0) in 2460
- A failure in `display.set_gamma()` in 2524
- The pygame.scrap module building properly on Mac and Windows (2499, 2495).

MightyJosip fixed duplicate entries in `display.list_modes()` in 2470

robertpfeiffer fixed
- IME placement in `SCALED` mode in 2451
- A rare bug where `Color.hsva` would return invalid values in 2467

Sysfont fixes

One module in particular has come a long way in this release โ€” sysfont. Thanks to Starbuck5

As well as working better on windows and mac... Before, if you requested "Cambria," pygame would silently give out Cambria bold.
![before](https://user-images.githubusercontent.com/46412508/126018762-01786bdd-a8ee-4a6d-9274-10769e10cea9.PNG)

Now, Cambria is Cambria
![after](https://user-images.githubusercontent.com/46412508/126019070-bdeaa29d-c898-4cf4-b471-b2441e3b0f3d.PNG)

(Of course you can still request bold from SysFont and it will hook you up, at least for Cambria)



New Features โœจ

dr0id added
- vector projection to the `Vector2` and `Vector3` classes in 2510
- a โ€œtouchโ€ attribute to all mouse events in 2514

`projected = v3.project(v3)` This is useful for collision detection in finding the components in a certain direction (e.g. in direction of the wall). For a more detailed explanation see `Wikipedia <https://en.wikipedia.org/wiki/Vector_projection>`_.

The .touch attribute is for events that were generated by a touch input device, and not a real mouse. You might want to ignore such events, if your application already handles finger events.

robertpfeiffer added an `exclude` argument to `pygame.event.get()`, allowing inverse filtering, in 2512, with a test in 2546.

MyreMylar worked on
- changing `mixer.set_reserved()` to return the number of channels actually reserved in 2490
- adding an actual implementation to the `force` parameter of `mixer.find_channel()` in 2491 Before it simply wasn't implemented, only documented.

Starbuck5 added
- a namehint argument to `mixer.music.load()` for easier loading of music from file-like objects. (2497)
- Vector2 support to the `transform`, `display`, and `Mask` modules, as well as keyword argument support to the `transform` and `Mask` modules (2536, 2557, 2581)

Internal / Portability

New contributor Muxelmann fixed the path to homebrew in 2636, fixing some pygame issues on M1 Mac!

New contributor odidev and illume added aarch64 wheel build support, along with a docker file, and github actions tests for it in 2610 and 2675

New contributor fniephaus made a compatibility fix for GraalPython in 2580

MyreMylar updated the sse2neon header to make it build alpha blitter on arm in 2425

ankith26 and illume added github actions, disabled travis builds except arm64 in 2507 and 2600. This was crucial to keep pygame development functional after the shutdown of travis-ci.org.

Pierre-Sassoulas used their pylint expertise to keep pygameโ€™s code base clean and functional in 2509, 2579, and 2634.

Starbuck5 added Python 3.10 support in 2586, updated functions to return bools rather than ints in 2534, and moved to SDL 2.0.16 on Windows in 2670.

illume moved to SDL 2.0.16 on Linux, as well as many other dependency updates, in 2676

Docs

css
_________________________
=(__ ___ __ __)=
| |
| |
| python -m pygame.docs |
| |
| A large number |
| documentation fixes |
| were made in this |
| release. |
| |
|__ ___ __ _____|
=(_________________________)=


llindstrom, Pierre-Sassoulas, and Starbuck5 corrected incorrection information in: 2485, 2582, 2654. robertpfeiffer added to the TEXTINPUT documentation in 2456.

New contributors SplatRT, bambalamm, deek80, NKID00, MaukWM, and shawnbyday all cleaned up the documentation with grammar and typo fixes, in: 2431, 2437, 2519, 2555, 2583, 2644. Starbuck5 contributed to this worthy goal in 2590

New contributor Grimmys and Starbuck5 worked on the documentation build system, upgrading it from Sphinx 1 to Sphinx 3, hiding the obsolete `Overlay` and `cdrom` modules from the top bar, and adding the `--fullgeneration` flag to `setup.py docs`. 2513, 2511, 2617, 2624.

New contributor Taffer added a page to showcase all of pygameโ€™s named colors, in 2559. When it is live, it will be at https://www.pygame.org/docs/ref/color_list.html.

New contributor kaiec noticed that SDL_Image, pygameโ€™s image loading backend, supports more than we had documented, so updated the documentation accordingly, in 2619. (We support WebP and SVG, who knew?) New contributor duthades continued this by adding tests for the new image formats in 2656.

Finally, new contributor ayushbisht2001 added a nice logo to the README in 2441, sprucing it up nicely.

Type Hints

Typehints got some neat updates in this release as well, so that you can code with pygame in your favourite IDE and you get that sweet auto-correct/autocomplete and type-checking to catch bugs even before they are reported!

New contributor jakebailey made tons of good typehint fixes in 2537, the most important ones being, correctly exporting submodules in a way that typehints are recognized for the submodules, and generic types used in annotations being fixed to include the missing type params, among other fixes.

New contributors:
- w-v fix `set_mods()` type hint in 2457
- nathanielconroy less strict type checking for `AbstractGroup.add` in 2646
- sandipanpanda Fixed wrong kwargs types in sprite.pyi in 2652
- vnmabus Fix syntax for typing AbstractGroup attributes in 2663
- bydariogamer Update Vector3 overloaded constructor signature in 2674
- shingo-kagami Fixed `mouse.get_pressed()` type hint in 2685

MyreMylar Add str and RGBA tuple types to freetype/font type hints in 2462, and Correct blits typehint sequence arg to cover blit inputs in 2482

ankith26 and zoldalma999 overhauled many incorrect uses of `Optional` in 2678

Examples

New contributor jonozw added a needed `pg.quit()` for IDLE compatibility in the stars example (2560). Many other examples needed this too, so another expeditious new contributor (AnudeepGunukula) swept through and made sure it was on every example in 2643.

MightyJosip fixed a crash in the mask example in 2606.

New contributor mljli improved the aliens example in 2608, new contributor njbradley improved the font_viewer example in 2655 (itโ€™s cool check it out), and Starbuck5 overhauled the chimp example in 2651.

Experimental super secret _sdl2 things

`TODO: this section is supposed to be top secret! No one is supposed to know about these new APIs yet, except people wanting to give feedback and live dangerously. So I guess bikers, and skydivers can know about this stuff?`

galexandreg added `blend_mode`, color tuples, `origin=None`, to `_sdl2.Image` in 2426 and `draw_blend_mode` to Renderers in 2520

Starbuck5 added prototype docs to the _sdl2.video system in 2533. They will be live at https://www.pygame.org/docs/ref/sdl2_video.html.

zoldalma999 did lots of work getting the SDL2 controller system ported in 2423.

Thank Yous

- To all the returning contributors who helped improve pygame this release:
Josip Komljenoviฤ‡ (MightyJosip) | Dan Lawrence (MyreMylar) | Pierre Sassoulas (Pierre-Sassoulas) | Charlie Hayden (Starbuck5) | Ankith (ankith26) | droid | galexandreg | Rene Dudfield (illume) | Lenard Lindstrom (llindstrom) | robertpfeiffer | zoldalma999
- And to all the new contributors who put themselves out there by volunteering fixes:
MaukWM | Chris Herborth (Taffer) | NKID00 (NK) (NKID00) | Fabio Niephaus (fniephaus) | Ayush Bisht (ayushbisht2001) | Nathaniel Conroy (nathanielconroy) | Kai Eckert (kaiec) | Anudeep Gunukula (AnudeepGunukula) | bydariogamer | Don Patterson (deek80) | njbradley | odidev | SplatRT | Max Zangs (Muxelmann) | mljli (mljli) | shawnbyday (shawnbyday) | Bambalam (bambalamm) | Grimmys (Grimmys) | Carlos Ramos Carreรฑo (vnmabus) | Jake Bailey (jakebailey) | Sanket Duthade (duthades) | Matt Hollands (mhollands) | w-v | sandipanpanda | jonozw (jonozw) | Shingo Kagami (shingo-kagami)
- As all releases, this one too would not have been possible without support from the community, from people submitting issues, to people making PRs for all kinds of improvements, from typo fixes, to fixing complex segfaults in C code, every contribution matters a lot!
- patreon.com/pygame sponsors: Christopher Cacho, Daniel Lawrence, Tommi Sinivuo, Leif Theden, zoldalma, rosa, Nova Dasterin, and Bob Johnson. With their help half of the first patreon goal of covering the monthly hosting costs has been covered and a number of pygame tutorials have been made.
- To the people making all the software pygame depends on, from SDL&python, to sphinx&git and many others.
- The people supporting pygame financially by buying the pre-release of a pygame book. It's a book by a long time pygame contributor where all funds go towards pygame development.
- People helping out the community in general, from making youtube tutorials, to answering questions on various forums of discussions, to helping with packaging pygame!



---

- [merged PRs](https://github.com/pygame/pygame/pulls?q=is%3Apr+is%3Aclosed+merged%3A2020-12-24..2021-07-22+sort%3Aupdated-desc+) since we started the pygame 2.0.2 series on the 24th of December 2020
- [305 Commits since 2.0.1 stable release](https://github.com/pygame/pygame/compare/2.0.1...2.0.2.dev2)
- [previous pygame release notes](https://github.com/pygame/pygame/releases)

2.0.1

Not secure
๐ŸŒบ๐ŸŒป๐ŸŒน๐Ÿฅ€๐ŸŒท๐ŸŒผ๐ŸŒธ๐Ÿ’๐Ÿ’ฎ๐ŸŒบ๐ŸŒป๐ŸŒน๐Ÿฅ€๐ŸŒท๐ŸŒผ๐ŸŒธ๐Ÿ’๐Ÿ’ฎ๐ŸŒบ๐ŸŒป


The Age Of Aquarius,
the northern Winter Solstice,
and the southern Summer Solstice bring us...
a new pygame to play with :)


This is a bug fix release, with a bunch of features and optimizations thrown in for good measure. Thank you to the people reporting issues related to pygame 1 compatibility. Some of them will take a bit longer to discuss, work through, and find solutions. We say goodbye to Travis the CI that served us well. We said goodbye to the pygame discord that had grown too big, only for a few more to have sprouted up in its place. We said hello to the [patreon.com/pygame](https://patreon.com/pygame) and we took a breather for a little bit.

Enough bla bla bla... what's new?


Backwards compatibility fixes

Firstly, a few backwards compatibility fixes have been made.

Dan Lawrence MyreMylar worked some more on the alpha blitter so it's more compatible.
- Change opaque surface test to use SDL_ISPIXELFORMAT_ALPHA() macro 2269

Renรฉ Dudfield (illume) worked on making some old audio driver and video driver names that had been renamed work in backwards compatible env vars, SDL_VIDEODRIVER=windib, SDL_AUDIODRIVER=pulse or dsound 2292


Major event refactor

Ankith (ankith26) did a major event refactor in 2357 2404 2416 and 2398 This not only cleaned up the event processing code, but fixed a bunch of issues an introduced some new features making event processing more comfy along the way.

- 1236 unicode keydown field does not appear occasionally
- 1238 posting keydown events fills the all fields.
- 1524 Unicode property not returned on KEYUP event
- 1550 time.set_timer accept event object
- 2146 Segfault in pygame.event.post() fixed
- 2214 WINDOWEVENT API upgrade
- 2319 event.get(type) does not return a list of all events posted
- 2347 pygame.time.set_timer() accepts loops param
- 2378 unicode keydown field working when mashing 4 keys at once

Here's a graph to treat your eyes, on an event benchmark where getting lots of events has been sped up a lot. As you can see, its a 7 times speed up. There are also less peaks in there, due to less thread locking on the event queue and using batching API calls.

![Figure_1](https://user-images.githubusercontent.com/46915066/102309972-082dec80-3f90-11eb-8023-195a0fc1cb09.png)



New contributors

Thanks to bwright8 for adding a unit test for image.load_basic() 2307 and also for adding some Surface.convert tests in 2368.


kristofszentes made a unit test for image.load_extended() in 2324

Paul m. p. P. (pmp-p) fixed typo in windib driver handler condition https://github.com/pygame/pygame/pull/2342

The Dog Lulu (Iamsoto) updated the TYPE_HEAD macro to use a newer API 2363

aminouhammou added a unit test for display.gl_get_attribute() 2375

Tom Fryers (TomFryers) Capitalised "Python" in the import message. 2389

Pierre Sassoulas (Pierre-Sassoulas) has been working on some code quality fixes using the pylint tool (and apart from these merged PRs working on setting up other code quality tools and a pre-commit checker).
- Add parentheses to print so it works in py2 and py3 2284
- Merge some comparisons in lists for simplicity 2290
- Change range(len(x)) to enumerate(x) when applicable 2291
- Temporarily skip test_sound_args on windows and Appveyor 2371


Color.update() and Rect.update()

zoldalma999 (who recently joined the pygame team on github after contributing several high quality patches to pygame) worked on a proposal by David Lรถnnhager (dlon) to add Color.update and Rect.update 2277

Vectors already have an update() method. Now Color, and Rect do too :)

python

>>> c = pygame.Color(0, 0, 0)
>>> c2 = pygame.Color(1, 2, 3, 4)
>>> c
(0, 0, 0, 255)
>>> c.update(c2)
>>> c
(1, 2, 3, 4)

>>> rect = pygame.Rect(0, 0, 1, 1)
>>> rect.update(1, 2, 3, 4)
>>> rect
<rect(1, 2, 3, 4)>
>>> rect = pygame.Rect(0, 0, 1, 1)
>>> rect2 = pygame.Rect(1, 2, 3, 4)
>>> rect.update(rect2)
>>> rect
<rect(1, 2, 3, 4)>


zoldalma999 also worked on:
- the "edit on github" link in the docs was fixed to now point to `main` branch. 2318
- document that sprite groups are ordered in python 3.6 and above 2336
- Remove unittest skip from freetype_Font_render_to_mono 2351
- Fix render_to returning unpositioned rect 2410



Renรฉ Dudfield (illume) was hacking on some things like these:
- Fixing some sysfont test failures 2354
- docs, tests and types for pathlib support 2387
- fix for a gl crash 2394
- SDL 2.0.14, and manylinux improvements (pulseaudio and other deps) 2395
- Fix and skip test failures 2415

2.0.0

Not secure
๐ŸŒบ๐ŸŒป๐ŸŒน๐Ÿฅ€๐ŸŒท๐ŸŒผ๐ŸŒธ๐Ÿ’๐Ÿ’ฎ๐ŸŒบ๐ŸŒป๐ŸŒน๐Ÿฅ€๐ŸŒท๐ŸŒผ๐ŸŒธ๐Ÿ’๐Ÿ’ฎ๐ŸŒบ๐ŸŒป


Happy pygame 20th birthday all! ๐ŸŽ‰ ๐Ÿฐ ๐Ÿฅณ

<img src="https://user-images.githubusercontent.com/9541/97467489-8bde3c00-1944-11eb-8ebd-6e91db1a8295.png" width="320" />

---

- 937 [merged PRs](https://github.com/pygame/pygame/pulls?q=is%3Apr+is%3Aclosed+merged%3A2018-06-19..2020-10-28+sort%3Aupdated-desc+) since we started the pygame 2 series in Jul 19, 2018.
- [3306 Commits since 1.9.4 stable release](https://github.com/pygame/pygame/compare/1.9.4...2.0.0)
- [previous pygame release notes](https://github.com/pygame/pygame/releases)

2.0.0.dev24

Not secure
A bunch of fixes and speedups before the release.
Now the default branch on the pygame repo is [main](https://github.com/pygame/pygame/issues/2257).


MyreMylar Dan Lawrence
- Sets SDL Hint for hidden mouse cursor at window edges when full screen 2254
- Documents that integers underlying key code constants differ between Pygame 1 & 2 2253
- Updates the joystick docs to include controller mappings for X360 & PS4 controllers 2252
- Updates the docs for toggle_fullscreen() 2251
- New Alpha blitter - fixes and speed ups 2243

siggisv Sigurรฐur Sveinn Halldรณrsson
- Add to `test/draw_test.py` some unit tests for `draw.line()` 2247

Ankith ankith26
- A small little deletion of obsolete file 2256
- Do MOUSEBUTTONUP event on MOUSEWHEEL 2242
- Fix event.post KEYDOWN/KEYUP 2244

2.0.0.dev22

Not secure
Several very difficult to find and fix issues with alpha blending were fixed in this release.
- [First pass at backwards compatible pygame alpha blit](https://github.com/pygame/pygame/pull/2213) by MyreMylar

The new alpha blitter has an SSE2 and arm NEON implementation, and keeps compatibility with pygame 1.

Also some progress on other issues, including these...

- [Fix twitchy key tests on raspi](https://github.com/pygame/pygame/pull/2234) by ankith26
- [Better unit tests for event module](https://github.com/pygame/pygame/pull/2236) by ankith26
- [Fix messed up SSE 4.2 removal](https://github.com/pygame/pygame/pull/2233)

Page 6 of 11

ยฉ 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.