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

mpl_connect event.key has 'alt' prepended in matplotlib 1.2 on windows #2302

Closed
Ferguzz opened this issue Aug 16, 2013 · 9 comments
Closed
Milestone

Comments

@Ferguzz
Copy link

Ferguzz commented Aug 16, 2013

more information here: http://stackoverflow.com/questions/13933005/update-to-matplotlib-prepends-alt-to-keyrelease-event-key/

I'm running 32-bit xp. seems others on win7 and 64-bit systems are having the same issues.

@Ferguzz
Copy link
Author

Ferguzz commented Aug 16, 2013

Note: This issue is still present in v1.3.0.

@pelson
Copy link
Member

pelson commented Aug 16, 2013

Thanks for this @Ferguzz. Which backend are you using? WxAgg?

@Ferguzz
Copy link
Author

Ferguzz commented Aug 16, 2013

TkAgg. Switching to WxAgg does fix this problem.

@Ferguzz
Copy link
Author

Ferguzz commented Aug 19, 2013

It seems that the bitmask associated with 'alt' as defined in backend_tkagg.py (line 457) is incorrect. I don't have means to test on other systems but on mine a shift of 17 corresponds to 'alt', not a shift of 3.

@pelson
Copy link
Member

pelson commented Aug 19, 2013

Thanks @Ferguzz - sounds like this could be very platform specific. Might be worth looking if we can get hold constants that the Tkinter backend defines to avoid having to put if platform == 'Windoze' in the backend.

Are you up for investigating this possibility further?

Thanks!

@Ferguzz
Copy link
Author

Ferguzz commented Aug 20, 2013

Sure. I'll check it out.

@mrterry
Copy link
Contributor

mrterry commented Aug 23, 2013

I'm not surprised that TkAgg and WxAgg have different behavior. The key handling infrastructure is completely independent between backends. Is there any chance you could write a couple tests for the correct interpretation of a key event? I can help out on the Mac & Linux side. If you want a template, I added a few tests for key handling the QT4 backend (#2273).

@mbyt
Copy link
Contributor

mbyt commented Sep 21, 2013

I can reproduce this bug / alt prepending on windows7 python2.7.3 matplotlib1.2 and windows7 python2.7.5. matplotlib1.3. It do not have the problems on linux python2.7.5 matplotlib1.2. and windows7 python2.7.3 matplotlib1.1.

As mentioned by @Ferguzz backend_tkagg.py (line 457) should be 17 on windows. IMHO there is a platform specific hack for darwin on line 460 already, so why not adding just another one for windows...

I tried to look into a platform independent way. I do not find the explanation for the bit magic in the link of line 449 http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm. I think I am missing expertise or was this page updated? Seems like the tcl people also hard-code it to 17 http://wiki.tcl.tk/4238. Sorry, I just do not have enough GUI programming expertise...

Matplotlib is great, keep up the good work!

@tacaswell
Copy link
Member

Closing as @cgohlke claims to have fixed this in #2696

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

No branches or pull requests

5 participants