__init__ explanation please
I'm new to Python, and OOP. I've read most of Mark Lutz's book and more online and can write simple modules, but I still don't get when __init__ needs to be used as opposed to creating a class instance by assignment. For some strange reason the literature seems to take this for granted. I'd appreciate any pointers or links that can help clarify this. Thanks -- http://mail.python.org/mailman/listinfo/python-list
help with slicing/replacing matrix sections.
I see a more complicated thread on a similar sounding question, but my question is simpler, I hope. I have a large numpy matrix, initially created as: Mat = zeros((a,b), int) and a smaller array with other data Sub = [1,2,3,4,5],[6,7,8,9,0] I want to replace a section of Mat matrix with Sub matrix without having to loop through each cell in each matrix individually. I thought index/slice assignments, should be able to do that, but I can only get it to work (as per book examples) with simple arrays. Every syntax combination I have tried gives one error or another, typically "can't broadcast an object", but intuitively it seems there should be a simple solution. In short, how do I insert the data in the two (or any number of) rows in Sub[0:2] into any part of Mat starting at Mat[x,y] without using "for" loops ? -- http://mail.python.org/mailman/listinfo/python-list
A question about event handlers with wxPython
I'd appreciate any pointer on a simple way to tell within an event handler where the event came from. I want to have "while" condition in a handler to stop or change processing if an event occurs from some other button click. Trying to bind more than one event to the same handler still doesn't tell me where the event came from in a basic bind. Is there an argument I can put in the bind so as to identify the source of the event in the event argument? . -- http://mail.python.org/mailman/listinfo/python-list
Re: A question about event handlers with wxPython
> def HandleSomething(self, event): >generating_control = event.GetEventObject() >print generating_control > > HTH, Thank you.That is what I was looking for, but as often seems the case, one thing exposes another. Is there any way to listen for events without specifically binding to a handler (it seems one cannot bind an event to two handlers?)? One could do so with globals, but I'm trying to avoid that. For example, "press any button to stop" def HandleSomething(self, event): . while generating_control: == something: run else stop -- http://mail.python.org/mailman/listinfo/python-list
Re: A question about event handlers with wxPython
That all looks cool. I will experiment more. I'm a bit slow on this as only two weeks old so far. Thanks for the patience -- http://mail.python.org/mailman/listinfo/python-list
Re: A question about event handlers with wxPython
"Mike Driscoll" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Jan 15, 2:20 pm, "Erik Lind" <[EMAIL PROTECTED]> wrote: >> That all looks cool. I will experiment more. I'm a bit slow on this as >> only >> two weeks old so far. >> >> Thanks for the patience > > No problem. I'm pretty slow with some toolkits too...such as > SQLAlchemy. Ugh. > > Mike BTW, The wxPython group that you mentionedis that http://wxforum.shadonet.com/? -- http://mail.python.org/mailman/listinfo/python-list