hopefully a simple one

16 views
Skip to first unread message

Nathan smith

unread,
Feb 2, 2021, 6:16:22 PM2/2/21
to wxpytho...@googlegroups.com
Hello Group,


I hope everyone is keeping safe.

I have a hopefully easy question this time, something I'm sure is
obvious and I'm just typoing somewhere.

I'm trying to bind to the play, stop, next and previous media buttons on
the keyboard, shown below:


    self.RegisterHotKey(self.mid1, None, wx.WXK_MEDIA_NEXT_TRACK)
    self.RegisterHotKey(self.mid2, None, wx.WXK_MEDIA_PREV_TRACK)
    self.RegisterHotKey(self.mid3, None, wx.WXK_MEDIA_PLAY_PAUSE)
    self.RegisterHotKey(self.mid4, None, wx.WXK_MEDIA_STOP)


Sadly, I get AttributeError: module 'wx' has no attribute
'WXK_MEDIA_NEXT_TRACK'


Did I miss something? I got these attributes from the website...

Best

Nathan

Transana

unread,
Feb 2, 2021, 6:25:55 PM2/2/21
to wxpytho...@googlegroups.com
Hi Nathan,

What version of wxPython are you using?  What OS?  What python version?

In version 4.1.1 on Windows 10, I see these constants in the wx
package.  I also see them in version 4.1.1 on macOS Catalina. (I'm using
Python 3.7 on both platforms.)

David
--
David K. Woods, Ph.D.
President, Researcher, and Lead Transana Developer
https://www.transana.com
Pronouns: he, him, his

Nathan smith

unread,
Feb 2, 2021, 6:30:28 PM2/2/21
to wxpytho...@googlegroups.com
Hi there,


Sorry, I meant to include that and forgot!

Python version: 3.8.6 32 bit

Windows: 10,

WX Version: '4.0.7.post2 msw (phoenix) wxWidgets 3.0.5'



Slightly earlier version as I think 4.1.0 breaks some accessibility
features to do with the naming of lists IIRC.


Thanks in advance!

Nathan

Scott Talbert

unread,
Feb 2, 2021, 10:42:50 PM2/2/21
to wxpytho...@googlegroups.com
That's definitely a good question. I don't see wx.WXK_MEDIA_NEXT_TRACK in
4.0.7, but I do see it in 4.1.x. So it may be a wxWidgets 3.1+ thing.

Scott
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to wxpython-user...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wxpython-users/71ab3f85-6328-bdbf-11fe-fb02fa804096%40gmail.com.
>

Nathan smith

unread,
Feb 4, 2021, 7:33:46 AM2/4/21
to wxpytho...@googlegroups.com
Hi folks,


Just in case someone has this problem in the future.

I'm not sure if it would have worked with the wx version, but if you use
win32con.VK_ and then Media_playpause and such, it works perfectly
irrespective of WX version.

Best

Nathan

On 02/02/2021 23:25, Transana wrote:
Reply all
Reply to author
Forward
0 new messages