What is a Python Flask alternative to a JS "onclick" script?

104
February 05, 2022, at 10:10 AM

I want to make a Flask application for a puzzle. User should find some elements on a picture and click on them. For example, you should click only on fruits and don't click on vegetables.

In order to make the right and the wrong objects on the picture clickable, I use <map> and <area> tags. If you click on a right object, you get +1 point. Something like this:

<script>
    i = 0
    def more_points():
        i += 1
</script>
<img src="/static/1.jpg" usemap="#1map">
    <map name="1map">
        <area shape="rect" coords="124,1174,391,1333" onclick="more_points">
    </map>

But this "onclick=script()" feature works only in JS. How can I write it using Python Flask?

Rent Charter Buses Company
READ ALSO
React Native deep linking not working on React Navigation V6

React Native deep linking not working on React Navigation V6

When I configure my links and url-scheme with react navigation it falls into the fallback errorDon't know why

126
AdMob Android Banner Ads in component UI

AdMob Android Banner Ads in component UI

How to add AdMob Android Banner Ads in component UI

145
Bootstrap side bar collapse icon overlapping

Bootstrap side bar collapse icon overlapping

I am trying to fix a CSS issueso far it is not working

112
HTML tag stuck to top left of mobile page with white space around it [closed]

HTML tag stuck to top left of mobile page with white space around it [closed]

Want to improve this question? Update the question so it's on-topic for Stack Overflow

33