The "pause" key

Is there a means of receiving key events from the “pause” key on a keyboard? It’s not mentioned in the manual, and the output provided by a call to “messenger.toggleVerbose()” doesn’t seem to include messages from the “pause” key.

I can easily enough use other keys (and indeed I intend to), but I’d like to be able to use the “pause” key too for my “pause” functionality.

This is the output I get from “messenger.toggleVerbose()” for the Pause key:

:Messenger(debug): sent event: pause sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-pause sentArgs = [7.722342287268649], taskChain = None
:Messenger(debug): sent event: pause-up sentArgs = [], taskChain = None
:Messenger(debug): sent event: time-pause-up sentArgs = [7.834203088464799], taskChain = None

And the following code also produces the expected output:

from panda3d.core import *
from direct.showbase.ShowBase import ShowBase

class Panda3DApp(ShowBase):

  def __init__(self):

    ShowBase.__init__(self)
    
    def confirmPauseKeyPressed():
      print "Pause key pressed."
    
    def confirmPauseKeyReleased():
      print "Pause key released."

    self.accept("pause", confirmPauseKeyPressed)
    self.accept("pause-up", confirmPauseKeyReleased)
      
    self.run()


Panda3DApp()

So it does seem to work, despite not being mentioned in the manual. The Pause key is listed in the API reference as a KeyboardButton, though;
does base.mouseWatcherNode.isButtonDown(KeyboardButton.pause()) work for you?

Perhaps your keyboard has a Fn modifier key, which needs to be (un)locked for the Pause key to work?

Ah, thank you.

It looks as though the problem is on my end: after reading your post, I did a little further checking, and it would appear that my “pause” key isn’t working. I’ll likely just include the appropriate “accept” call for “pause” and hopefully remember to check it when I get around to testing my project on another machine.

My apologies – given that I have had trouble with some of my keys, I should perhaps have thought to check the key itself first! ^^;;

Perhaps this could be a platform issue - are you perhaps using Panda on a platform for which we haven’t added the necessary code to catch the pause key correctly?

I suppose that it’s possible, but some testing on my side outside of Panda3D strongly suggests that my “pause” key is one of the non-functional keys on my keyboard, more’s the pity.

I could try connecting an external keyboard and experimenting with that, I imagine, but I’m inclined to worry about it at a later stage for now, I think.