The way to find out what item is selected is to use a different function
for different menu items. This seems to be callback driven.

How do you close a menu? I'm honestly not sure why your example doesn't
work as expected. I downloaded and ran the example successfully, but no
amount of tweaking to your application worked for me. My honest suggestion
would be to find a different menu library; this one seems to have a number
of other issues, including throwing a NameError whenever the menu tries to
quit pygame.

On Sun, Sep 23, 2018 at 11:10 PM Alec Bennett <wrybr...@gmail.com> wrote:

> I'm trying to add the beautiful menus from Pygame-menu (
> https://github.com/ppizarror/pygame-menu) to my project, but having
> trouble. In my attached stripped down sample, I'm trying to show menu1 when
> the 1 key is pressed, and show menu2 when the 2 key is pressed. They're
> both "main menus" launched from the root of the app, as opposed to one
> being a submenu of the other.
>
> My questions:
>
> - how can I find out what item was selected in the menu? Clicking a
> selection triggers the item_selected() function, but doesn't send any info
> about which item was selected.
>
> - how can I close a menu? Running menu1.disable() in item_selected()
> doesn't close the menu... How do I close the menu when something is
> selected?
>
> Ideally in this sample I'd like to launch menu1 when the 1 key is pressed,
> choose a selection, print info about what was selected, and return to the
> root of the app. Then pressing keyboard 2 launches menu2, repeating the
> process.
>
> Thanks for any help, and apologies if I'm missing something obvious here.
>
>
>

Reply via email to