Python Forum
python311 tkinter moving mouse event.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python311 tkinter moving mouse event.
#1
hi.I am running a tkinter mapview in root window.
Coordinate,pos_x, is shown on a label in full size rootwindow.
However when I move mouse from i.e pos_x= 10 to 9, label shows 90.
I have tried config, giving input of "", but seemes not to work.
I would appreciate any hints howto view the mouse coordinate not to "add" to next coordinate when length of screen distances decreases.
Below is some code involved. Image attached shows result moving mouse from a 4 ciffer posit to a 3 ciffer screen position (The 4th ciffer adding to 3ciffer position). [Image: DC0LLCB]
import tkintermapview
from textholders import *
from tkinter import ttk
from tkinter import *
from tkinter.ttk import *

window = tkinter.Tk()
window.geometry("1920x1200+0+0")
window.minsize(1920, 1200)
window.resizable(False, False)
window.state("normal")
window.title("ROOT")
window.config(background="blue")



map_widget = tkintermapview.TkinterMapView(window, width=1000, height=1000, corner_radius=0)
map_widget.place(x=450, y=100)

def motion(event):
    global pos_x, pos_y
    pos_x = event.x_root
    pos_y = event.y_root

    inp_posskjerm = ttk.Label(window, font=("Ariel",16,"bold"), text=(pos_x))
    
    inp_posskjerm.place(x=115,y=277)
window.bind("<Motion>", motion)


window.mainloop()   

Attached Files

Thumbnail(s)
   
Reply


Messages In This Thread
python311 tkinter moving mouse event. - by janeik - Jul-01-2023, 09:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  mouse move event/cinfiguration ttk/python janeik 4 1,159 Jul-03-2023, 05:30 PM
Last Post: deanhystad
  How to hardcode event.state? (tkinter) philipbergwerf 1 1,675 Oct-24-2022, 01:55 PM
Last Post: deanhystad
  Moving mouse so that games can detect movement SheeppOSU 2 1,986 Jun-09-2020, 07:23 PM
Last Post: SheeppOSU
  mouse 0.7.0 - mouse polling hate 125-1000hz penahuse 1 2,562 Dec-06-2019, 09:51 PM
Last Post: Larz60+
  Moving Mouse ian 1 2,410 Dec-25-2018, 10:41 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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