Python Forum
Double click on touch screen issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Double click on touch screen issue
#1
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?
Reply
#2
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/que...use-moving

I'm surprised that double click cares about anything other than when you click and in what window.
Reply
#3
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
Reply
#4
Maybe my touchscreen is piece of junk.
Reply
#5
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()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 6,171 Feb-06-2019, 01:25 AM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020