Enum support on the client

I’d like to be able to use:

from enum import Enum

In the UI.

2 Likes

Which features of enum do you need. Some of the simple features are pretty simple to replicate.

If it’s the convenience then fair enough.

It’s convenience, and for my specific use case to make a simple state machine.

1 Like

Example client enum.

@anvil.server.portable_class
class Action:
    DoNothing = 0
    Delete = 1
    Update = 2
    New = 4

    def __setattr__(self, name, value):
        raise Exception(f"{name} cannot be assigned.")