Keyboard input ignored

I’m currently running Kubuntu, if it matters (KWin window manager with KDE Plasma environment, Oracular Oriole version of Ubuntu).
I was at first having issues with a tutorial I was following regarding keyboard inputs; no matter what, the program would not accept them! Checking the forums, I decided to look at the Roaming Ralph example and see what was up. Ran it, keyboard inputs don’t work there either. The only thing it will readily accept are mouse inputs!
No idea how to approach this problem, any suggestions?

Additional info: panda3d was installed first via pip. For whatever reason, I couldn’t find the sample programs under this installation, so I also installed panda3d via the provided.deb file.
I’m writing and running python programs using IDLE

3rd Update, sorry!
Turns out, key inputs are only accepted if I run my program using sudo.
Running the program by pressing F5 in IDLE is when I was facing this issue.
This is kind of a solution? I think this is less of a panda3d thing and more of a Linux thing… I’ll keep digging and post a solution when I can, assuming someone doesn’t beat me to it.

Update: Looked at another forum post here where some folks were speaking of issues regarding file ownership/permissions on the lib files. Couldn’t figure out if it was an issue, so instead I tried running the same python files in a virtual environment (python’s venv stuff) and had the same issue–only sudo fixed it. Tried compiling the Asteroids example and running the compiled product thru console. No keyboard inputs unless ran as superuser.

Hi, welcome to the community!

Huh, I’ve not seen this kind of issue before, do other X11-based games work?

1 Like

Thank you, and that is a great question! I’m not certain if I have any X11 games to test this out with. I will search for a random X11 game or two and come back with an answer in just a moment. If you have suggestions for a quick one to test, lmk! :slight_smile:

Ok, I searched for a couple of X11 games on Apt and tried them out. They have pretty high framerates, but keyboard inputs appear to be working as expected on those.

Could you put this in your /etc/Config.prc file (this file may be in another location depending on how you installed Panda3D) ?

notify-level-x11display spam

and post the full command-line output, including after pressing keys?

Do the inputs show up when calling base.messenger.toggleVerbose()?

When you use the xev tool and press the W key, what does it output?

Which precise version of Panda3D did you install? How did you install it?

1 Like

( 1 )
Okay, I’ve put notify-level-x11display spam into the requested file. When running my program via Konsole or IDLE, I’m not getting any messages in either.

( 2 )
When I call base.messenger.toggleVerbose() in my program, I’m getting the message NameError: name 'base' is not defined. Did you mean: 'False'? This is likely because I called it incorrectly, so apologies in advance (frankly, I wasn’t sure where to put it, so I placed it under def __init__(self):).

( 3 )
Running xev, I get the following:

KeyPress event, serial 39, synthetic NO, window 0x2400001,
    root 0x376, subw 0x0, time 14389646, (32,-225), root:(2823,215),
    state 0x10, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XmbLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

KeyRelease event, serial 39, synthetic NO, window 0x2400001,
    root 0x376, subw 0x0, time 14389736, (32,-225), root:(2823,215),
    state 0x10, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

If it matters, I get this when I have xev running and I click on the Panda3D window:

FocusOut event, serial 39, synthetic NO, window 0x2600001,
    mode NotifyNormal, detail NotifyNonlinear

PropertyNotify event, serial 39, synthetic NO, window 0x2600001,
    atom 0x141 (_NET_WM_STATE), time 14448962, state PropertyNewValue

( 4 )
To install Panda3D 1.10.15, I did it in sort of a strange way. I used pip install panda3d --break-system-packages
Suspecting this was probably the issue, I also tried it in a virtual environment but saw no change in behavior.
To get the sample programs (when I was testing Roaming Ralph to see if it was user error or something else), I used the provided .deb for Oracular Oriole under the Panda3D website.

Apologies for the disorganization in my response, I hope I was able to answer your questions adequately! Please let me know if I did something incorrectly.

Okay, you’ve got two versions of Panda3D installed, one via the .deb and one via pip; I wonder if that might be a problem. It certainly explains why you would have /etc/Config.prc but it doesn’t take effect - it’s actually reading the one in your pip installation. (This is why they make you type --break-system-packages. :p)

I suggest uninstalling it from pip and seeing if the one from the .deb works. Failing that, copying the samples to a different folder and uninstalling the .deb, and finding where the Config.prc is located that belongs to the pip-installed Panda.

The pip build of Panda3D is built a little differently than the .deb build, and I think the .deb build has a better chance of working in theory. I don’t fully know what happens if you have both.

