Hi,
I’m working on a TextBox widget and have run into problems registering key_press_events with the macosx backend. button_press_events work, but key_press_events fail to trigger. If I change backends to tkAgg, everything triggers as expected.
Can anyone reproduce this?
Run the following script; click the figure and bang on the keyboard. Mouse clicks and keyboard clicks should echo on the screen. I’m using mpl 1.2.1 with Anaconda.
-matt
import pylab as plt
plt.switch_backend(‘macosx’)
def print_event(event):
print ‘event’, event
ax = plt.subplot(111)
fig = ax.figure
x = range(10)
ax.plot(x, x)
mouse clicks work on tkAgg & macosx
fig.canvas.mpl_connect(‘button_press_event’, print_event)
key presses only work on tkAgg
fig.canvas.mpl_connect(‘key_press_event’, print_event)
plt.show()
key_press_events in the script fail on my mac running OS X 10.8, python 3.3.2 from python.org and with both matplotlib 1.2.1 installed with pip and matplotlib-1.3.0rc2 from the matplotlib.org download page
They do work with the latest matplotlib 1.4 from github
hth,
Scott
···
On Jun 5, 2013, at 2:51 PM, Matt Terry <matt.terry@...287...> wrote:
Hi,
I'm working on a TextBox widget and have run into problems registering key_press_events with the macosx backend. button_press_events work, but key_press_events fail to trigger. If I change backends to tkAgg, everything triggers as expected.
Can anyone reproduce this?
Run the following script; click the figure and bang on the keyboard. Mouse clicks and keyboard clicks should echo on the screen. I'm using mpl 1.2.1 with Anaconda.
-matt
import pylab as plt
plt.switch_backend('macosx')
def print_event(event):
print 'event', event
ax = plt.subplot(111)
fig = ax.figure
x = range(10)
ax.plot(x, x)
# mouse clicks work on tkAgg & macosx
fig.canvas.mpl_connect('button_press_event', print_event)
# key presses only work on tkAgg
fig.canvas.mpl_connect('key_press_event', print_event)
plt.show()
The script works for me with matplotlib-1.2.1 both with Python2 and with Python3 with the MacOSX backend.
To rule out the usual culprit, is your Python3 installed as a framework?
Best,
-MIchiel.
···
----- Original Message -----
From: Scott Lasley <slasley@...2425...>
To: "matplotlib-users@lists.sourceforge.net" <matplotlib-users@...1753...forge.net>
Cc:
Sent: Thursday, June 6, 2013 4:50 AM
Subject: Re: [Matplotlib-users] key_press_events on macosx
On Jun 5, 2013, at 2:51 PM, Matt Terry <matt.terry@...287...> wrote:
Hi,
I'm working on a TextBox widget and have run into problems registering key_press_events with the macosx backend. button_press_events work, but key_press_events fail to trigger. If I change backends to tkAgg, everything triggers as expected.
Can anyone reproduce this?
Run the following script; click the figure and bang on the keyboard. Mouse clicks and keyboard clicks should echo on the screen. I'm using mpl 1.2.1 with Anaconda.
-matt
import pylab as plt
plt.switch_backend('macosx')
def print_event(event):
print 'event', event
ax = plt.subplot(111)
fig = ax.figure
x = range(10)
ax.plot(x, x)
# mouse clicks work on tkAgg & macosx
fig.canvas.mpl_connect('button_press_event', print_event)
# key presses only work on tkAgg
fig.canvas.mpl_connect('key_press_event', print_event)
plt.show()
key_press_events in the script fail on my mac running OS X 10.8, python 3.3.2 from python.org and with both matplotlib 1.2.1 installed with pip and matplotlib-1.3.0rc2 from the matplotlib.org download page
They do work with the latest matplotlib 1.4 from github
hth,
Scott
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
I’ve only tested against the prepackaged python 2.7, mpl 1.2.1 in an anaconda install. Anaconda is not a framework build.
···
On Jun 5, 2013 4:50 PM, “Michiel de Hoon” <mjldehoon@…9…> wrote:
The script works for me with matplotlib-1.2.1 both with Python2 and with Python3 with the MacOSX backend.
To rule out the usual culprit, is your Python3 installed as a framework?
Best,
-MIchiel.
----- Original Message -----
From: Scott Lasley <slasley@…4375…5…>
To: "matplotlib-users@lists.sourceforge.net" matplotlib-users@lists.sourceforge.net
Cc:
Sent: Thursday, June 6, 2013 4:50 AM
Subject: Re: [Matplotlib-users] key_press_events on macosx
On Jun 5, 2013, at 2:51 PM, Matt Terry <matt.terry@…287…> wrote:
Hi,
I’m working on a TextBox widget and have run into problems registering key_press_events with the macosx backend. button_press_events work, but key_press_events fail to trigger. If I change backends to tkAgg, everything triggers as expected.
Can anyone reproduce this?
Run the following script; click the figure and bang on the keyboard. Mouse clicks and keyboard clicks should echo on the screen. I’m using mpl 1.2.1 with Anaconda.
-matt
import pylab as plt
plt.switch_backend(‘macosx’)
def print_event(event):
print 'event', event
ax = plt.subplot(111)
fig = ax.figure
x = range(10)
ax.plot(x, x)
mouse clicks work on tkAgg & macosx
fig.canvas.mpl_connect(‘button_press_event’, print_event)
key presses only work on tkAgg
fig.canvas.mpl_connect(‘key_press_event’, print_event)
plt.show()
key_press_events in the script fail on my mac running OS X 10.8, python 3.3.2 from python.org and with both matplotlib 1.2.1 installed with pip and matplotlib-1.3.0rc2 from the matplotlib.org download page
They do work with the latest matplotlib 1.4 from github
hth,
Scott
How ServiceNow helps IT people transform IT departments:
-
A cloud service to automate IT design, transition and operations
-
Dashboards that offer high-level views of enterprise services
-
A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
How ServiceNow helps IT people transform IT departments:
-
A cloud service to automate IT design, transition and operations
-
Dashboards that offer high-level views of enterprise services
-
A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
I have python 3.3.2 from python.org installed as a Framework. I set up a virtualenv to test the script
$ virtualenv-3.3 mpl121 --no-site-packages
$ .mpl121/bin/activate
$ pip-3.3 install numpy
$ pip-3.3 install matplotlib
With this setup, key events are passed to the window behind the active plot window and no event is printed by the test script. Mouse clicks in the plot window do cause the script to print out the event. I even tried installing 1.4.x into the virtualenv with
$ pip-3.3 install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib
The key events were not printed out by the script.
I tried creating a different virtualenv using --system-site-packages and the script failed to detect key events.
If I deactivate the virtualenvs and run the script with matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
the key events are printed by the script.
I'm not sure why using matplotlib from a virtualenv causes the key events to be ignored in my setup. I should have stated in my first reply that I used a virtualenv to test 1.2.1 and 1.3.0rc2 but not 1.4.x.
Scott
···
On Jun 5, 2013, at 7:49 PM, Michiel de Hoon <mjldehoon@...9...> wrote:
The script works for me with matplotlib-1.2.1 both with Python2 and with Python3 with the MacOSX backend.
To rule out the usual culprit, is your Python3 installed as a framework?
Best,
-MIchiel.
----- Original Message -----
From: Scott Lasley <slasley@...2425...>
To: "matplotlib-users@lists.sourceforge.net" <matplotlib-users@...1544...ceforge.net>
Cc:
Sent: Thursday, June 6, 2013 4:50 AM
Subject: Re: [Matplotlib-users] key_press_events on macosx
On Jun 5, 2013, at 2:51 PM, Matt Terry <matt.terry@...287...> wrote:
Hi,
I'm working on a TextBox widget and have run into problems registering key_press_events with the macosx backend. button_press_events work, but key_press_events fail to trigger. If I change backends to tkAgg, everything triggers as expected.
Can anyone reproduce this?
Run the following script; click the figure and bang on the keyboard. Mouse clicks and keyboard clicks should echo on the screen. I'm using mpl 1.2.1 with Anaconda.
-matt
import pylab as plt
plt.switch_backend('macosx')
def print_event(event):
print 'event', event
ax = plt.subplot(111)
fig = ax.figure
x = range(10)
ax.plot(x, x)
# mouse clicks work on tkAgg & macosx
fig.canvas.mpl_connect('button_press_event', print_event)
# key presses only work on tkAgg
fig.canvas.mpl_connect('key_press_event', print_event)
plt.show()
key_press_events in the script fail on my mac running OS X 10.8, python 3.3.2 from python.org and with both matplotlib 1.2.1 installed with pip and matplotlib-1.3.0rc2 from the matplotlib.org download page
They do work with the latest matplotlib 1.4 from github
hth,
Scott