How do i make a counter which can activate by a button?

This is a counter script which will count once when i press “enter” in python.
I want to make this script inside the GHpython, replace the “Enter” by a button.
How can i do it?