Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Interactive Applications using Matplotlib

You're reading from  Interactive Applications using Matplotlib

Product type Book
Published in Mar 2015
Publisher
ISBN-13 9781783988846
Pages 174 pages
Edition 1st Edition
Languages

Editor events


Let's now re-imagine our existing features as a set of events:

  • Change frame

  • Select storm

  • Deselect storm

  • Hide storm cells

  • Delete storm cell

  • Save storm data

  • Display help

We will add two new methods to the ControlSys class: _connect() and _emit(). They are merely shorthand for the mpl_connect() command and the recently introduced process() method. In the constructor, we will connect some methods to the events we have just listed. In the case of the help method and the storm saving method, the methods originally supplied to the keymap will be connected to these two new events, and the keymap will instead merely call _emit() of the respective events. This can give a taste of fully customizable keymaps in the future. Meanwhile, this is what our constructor and the two new _emit() and _connect() methods now look like:

Source: chp2/stormcell_editor2.py

class ControlSys(KeymapControl, PickControl):
    def __init__(self, fig, raddisp, data, polygons, stormdata):
        self.fig = fig
    ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}