wxPython - get text from wxTextCtrl on a seperate frame
Peter Hansen
peter at engcorp.com
Wed Oct 27 15:50:07 EDT 2004
Russ Phillips wrote:
> I'm just starting to learn Python & wxPython. I have a frame named
> frSend in a file fSend. On this frame is a wxTextCtrl named txtMsg. I
> have a module named defs.py
>
> I would like to get the value of txtMsg from within defs.py
>
> I tried the following:
>
> BodyText = fSend.frSend.txtMsg.GetValue ()
>
> When I run it, I get the following error:
>
> AttributeError: class frSend has no attribute 'txtMsg'
As stated in this error message, you are referring to
a wx.Frame *class*, not an instance, and apparently not
what you thought you were doing. Note the difference
in the error messages produced below:
>>> class A:
... pass
...
>>> a = A()
>>>
>>> a.test
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: A instance has no attribute 'test'
>>> A.test
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: class A has no attribute 'test'
-Peter
More information about the Python-list
mailing list