mirror of
https://github.com/Estom/notes.git
synced 2026-11-30 08:05:23 +08:00
matplotlib & pandas
This commit is contained in:
24
Python/matplotlab/gallery/event_handling/close_event.md
Normal file
24
Python/matplotlab/gallery/event_handling/close_event.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# 关闭事件
|
||||
|
||||
显示图形关闭时发生的连接事件的示例。
|
||||
|
||||

|
||||
|
||||
```python
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
def handle_close(evt):
|
||||
print('Closed Figure!')
|
||||
|
||||
fig = plt.figure()
|
||||
fig.canvas.mpl_connect('close_event', handle_close)
|
||||
|
||||
plt.text(0.35, 0.5, 'Close Me!', dict(size=30))
|
||||
plt.show()
|
||||
```
|
||||
|
||||
## 下载这个示例
|
||||
|
||||
- [下载python源码: close_event.py](https://matplotlib.org/_downloads/close_event.py)
|
||||
- [下载Jupyter notebook: close_event.ipynb](https://matplotlib.org/_downloads/close_event.ipynb)
|
||||
Reference in New Issue
Block a user