Popular recipes tagged "event" but not "pygtk"http://code.activestate.com/recipes/tags/event-pygtk/2017-04-01T21:11:50-07:00ActiveState Code RecipesSimple signal library, similar to PyQT signals (Python) 2017-04-01T21:11:50-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580764-simple-signal-library-similar-to-pyqt-signals/ <p style="color: grey"> Python recipe 580764 by <a href="/recipes/users/4189907/">Miguel Martínez López</a> (<a href="/recipes/tags/event/">event</a>, <a href="/recipes/tags/pubsub/">pubsub</a>, <a href="/recipes/tags/signal/">signal</a>). Revision 11. </p> <p>Simple signal library similar to PyQT signals. Signals helps to decouple code in GUI applications. This code could be used in Tkinter applications for example.</p> <p>Inspired and based in these other modules:</p> <p><a href="https://github.com/shaunduncan/smokesignal" rel="nofollow">https://github.com/shaunduncan/smokesignal</a></p> <p><a href="https://github.com/dgovil/PySignal" rel="nofollow">https://github.com/dgovil/PySignal</a></p> <p><a href="https://github.com/jek/blinker" rel="nofollow">https://github.com/jek/blinker</a></p> Observer Design Pattern for python gevent coroutine package (Python) 2010-12-08T08:33:30-08:00Andrey Nikishaevhttp://code.activestate.com/recipes/users/4176176/http://code.activestate.com/recipes/577491-observer-design-pattern-for-python-gevent-coroutin/ <p style="color: grey"> Python recipe 577491 by <a href="/recipes/users/4176176/">Andrey Nikishaev</a> (<a href="/recipes/tags/event/">event</a>, <a href="/recipes/tags/gevent/">gevent</a>, <a href="/recipes/tags/observer/">observer</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>This is simple implementation of the observer design pattern. Acting as a registration hub, it fires events when requested. Also i have gevent.Timeout like interface in situations when you need to run event-method in the same greenlet. Example: </p> <pre class="prettyprint"><code>e = Observer() ev = e.wait('kill') try: gevent.sleep(3) except FiredEvent: print 'Fired!' else: print 'Not Fired!' finally: ev.cancel() </code></pre> <p>But rememeber, if you are using subscribe method, event-method will be executed in another greenlet.</p> Simple event dispatcher (Python) 2010-10-19T21:18:45-07:00Daniele Espostihttp://code.activestate.com/recipes/users/4174769/http://code.activestate.com/recipes/577432-simple-event-dispatcher/ <p style="color: grey"> Python recipe 577432 by <a href="/recipes/users/4174769/">Daniele Esposti</a> (<a href="/recipes/tags/dispatcher/">dispatcher</a>, <a href="/recipes/tags/event/">event</a>). </p> <p>An example of a simple event dispatcher mini-framework</p> Flexible observer pattern implementation (Python) 2012-12-06T19:23:11-08:00Glenn Eychanerhttp://code.activestate.com/recipes/users/4172294/http://code.activestate.com/recipes/576962-flexible-observer-pattern-implementation/ <p style="color: grey"> Python recipe 576962 by <a href="/recipes/users/4172294/">Glenn Eychaner</a> (<a href="/recipes/tags/event/">event</a>, <a href="/recipes/tags/observer/">observer</a>, <a href="/recipes/tags/pattern/">pattern</a>, <a href="/recipes/tags/publish/">publish</a>, <a href="/recipes/tags/subscribe/">subscribe</a>, <a href="/recipes/tags/threadsafe/">threadsafe</a>). Revision 16. </p> <p>A simple, flexible, general-purpose observer pattern.</p> <p>Observers can be callable objects or objects with a particular named method (handle_notify() by default). Events can be any object, and observers can select which events they are interested in receiving. Support for a number of different types of lightweight event objects is included.</p>