ppizarror / pygame-menu

A menu for pygame. Simple, and easy to use
https://pygame-menu.readthedocs.io/
Other
544 stars 141 forks source link

Make _ignore_keyboard_nonphysical public #409

Closed ultidonki closed 2 years ago

ultidonki commented 2 years ago

Hi! First of all, thanks for this library, it's easy to use! :smiley:

Would it be possible to make Menu._ignore_keyboard_nonphysical a public attribute, or something we pass in to the Menu as a parameter (I'm not sure the best way to do it, but I can make a PR if you want!)

The reason is, in our project (Tuxemon), when using a controller we map everything into pygame keyboard events and pass those to pygame-menu. But if the attribute _ignore_keyboard_nonphysical is set to True, it checks to see if actual keyboard events are being generated - which they aren't, so the menu doesn't respond to the controller events.

We've set _ignore_keyboard_nonphysical = False , which fixes it - but it's probably best to make this changeable publicly, so we don't break something later on :smile:

ppizarror commented 2 years ago

Hi, thanks! I've added ignore_keyboard_nonphysical to the Menu constructor. See #411.

ultidonki commented 2 years ago

Thanks a lot, that's awesome! The PR looks good, thanks a lot for adding it! :smiley: