Python Forum
Howto do motion event on solely window and not the widgets on it?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Howto do motion event on solely window and not the widgets on it?
#1
I have a single window (root):
window = customtkinter.CTk() which holds several widges as (mapview,labels,combos....).

I use this function to get mouse x and y position, while mouse is moving:

It shows coordinates, but at every widget it resets x,y values. Intention was to treat window as a whole, without resetting coordinates when mousepointer hits a widget.

Widges uses window as first parameter.

Whats the approach for the above?
(think I read that windows needs focus for events to run, so thats not an option(?)

def motion(event):
    inp_posskjermx["text"] = f"{event.x}"
    inp_posskjermy["text"] = f"{event.y}"
    inp_posskjermx.configure(text=f"{event.x}") 
    inp_posskjermy.configure(text=f"{event.y}")
    
window.bind('<Motion>', motion)
Reply


Messages In This Thread
Howto do motion event on solely window and not the widgets on it? - by janeik - Jul-10-2023, 06:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  motion tracking script ig? k4ne 0 494 Dec-13-2023, 02:00 AM
Last Post: k4ne
  howto get size of a ctk image? janeik 2 931 Oct-03-2023, 03:49 AM
Last Post: janeik
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 1,923 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 1,213 Jun-13-2022, 08:59 AM
Last Post: Shena76
  Creating Data Set for Changing Oscillation Motion jcraw77 0 1,613 Jun-19-2020, 12:25 AM
Last Post: jcraw77
  Detect event by motion/image - Help Zarqua 0 1,552 May-12-2020, 10:41 AM
Last Post: Zarqua
  Detection Motion Program Adek1243 11 4,410 Mar-23-2020, 10:12 AM
Last Post: Adek1243
  Simple python script for pir motion sensor Kimzer 0 4,103 Oct-03-2017, 05:36 PM
Last Post: Kimzer
  Help with circle and motion wigigx 4 4,100 Aug-29-2017, 09:49 PM
Last Post: sparkz_alot
  Howto try catch consuli 2 3,930 Nov-14-2016, 08:03 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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