X Tutup
The Wayback Machine - https://web.archive.org/web/20210106130914/https://github.com/python-xlib/python-xlib/issues/151
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding KeyPress #151

Open
miniskipper opened this issue Oct 31, 2019 · 1 comment
Open

Question regarding KeyPress #151

miniskipper opened this issue Oct 31, 2019 · 1 comment
Labels

Comments

@miniskipper
Copy link

@miniskipper miniskipper commented Oct 31, 2019

When sending a KeyPress event with below code I would assume the key stays pressed until ... well ... forever. But all I get is a single "a".

`from Xlib import display,protocol,X,XK
import time

display = display.Display()
focus= display.get_input_focus()
window = focus.focus
keysym=XK.string_to_keysym("a")
keycode=display.keysym_to_keycode(keysym)
send_event = protocol.event.KeyPress(
time=int(time.time()),
root=display.screen().root,
window=window,
child=X.NONE,
same_screen=0,
root_x=0, root_y=0, event_x=0, event_y=0,
state=0,
detail=keycode
)
window.send_event(send_event)
display.sync()`

How to achieve a held down button?

@matanster
Copy link

@matanster matanster commented Sep 28, 2020

What you "get" depends on the window (application) receiving the event ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.
X Tutup