Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 728667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:42:28+00:00 2026-05-14T06:42:28+00:00

I need to monitor and filter mouse events with Xlib in Python. So far

  • 0

I need to monitor and filter mouse events with Xlib in Python.

So far I have found out that this code receives events, but does not pass them on, so I can’t actually do anything with the mouse anymore.

from Xlib.display import Display
from Xlib import X

display = Display(':0')
root = display.screen().root

root.grab_pointer(True, X.ButtonPressMask | X.ButtonReleaseMask, X.GrabModeAsync, X.GrabModeAsync, 0, 0, X.CurrentTime)

while True:
    print "Event:"
    print display.next_event()

Alternatives I found are using

root.change_attributes(event_mask=X.ButtonPressMask | X.ButtonReleaseMask)

Which does not work at all or using the RECORD extension to Xlib, which I can’t figure out how it works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:42:28+00:00Added an answer on May 14, 2026 at 6:42 am

    The answer seemed to be to use Xlib with RECORD, the result can be seen here:
    http://github.com/pepijndevos/PyMouse/blob/master/unix.py#L38

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder that contains multiple word documents. I need to monitor this
I have a VB app that I need to monitor while it is running.
I have some .net apps running that I need to monitor for example, then
I need to create daemon that will monitor certain directory and will process every
I need a consistent way to monitor databases that are read-only log shipped copies
In my app, I have an external monitor that pings the app ever few
I need to monitor and control a set of Windows Services that are running
I need to monitor one single page and all related activities. This is the
For some reason I'm stuck on this. I need to filter results from a
I think this question is quite common. Recently I have got a requirement that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.