I want to make a button change color with pyscript. This code doesn't work.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://pyscript.net/releases/2023.11.1/core.css" />
    <script type="module" src="https://pyscript.net/releases/2023.11.1/core.js"></script>
</head>
<body>
    <div>
        <button  id="run" py-click="colorChange()">CLICK</button>
    </div>
    <style>
        #run{ background-color: rgb(61, 139, 130)}
    </style>
    <py-script>
        from js import document
type here
        runButton=document.getElementById("run")
        def colorChange(event):
            runButton.setAttribute("style", "background-color:red")
    </py-script>
</body>
</html>
Someone could help me. Thank you
 
                        
The syntax for
py-eventattributes changed in the 2023.11.1 release. Rather than being a string of executable code, they're just the name of a Callable in the global namespace.So
py-click="colorChange()"should bepy-click="colorChange".