Benjamin Root about my miserable event problem :
Still not sure why my suggestion would not work:

http://matplotlib.sourceforge.net/api/cbook_api.html#matplotlib.cbook.CallbackRegistry

I thought I told you. Probably I am doing something utterly false, but my distilled problem is that*I am generating events from within a callback*. Here you are a complete skeleton program.


   from pylab import *
   from matplotlib.cbook import *
   from matplotlib.widgets import Button
   fig=figure()
   ax = fig.add_subplot(1,1,1)
   xis=axis([0,1,0,1])
   subplots_adjust(left=0.1, bottom=0.1)
   clrax = axes([0.67, 0.02, 0.08, 0.04])
   clbut = Button(clrax, 'Clear', color="1.0")
   goax = axes([0.88, 0.02, 0.08, 0.04])
   gobut = Button(goax, 'Go', color="#40ffa0")
   cbacks = CallbackRegistry()

   def line(*evt):
        plot(rand(2),rand(2)) ; draw()
        cbacks.process('line_', None)

   linv  = cbacks.connect('line_', line)

   def clr(ev=None): del ax.lines[:]
   clbut.on_clicked(clr)
   def start(evt): cbacks.process('line_', None)
   gobut.on_clicked(start)

   subplot(1,1,1)
   show()

The function line() is the main iterative engine, a "loop" without looping. It should post an event which re-launches it, and still leaving the master loop active, so I can clear the figure.

Nope. This is a /*recursive call*/.
Python bombs after a while, recursive limit exceeded, and only then the Clear button wakes up.

Thank you for your effort.

Jerzy

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to