PyScript with Ethereum

Question:

I am still learning about the new PyScript in browser. I was wondering if it is possible for me to allow a click button to check if MetMask account is connected. In regular JS we use to write the following:
enter image description here

However, in PyScript, I am not sure how to get the same functionality. Can anyone help me with a code that demonstrate how to do this in PyScript from the browser?

Asked By: Anonymous

||

Answers:

from js import alert, window

if not window.ethereum:
    alert("install metamask")
Answered By: Yilmaz