As for where to put the toggleVerbose line, you should either move it under the ShowBase.__init__(self) line, or right above the demo.run() line at the end of the file.

1 Like

Alright, just ran pip uninstall panda3d and Config.prc has remained in /etc.
In /usr/local/lib, I appear to have both a Python 3.12 and a Python 3.13 folder somehow, each with a panda3d and panda3d.dist-info folder inside of a dist-packages directory… :thinking:
Anyway, I do have a folder full of panda3d files hanging out in /usr/share, which I assume is the one generated by the .deb?

Anyway, with notify-level-x11display spam in Config.prc, still no dice on IDLE.
Running the .py via Konsole (python 3 command followed by the .py file) does give me this, though:

Known pipe types:
  glxGraphicsPipe
(1 aux display modules not yet loaded.)
Xlib:  extension "XFree86-DGA" missing on display ":1".
:display:x11display(debug): Found RandR extension 1.6
:display:x11display(debug): Using XRRScreenResources to obtain display modes
:display:x11display(debug): Determined display zoom to be 1 based on specified Xft.dpi 96
:display:x11display(debug): Raw mice not requested.
:display:x11display(debug): Received ConfigureNotify event after 0.0 ms

With regards to the XFree86-DGA stuff, this is a weird one. I was talking to a friend of mine about this earlier today. Despite this popping up, Apt tells me I already have libxxf86dga1 installed. Not sure if this has anything to do with the keyboard issue, but thought I’d mention it :slight_smile:

Putting base.messenger.toggleVerbose() either under ShowBase.__init__(self) or above demo.run() gave me the same results:
Verbose mode true. quiet list = ['NewFrame', 'avatarMoving', 'event-loop-done', 'collisionLoopFinished']
No other messages after that, other than what I tell Python to print (state changes in the keymap mostly, which are only reacting to mouse clicks).

I was goofing off with the program, running it with sudo (which allows keyboard inputs to work for some reason) and got some new behavior in the console; I think it’s the verbose messenger? The stuff about left, right, whatever being True or False is debugging stuff from my keymap.

left set to False
:Messenger(debug): sent event: time-raw-a-up sentArgs = [18.463608], taskChain = None
:Messenger(debug): sent event: time-a-up sentArgs = [18.463608], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: d sentArgs = [], taskChain = None
right set to True
:Messenger(debug): sent event: time-raw-d sentArgs = [18.613506], taskChain = None
:Messenger(debug): sent event: time-d sentArgs = [18.613506], taskChain = None
:Messenger(debug): sent event: raw-s-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: s-up sentArgs = [], taskChain = None
down set to False
:Messenger(debug): sent event: time-raw-s-up sentArgs = [18.730394], taskChain = None
:Messenger(debug): sent event: time-s-up sentArgs = [18.730394], taskChain = None
:Messenger(debug): sent event: raw-d-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: d-up sentArgs = [], taskChain = None
right set to False
:Messenger(debug): sent event: time-raw-d-up sentArgs = [18.863557], taskChain = None
:Messenger(debug): sent event: time-d-up sentArgs = [18.863557], taskChain = None
:Messenger(debug): sent event: raw-w sentArgs = [], taskChain = None
:Messenger(debug): sent event: w sentArgs = [], taskChain = None
up set to True
:Messenger(debug): sent event: time-raw-w sentArgs = [20.16364], taskChain = None
:Messenger(debug): sent event: time-w sentArgs = [20.16364], taskChain = None
:Messenger(debug): sent event: raw-w-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: w-up sentArgs = [], taskChain = None
up set to False
:Messenger(debug): sent event: time-raw-w-up sentArgs = [20.580206], taskChain = None
:Messenger(debug): sent event: time-w-up sentArgs = [20.580206], taskChain = None
:Messenger(debug): sent event: window-event sentArgs = [<panda3d.core.GraphicsWindow object at 0x7cdfacf0b810>], taskChain = None

These are the messages you were looking for, right? These messages do not appear in the instances not opened with sudo (which means either running python3 <program> in Konsole or hitting F5 in IDLE)

UPDATE: Wait a sec! I’m getting messages now! I apologize, I was running it through IDLE and expecting the shell to spit out messages. When opening the program in Konsole without sudo I get this:

