Python Forum

Full Version: [split] Accurate Clicks Per Second
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In My opinion it is always hard to implement code in python. I am working in python to make a click per second tool but it shows Multiple errors in integration.So I use Javascript and make this tool in a single day without any bug.

Tool Link:https://clickspeeder.com/click-per-second/

I am curious to develp the same Tool in python but fail all time anyone helps me to make other variations in python .I want to learn python
split from https://python-forum.io/Thread-Accurate-...Per-Second as you are hijacking their thread somewhat

If you can create it in javascript then you already know the procedure. Your problem then lies not in creating the program, but converting it over to python.

As the opposite, i find it easier to implement anything in python than any other language. But that all depends on what language you are familiar with. The process of learning python requires converting known language script to python. So giving it to you does you no good. Give us your broken python script not working so we can find out where you went wrong.
Here is the full code of the Click per second test game you can follow this and make a good tool.
Html
<div id="container">
<div id="zone"></div>
Clicks per second: <span id="counter">0</span>
</div>
CSS
body {
background: #aaa;
}
#container {
font: normal 26px sans-serif;
padding: 16px;
background: linear-gradient(#58c, #bcf);
box-shadow: 0 0 5px -1px, 0 0 5px #fff inset;
text-shadow: 0 0 5px #fff;
border-radius: 8px;
}
#zone {
height: 160px;
margin: 0 0 16px;
background: #fff;
box-shadow: 0 0 5px -1px inset, 0 0 5px #fff;
border-radius: 8px;
transition: box-shadow .5s;
}
#zone:hover {
box-shadow: 0 0 5px -1px inset, 0 0 5px #fff, 0 0 5px 1px #007 inset;
}
#counter {
font-weight: bold;
transition: opacity .5s;
}
#counter::before {
content: '';
font-weight: normal;
}
Js
var started, resetTimeoutHandle, resetTimeout = 1000,
container = document.getElementById('container'),
counter = document.getElementById('counter'),
zone = document.getElementById('zone'),
clicks = 0;

zone.onseclect = zone.onselectstart = function() {
return false;
};

function clicksPerSecond(started, clicks) {
return clicks / ((new Date()) - started) * 1000;
}

function count() {
clearTimeout(resetTimeoutHandle);
clicks++;
counter.innerText = clicksPerSecond(started, clicks);
resetTimeoutHandle = setTimeout(reset, resetTimeout);
return false;
}

function start() {
started = new Date();
clicks = 0;
counter.style.opacity = 1;
this.onmousedown = count;
this.onmousedown();
return false;
}

function reset() {
zone.onmousedown = start;
counter.style.opacity = 0.3;
}

reset();

Thankyou in advance.
Here is the full code of the Click per second test game you can follow this and make a good tool.
I create a CPS test tool on this code you can use it.

Html

<div id="container">
<div id="zone"></div>
Clicks per second: <span id="counter">0</span>
</div>

CSS

body {
background: #aaa;
}
#container {
font: normal 26px sans-serif;
padding: 16px;
background: linear-gradient(#58c, #bcf);
box-shadow: 0 0 5px -1px, 0 0 5px #fff inset;
text-shadow: 0 0 5px #fff;
border-radius: 8px;
}
#zone {
height: 160px;
margin: 0 0 16px;
background: #fff;
box-shadow: 0 0 5px -1px inset, 0 0 5px #fff;
border-radius: 8px;
transition: box-shadow .5s;
}
#zone:hover {
box-shadow: 0 0 5px -1px inset, 0 0 5px #fff, 0 0 5px 1px #007 inset;
}
#counter {
font-weight: bold;
transition: opacity .5s;
}
#counter::before {
content: '';
font-weight: normal;
}

Js

var started, resetTimeoutHandle, resetTimeout = 1000,
container = document.getElementById('container'),
counter = document.getElementById('counter'),
zone = document.getElementById('zone'),
clicks = 0;

zone.onseclect = zone.onselectstart = function() {
return false;
};

function clicksPerSecond(started, clicks) {
return clicks / ((new Date()) - started) * 1000;
}

function count() {
clearTimeout(resetTimeoutHandle);
clicks++;
counter.innerText = clicksPerSecond(started, clicks);
resetTimeoutHandle = setTimeout(reset, resetTimeout);
return false;
}

function start() {
started = new Date();
clicks = 0;
counter.style.opacity = 1;
this.onmousedown = count;
this.onmousedown();
return false;
}

function reset() {
zone.onmousedown = start;
counter.style.opacity = 0.3;
}

reset();

Thank you in advance.
I agree with @LaimHunt:
Html
<div id="container">
<div id="zone"></div>
Clicks per second: <span id="counter">0</span>
</div>
CSS
body {
background: #aaa;
} dordle
#container {
font: normal 26px sans-serif;
padding: 16px;
background: linear-gradient(#58c, #bcf);
box-shadow: 0 0 5px -1px, 0 0 5px #fff inset;
text-shadow: 0 0 5px #fff;
border-radius: 8px;
}
#zone {
height: 160px;
margin: 0 0 16px;
background: #fff;
box-shadow: 0 0 5px -1px inset, 0 0 5px #fff;
border-radius: 8px;
transition: box-shadow .5s;
}
#zone:hover {
box-shadow: 0 0 5px -1px inset, 0 0 5px #fff, 0 0 5px 1px #007 inset;
}
#counter {
font-weight: bold;
transition: opacity .5s;
}
#counter::before {
content: '';
font-weight: normal;
}
Js
var started, resetTimeoutHandle, resetTimeout = 1000,
container = document.getElementById('container'),
counter = document.getElementById('counter'),
zone = document.getElementById('zone'),
clicks = 0;

zone.onseclect = zone.onselectstart = function() {
return false;
};

function clicksPerSecond(started, clicks) {
return clicks / ((new Date()) - started) * 1000;
}

function count() {
clearTimeout(resetTimeoutHandle);
clicks++;
counter.innerText = clicksPerSecond(started, clicks);
resetTimeoutHandle = setTimeout(reset, resetTimeout);
return false;
}

function start() {
started = new Date();
clicks = 0;
counter.style.opacity = 1;
this.onmousedown = count;
this.onmousedown();
return false;
}
function reset() {
zone.onmousedown = start;
counter.style.opacity = 0.3;
}

reset();
I agree with you, thanks for your sharing.
<Offsite link promotion link removed>
It's a great way to unwind and relax. Link Removed