Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu arguments with renpy.display_menu() #5509

Open
WindChimesGames opened this issue May 13, 2024 · 5 comments
Open

Menu arguments with renpy.display_menu() #5509

WindChimesGames opened this issue May 13, 2024 · 5 comments
Assignees
Labels
enhancement A proposed or requested enhancement or improvement to renpy's features.

Comments

@WindChimesGames
Copy link

Hi! Potentially a dumb question, but I can't seem to figure out how to make menu arguments work when using renpy.display_menu().

As in e.g. I want to do the equivalent of this but with renpy.display_menu():

menu:
    "Test choice" (icon="cross"):
        jump cross_label
    "Test choice 2" (icon="check"):
        jump check_label

This is what I have so far:

renpy.display_menu(
    [
        ("Test choice", "cross_label"),
        ("Test choice 2", "check_label")
    ]
)

I've read the documentation on renpy.display_menu, and I know it takes kwargs, but I have no clue how to access them in the choice screen, and I'm not sure if that's what I'm supposed to do anyway to achieve what I want with the menu arguments since the icon arg would be different per choice too

Any help would be much appreciated! Thank you!

@Gouvernathor
Copy link
Member

That seems to be missing, from the public API at least. Let me take a look. The easy extension would be to enable the tuples to take 3 or 4 elements, an args tuple and a kwargs dict (if they are passed as separate parameters we need to worry that they have the same length and what to do otherwise, boring).
Also, the **kwargs should not be part of the documented signature if nothing is said about what they do.

@Gouvernathor Gouvernathor self-assigned this May 13, 2024
@Gouvernathor Gouvernathor added the enhancement A proposed or requested enhancement or improvement to renpy's features. label May 13, 2024
@mal
Copy link
Member

mal commented May 14, 2024

Doesn't this just boil down to a request to make renpy.menu documented, rather than introduce a new API?

@Gouvernathor
Copy link
Member

I don't think the two are equivalent - from the fact that two different functions exist - but I may be wrong about that since I don't fully understand the role of each. It seems to me that the items taken by menu is a list of 3-tuples with an evaluable condition included, whereas display_menu's items parameter takes a list of 2-tuples with no condition - and passing a condition is unnecessary when you already control what items are in the list.
In any case, the item_arguments parameter of the menu function is quite bad as a public API, in that passing items and item_arguments of different length yields annoying issues and raises annoying questions. That's why I find it best to include those in the items tuples.

@shawna-p
Copy link
Contributor

I think renpy.menu is much too high-level for the average user; adding a way to pass args and kwargs to renpy.display_menu is much more understandable. renpy.menu's arguments are largely directly from the parser and thus not terribly intuitive to provide. At that point a user would be expected to be comfortable with writing CDSs so I think the gap in required knowledge is too large there.

@mal
Copy link
Member

mal commented May 16, 2024

Ah, that makes sense. 👍

@renpytom renpytom added this to the 8.3 / 7.8 Prerelease milestone May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A proposed or requested enhancement or improvement to renpy's features.
Projects
None yet
Development

No branches or pull requests

5 participants