Python Forum
Double click on touch screen issue - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Double click on touch screen issue (/thread-30902.html)



Double click on touch screen issue - ATARI_LIVE - Nov-12-2020

When I use bind(<Double-Button-1>, run_function) on the TOUCHSCREEN.

the mouse does works but not touchscreen due fat-fingers.

The double click MUST be same mouse's coordinates.

is there other way to double click without target coordinates?


RE: Double click on touch screen issue - deanhystad - Nov-12-2020

I don't think you can change the geometry requirement for a double click, but you can make your own double click. Looks like others have run into the same problem.

https://codereview.stackexchange.com/questions/198056/on-click-doubleclick-and-mouse-moving

I'm surprised that double click cares about anything other than when you click and in what window.


RE: Double click on touch screen issue - ATARI_LIVE - Nov-13-2020

Thanks, yeah, I was kind of p... off with the touch screen when I press and hold on the touchscreen and the cursor shakes moving like 2-5 pixels round. so when I am trying to double click on the touchscreen (trying stay same coordinates), the cursor still moving so the <double-button-1> do not detect. I have to do repeat until got <double-button-1> detected.
See the video.
www.youtube.com/watch?v=HY64s-_mjQA


RE: Double click on touch screen issue - ATARI_LIVE - Nov-13-2020

Maybe my touchscreen is piece of junk.


RE: Double click on touch screen issue - ATARI_LIVE - Nov-13-2020

I got it, I did it and what I found:
# Double Click detect without the same of the coordinates.

from tkinter import *

counting = 0
press_is_pressed = 0
got_pressed = 0
double_pressed = 0

window = Tk()
window.attributes('-fullscreen', False)
window.configure(bg='black')
window.geometry("200x200")
window.overrideredirect(False)

def ts_pressing(event):
	global press_is_pressed
	press_is_pressed = 1

def ts_releasing(event):
	global press_is_pressed, double_pressed
	press_is_pressed = 0

def ts_double_pressing():
	global press_is_pressed, counting, got_pressed
	if press_is_pressed == 1:
		got_pressed = 1
	
	if press_is_pressed == 0 and got_pressed == 1:
		counting = counting + 1

	if counting > 200:
		counting = 0
		got_pressed = 0

	if counting > 5 and press_is_pressed == 1 and got_pressed == 1:
		print("got double click")
		counting = 0
		got_pressed = 0
		double_pressed = True 
	else:
		double_pressed = False
	window.after(1,ts_double_pressing)

window.bind("<Button-1>", ts_pressing)
window.bind("<ButtonRelease-1>", ts_releasing)
ts_double_pressing()

window.mainloop()