I must have missed something critical with wxPython, or Python itself. I
have discovered that putting a triple, double-quoted comment immediately
after the 'def On...(self, event):' line of a bound method prevents the
contents from executing. Took me hours of searching before I decided to move
the comment out of the method definition. Then, the code inside executed.
The comment constipated the method so it was really bound.
Is this documented somewhere? I wonder how many other gotcha's I'll find
before I learn where they are.
Rich
···
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
I must have missed something critical with wxPython, or Python itself. I
have discovered that putting a triple, double-quoted comment immediately
after the 'def On...(self, event):' line of a bound method prevents the
contents from executing.
That seems a bit odd to me... you mean something like:
def OnMouseClicke(self, event):
""" My comments here. """
event.Skip()
? Well, I have seen hundreds of Python scripts that use this syntax,
and it seems quite strange that the method is not working...
That seems a bit odd to me... you mean something like:
Andrea,
Seems odd to me, too.
def OnMouseClicke(self, event):
""" My comments here. """
event.Skip()
I put the quotes on separate lines, viz:
def OnMouseClicke(self, event):
"""
My comments here.
"""
event.Skip()
Rich
···
On Tue, 6 Feb 2007, Andrea Gavana wrote:
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
Haven't tried. But, when I put the comment back, with the quotes on the
same lines, it works.
Why it didn't work the other way will probably remain a mystery. But, as
long as it works either in-line or with the comment external to the method,
that's OK with me.
Thanks,
Rich
···
On Tue, 6 Feb 2007, Andrea Gavana wrote:
Can you try the enclosed script to see if it works for you? I have no
problems in running it here, Windows XP, Python 2.5, wxPython 2.8.1.1.
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
> Can you try the enclosed script to see if it works for you? I have no
> problems in running it here, Windows XP, Python 2.5, wxPython 2.8.1.1.
Andrea,
Haven't tried. But, when I put the comment back, with the quotes on the
same lines, it works.
It's not that big script, it takes a second to try it.
Why it didn't work the other way will probably remain a mystery. But, as
long as it works either in-line or with the comment external to the method,
that's OK with me.
But it *does* work in whatever way you put the comments, at least with
my configuration.
Haven't tried. But, when I put the comment back, with the quotes on the
same lines, it works.
Why it didn't work the other way will probably remain a mystery. But, as
long as it works either in-line or with the comment external to the method,
that's OK with me.
Have you tried putting the quotes back on separate lines -- it certainly should work. My only ideas:
line feed characters get messed up?
indentation messed up (hidden tabs?)
It is just plain weird.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Have you tried putting the quotes back on separate lines -- it certainly should work.
Chris,
Yes, I did. And it did work.
line feed characters get messed up?
No. EOLs are strictly '\n' here in linux land.
indentation messed up (hidden tabs?)
Nothing. I looked.
It is just plain weird.
Yes, it is. I looked at every line of code when nothing happened when I
pressed the 'Add' button. The first line after the comment was,
print 'just entered OnAdd method'
Nothing printed ... until I moved the comment out. Then it worked when I
put the comment back, with new quotes.
Jus' another of them thar darn computer moments. Sorry for the static on
the list.
Rich
···
On Tue, 6 Feb 2007, Christopher Barker wrote:
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863