0

So i'm making a GUI with pygame, with some game elements that I need pygame to do. But I need to make a context menu on right click.

right click menu bar osx

It doesn't have to be in pygame, it could be a command in the os or sys modules. I just need a way to open one of these menus, and I can activate it on right click.

Sorry if my question is not clear, I really don't know how to explain it.

windows context menu

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
TheMystZ
  • 80
  • 1
  • 8
  • PyGame is a low level library, so to create a similar context menu to your image, you'll need to create a surface to display and draw the text and other lines on it. Then handle the mouse events to highlight menu options and take action when clicked. If this doesn't sound exciting to you, you may want to consider some libraries that others have created for this purpose, e.g. [pygame-menu](https://pygame-menu.readthedocs.io/en/4.2.2/). – import random Jan 20 '22 at 00:00
  • No, what I need is a way to call the os's context menu. That example is the macOS context menu. – TheMystZ Jan 20 '22 at 00:06
  • Perhaps [this answer](https://stackoverflow.com/a/37372476/2280890) will be of use. It sounds you want to be able to _click-though_ your pygame window to the underlying window manager/desktop environment. – import random Jan 20 '22 at 02:30
  • will not work, this needs to be cross platform – TheMystZ Jan 20 '22 at 02:44
  • `C#` _is_ cross-platform, but I appreciate that the answer is windows specific. Perhaps [this question on simulating mouse clicks on MacOS](https://stackoverflow.com/q/2734117/2280890) will help you identify a solution. You should probably edit your question to clarify what you're asking. – import random Jan 20 '22 at 04:20
  • what I am asking is for a library or function to create a context menu. how will simulating mouse input help. I am trying to open a context menu. – TheMystZ Jan 20 '22 at 05:06
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/241234/discussion-between-themystz-and-import-random). – TheMystZ Jan 20 '22 at 05:07
  • There is no "system context menu". Every app provides their own. You're going to have to be more specific. Pygame doesn't support menus at all, but there is an `pygame-menu` addon that might help. – Tim Roberts Jan 20 '22 at 05:20

0 Answers0