:Messenger(debug): sent event: time-mouse1-up sentArgs = [1.717957], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-d sentArgs = [1.8634859999999998], taskChain = None
:Messenger(debug): sent event: raw-w sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-w sentArgs = [2.2519479999999996], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [2.4689810000000003], taskChain = None
:Messenger(debug): sent event: raw-s sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-s sentArgs = [2.685925], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-d sentArgs = [2.8860020000000004], taskChain = None
:Messenger(debug): sent event: raw-w sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-w sentArgs = [3.0309869999999997], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [3.136032], taskChain = None
:Messenger(debug): sent event: raw-s sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-s sentArgs = [3.268826], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-d sentArgs = [3.380152], taskChain = None
:Messenger(debug): sent event: raw-w sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-w sentArgs = [3.4971360000000002], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [3.569394], taskChain = None
:Messenger(debug): sent event: raw-s sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-s sentArgs = [3.7192050000000005], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-d sentArgs = [3.802894], taskChain = None
:Messenger(debug): sent event: raw-w sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-w sentArgs = [3.936565], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [4.0202420000000005], taskChain = None
:Messenger(debug): sent event: raw-s sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-s sentArgs = [4.169573000000001], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-d sentArgs = [4.304056], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [4.472835], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-d sentArgs = [4.621892], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [4.714559], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-d sentArgs = [4.8144100000000005], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [4.915742], taskChain = None
:Messenger(debug): sent event: raw-d sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-d sentArgs = [4.969792], taskChain = None
:Messenger(debug): sent event: window-event sentArgs = [<panda3d.core.GraphicsWindow object at 0x7f91d2f167c0>], taskChain = None

It’s getting raw keybinds but not actually doing anything with them, I guess? Very weird.

For posterity, here are what the messages look like for mouse clicks, which are registered regardless of being the superuser or not.

:Messenger(debug): sent event: time-mouse1-up sentArgs = [321.651585], taskChain = None
:Messenger(debug): sent event: mouse1 sentArgs = [], taskChain = None
shoot set to True
:Messenger(debug): sent event: time-mouse1 sentArgs = [323.54947000000004], taskChain = None
Zap!
:Messenger(debug): sent event: mouse1-up sentArgs = [], taskChain = None
shoot set to False

The Zap! line is a debug print.

That’s bizarre! You’re getting raw events but not regular ones. But it does narrow down the problem a bit further.

Can you give me the output of setxkbmap -print -verbose 10 ?

Does pressing something with a modifier, like “shift-a” print anything?

The DGA stuff is not important.

1 Like

Here are the results of setxkbmap -print -verbose 10:

Setting verbose level to 10
WARNING: Running setxkbmap against an Xwayland server
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)
geometry:   pc(pc105)
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(evdev)"     };
        xkb_geometry  { include "pc(pc105)"     };
};

As for modified keys, here is the output from panda3d.
Non-superuser pressing Shift+A:

:Messenger(debug): sent event: window-event sentArgs = [<panda3d.core.GraphicsWindow object at 0x777844b39bc0>
], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [4.848572000000001], taskChain = None
:Messenger(debug): sent event: raw-lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift sentArgs = [5.765813], taskChain = None
:Messenger(debug): sent event: raw-lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift sentArgs = [7.015916000000001], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [7.300270000000001], taskChain = None
:Messenger(debug): sent event: raw-lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift sentArgs = [8.721652], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [9.015466], taskChain = None
:Messenger(debug): sent event: window-event sentArgs = [<panda3d.core.GraphicsWindow object at 0x777844b39770>
], taskChain = None

Shift+A from superuser:

