> For the complete documentation index, see [llms.txt](https://bkortbus.gitbook.io/unreal-python-recipe-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bkortbus.gitbook.io/unreal-python-recipe-book/editor-menus/python-menu-class/toggled-menu-entries.md).

# Toggled Menu Entries

Another type of Menu is the Checkbox style - is something on or off?&#x20;

## \_\_init\_\_ requirements

The first requirement is to tell our Menu Class that it is a checkbox menu type. We can do this in our \_\_init\_\_ by adding the following line:

```python
self.data.advanced.user_interface_action_type = unreal.UserInterfaceActionType.TOGGLE_BUTTON
```

This will display the Menu Class as a checkbox, but we'll need to do a few extra steps to make it work!

## Property to Track The Checked State

The next requirement is a variable we can use to keep track of whether our class is checked or not:

```python
@unreal.uclass()
class PythonMenuTool(unreal.ToolMenuEntryScript):
    is_checked = unreal.uproperty(bool)
```

## Function Overrides

lastly, we'll want to declare our functions for `get_check_state()` and `execute()` to make use of our tracker variable:

```python
    @unreal.ufunction(override=True)
    def get_check_state(self, context):
        """determine the icon to display"""
        checked = unreal.CheckBoxState.CHECKED
        unchecked = unreal.CheckBoxState.UNCHECKED
        return checked  if self.is_checked else unchecked 

    @unreal.ufunction(override=True)
    def execute(self, context):
        """determine the icon to display"""
        self.is_checked = not self.is_checked
```

This will update the checkbox when executed and make sure the correct state is shown:

<figure><img src="/files/5bXoN810QjLSP2Jn6QqF" alt=""><figcaption></figcaption></figure>

## Toggled Types

This class setup works for the following interface action types:

```python
unreal.UserInterfaceActionType.CHECK
unreal.UserInterfaceActionType.RADIO_BUTTON
unreal.UserInterfaceActionType.TOGGLE_BUTTON
```

## Full Class Code

```python
@unreal.uclass()
class PythonMenuTool(unreal.ToolMenuEntryScript):
    name = "checkbox"
    label = "Checkbox"
    tool_tip = "tool tip!"    
    is_checked = unreal.uproperty(bool)

    def __init__(self, menu, section=""):
        """Initialize our entry for the given menu_object's section"""
        super().__init__()

        # Initialize the entry data
        self.init_entry(
            owner_name="custom_owner",
            menu=menu.menu_name,
            section=section,
            name=self.name,
            label=self.label,
            tool_tip=self.tool_tip
        )
        self.data.advanced.user_interface_action_type = unreal.UserInterfaceActionType.BUTTON

        menu.add_menu_entry_object(self)

    @unreal.ufunction(override=True)
    def get_check_state(self, context):
        """determine the icon to display"""
        checked = unreal.CheckBoxState.CHECKED
        unchecked = unreal.CheckBoxState.UNCHECKED
        return checked if self.is_checked else unchecked

    @unreal.ufunction(override=True)
    def execute(self, context):
        """determine the icon to display"""
        self.is_checked = not self.is_checked

```
