Python Forum
Press on touchscreen area.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Press on touchscreen area.
#4
I got good code from other forum! THANK YOU SOCTTY101!
here what it's works!
import tkinter as tk

def pressedInArea(x, y, x1, y1 ,x2 ,y2):
    return x > x1 and x < x2 and y > y1 and y < y2

def checkPosition(event):
    print(event.x,event.y)
    print(pressedInArea(event.x,event.y,0,0,100,100))


root = tk.Tk()
c = tk.Canvas(root,width=400,height=400)
c.grid()
c.bind("<Button-1>", checkPosition)
Reply


Messages In This Thread
Press on touchscreen area. - by ATARI_LIVE - Sep-29-2020, 12:01 AM
RE: Press on touchscreen area. - by deanhystad - Sep-29-2020, 02:31 AM
RE: Press on touchscreen area. - by ATARI_LIVE - Sep-29-2020, 09:57 AM
RE: Press on touchscreen area. - by ATARI_LIVE - Sep-29-2020, 01:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter - touchscreen, push the button like click the mouse John64 5 879 Jan-06-2024, 03:45 PM
Last Post: deanhystad
  tkinter touchscreen scrolling - button press makes unwanted scrolling nanok66 1 4,035 Dec-28-2020, 10:00 PM
Last Post: nanok66

Forum Jump:

User Panel Messages

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