:Messenger(debug): sent event: time-raw-d-up sentArgs = [3.0650969999999997], taskChain = None
:Messenger(debug): sent event: time-d-up sentArgs = [3.0650969999999997], taskChain = None
:Messenger(debug): sent event: raw-lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift sentArgs = [], taskChain = None
:Messenger(debug): sent event: lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift sentArgs = [3.865626], taskChain = None
:Messenger(debug): sent event: time-shift sentArgs = [3.865626], taskChain = None
:Messenger(debug): sent event: time-lshift sentArgs = [3.865626], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [3.8823369999999997], taskChain = None
:Messenger(debug): sent event: time-a sentArgs = [3.8823369999999997], taskChain = None
:Messenger(debug): sent event: raw-lshift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: lshift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift-up sentArgs = [3.9962609999999996], taskChain = None
:Messenger(debug): sent event: time-shift-up sentArgs = [3.9962609999999996], taskChain = None
:Messenger(debug): sent event: time-lshift-up sentArgs = [3.9962609999999996], taskChain = None
:Messenger(debug): sent event: raw-a-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: a-up sentArgs = [], taskChain = None
left set to False
:Messenger(debug): sent event: time-raw-a-up sentArgs = [4.015974], taskChain = None
:Messenger(debug): sent event: time-a-up sentArgs = [4.015974], taskChain = None
:Messenger(debug): sent event: raw-lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift sentArgs = [], taskChain = None
:Messenger(debug): sent event: lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift sentArgs = [4.560808], taskChain = None
:Messenger(debug): sent event: time-shift sentArgs = [4.560808], taskChain = None
:Messenger(debug): sent event: time-lshift sentArgs = [4.560808], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [4.669197], taskChain = None
:Messenger(debug): sent event: time-a sentArgs = [4.669197], taskChain = None
:Messenger(debug): sent event: raw-lshift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: lshift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift-up sentArgs = [4.777854], taskChain = None
:Messenger(debug): sent event: time-shift-up sentArgs = [4.777854], taskChain = None
:Messenger(debug): sent event: time-lshift-up sentArgs = [4.777854], taskChain = None
:Messenger(debug): sent event: raw-a-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: a-up sentArgs = [], taskChain = None
left set to False
:Messenger(debug): sent event: time-raw-a-up sentArgs = [4.795172], taskChain = None
:Messenger(debug): sent event: time-a-up sentArgs = [4.795172], taskChain = None
:Messenger(debug): sent event: raw-lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift sentArgs = [], taskChain = None
:Messenger(debug): sent event: lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift sentArgs = [5.266855], taskChain = None
:Messenger(debug): sent event: time-shift sentArgs = [5.266855], taskChain = None
:Messenger(debug): sent event: time-lshift sentArgs = [5.266855], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [5.378658], taskChain = None
:Messenger(debug): sent event: time-a sentArgs = [5.378658], taskChain = None
:Messenger(debug): sent event: raw-lshift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: lshift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift-up sentArgs = [5.495614], taskChain = None
:Messenger(debug): sent event: time-shift-up sentArgs = [5.495614], taskChain = None
:Messenger(debug): sent event: time-lshift-up sentArgs = [5.495614], taskChain = None
:Messenger(debug): sent event: raw-a-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: a-up sentArgs = [], taskChain = None
left set to False
:Messenger(debug): sent event: time-raw-a-up sentArgs = [5.520341], taskChain = None
:Messenger(debug): sent event: time-a-up sentArgs = [5.520341], taskChain = None
:Messenger(debug): sent event: raw-lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift sentArgs = [], taskChain = None
:Messenger(debug): sent event: lshift sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift sentArgs = [6.021294999999999], taskChain = None
:Messenger(debug): sent event: time-shift sentArgs = [6.021294999999999], taskChain = None
:Messenger(debug): sent event: time-lshift sentArgs = [6.021294999999999], taskChain = None
:Messenger(debug): sent event: raw-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift-a sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-a sentArgs = [6.1289039999999995], taskChain = None
:Messenger(debug): sent event: time-a sentArgs = [6.1289039999999995], taskChain = None
:Messenger(debug): sent event: raw-lshift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: shift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: lshift-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-raw-lshift-up sentArgs = [6.2211419999999995], taskChain = None
:Messenger(debug): sent event: time-shift-up sentArgs = [6.2211419999999995], taskChain = None
:Messenger(debug): sent event: time-lshift-up sentArgs = [6.2211419999999995], taskChain = None
:Messenger(debug): sent event: raw-a-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: a-up sentArgs = [], taskChain = None
left set to False
:Messenger(debug): sent event: time-raw-a-up sentArgs = [6.254493999999999], taskChain = None
:Messenger(debug): sent event: time-a-up sentArgs = [6.254493999999999], taskChain = None
:Messenger(debug): sent event: window-event sentArgs = [<panda3d.core.GraphicsWindow object at 0x79083e29d380>], taskChain = None

Been toying with this some more, but I can’t make heads or tails of this

Do I gather correctly from your earlier posts that you’re on Linux?

If so, then, doing a bit of searching around, I’ve found some reports that indicate that such things can happen, and seem to be related to permissions.

(That said, I’m not sufficiently familiar with Panda’s internals to know how it reads the keyboard, and thus whether what I’m seeing is relevant.)

If the following page is accurate to your issue, and if I’m understanding it correctly, it may be that your user-account lacks access to the relevant group:

(See also this page, to similar effect, I believe: Can I access the keyboard in a virtual environment that was not created with sudo? - Raspberry Pi Stack Exchange )

1 Like