1
0
Fork 0

Update rfplot.py

merge-requests/2/head
Michał Drzał 2022-06-18 18:24:45 +02:00 committed by GitHub
parent 27f0bc7778
commit 08d0303f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -5,11 +5,17 @@ from strf.rfio import Spectrogram
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.backend_bases import MouseButton
def on_press(event):
handle(event.key, event.xdata, event.ydata)
sys.stdout.flush()
def on_click(event):
if event.button is MouseButton.MIDDLE:
handle("MIDDLE", event.xdata, event.ydata)
sys.stdout.flush()
def handle(key, x, y):
print(f"pressed {key} over x={x} y={y}")
sys.stdout.flush()
@ -49,4 +55,5 @@ if __name__ == "__main__":
fig.canvas.mpl_connect('key_press_event', on_press)
fig.canvas.mpl_connect('button_press_event', on_click)
plt.show()