473,573 Members | 3,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Xlib sync on different instance of Xlib.display.Di splay()?


I'm relatively new to Xlib programming, and I ran into a little problem.

I'm trying to insert keypress events into a X window. The following code


import Xlib.display
import Xlib.X
import Xlib.XK

import time

display = Xlib.display.Di splay()
screen = display.screen( )
root = screen.root
input_focus = display.get_inp ut_focus()
window = input_focus._da ta["focus"];

ev = Xlib.protocol.e vent.KeyPress(
time = int(time.time() ), root = root, window = window,
same_screen = 0, child = Xlib.X.NONE, root_x = 0,
root_y = 0, event_x = 0, event_y = 0, state = 0,
detail = 104

window.send_eve nt(ev, propagate = True)
#display = Xlib.display.Di splay()

But when I comment out the "#display = Xlib.display.Di splay()" line, it
stops working. (Naturally doing this in this situation is stupid, but in
the real code I tried to pass the window as a parameter to a object
which had its own instance of display)

My guess is that any events that get sent to a window are cached by the
display the window was gotten from. Since I'm sync()-ing on a different
instance of display() the events aren't there. I initially thought this
caching would've been handled on a lower level (somewhere in the X
internals; not in python) so that the instance wouldn't matter.

Is there any way around this, or will I be forced to pass the correct
display instance as a param?
Thanks for any help,

Ferry Boender
Dec 13 '05 #1
0 1891

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Artificial Life | last post by:
All I really want is to write a few strings to the background of my X display. XDrawString() is what I need. The Xlib for Python shows it's out dated. Is there any alternative?
by: M.L. | last post by:
Hello, I have two db2 box here, running a vrrp daemon to provide IP failover... The two nodes are perfectly identical (same os, users, and db2 setup (instances, db, tables...)). <---- Common Virtual IP Addr ----> MASTER (working) BACKUP (standby)
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox and the coresponding 'Id' from the lookup table is to be inserted into the field of the new record. I have two simple tables. "tblPerson" is the...
by: Ole | last post by:
Hi, I'm going to develop a socket communication between an instrument (running CE 5.0 with Compact Fraework V2) and a PC. As the instrument should only connect to one PC at a time I believe that the sync version of the socket should be the easiest - or what??? (please tell if I'm wrong). Are there anyone who is able to point to a Server...
by: Robert Jacobs | last post by:
Please advise... I currently have a Mainform (Customers) and a Subform (Service Requests) with a one to many relationship (one customer, many service requests) with a CustomerID that is unique for each customer and is autofilled on the subform. Subform contains field called TicketID (which there could be multiple instances of and is not...
by: john | last post by:
I am reading TC++PL3 and on page 644 it is mentioned: "Flushing an istream is done using sync(). This cannot always be done right. For some kinds of streams, we would have to reread characters from the real source - and that is not always possible or desirable. Consequently, sync() returns 0 if it succeeded. If it failed, it sets...
by: Ryan Liu | last post by:
I was supervised that Vista is so difficult to use(e.g. search), lost so many good features (e.g. go upper level folder) and so unstable(even MS own programs will hang up, back to Windows 95/98 era). Now I am surprised again that VS 2005 is lacking of some basic features VS 2003 has. (BTW, I was forced by Dell to install Vista, not XP; I was...
by: giovanni.iovino | last post by:
Hi, sorry for my English. I'm writing my first python script for Linux for a remote bluetooth application. I'm using python-xlib library to send keyboard and mouse events and at the moment I can send keyboard emulated input to the window where pointer is on, i can also move the pointer over the desktop. I'm using python 2.5 on a Ubuntu...
by: Dariusz.Donimirski | last post by:
I must rotate bmp using Xlib without change bmp's memory. If someone knows how I can do this, please help me. dariusz sorry about my english, I'm still learning
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.