468,115 Members | 2,133 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,115 developers. It's quick & easy.

wxPython - get text from wxTextCtrl on a seperate frame

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'

Any help much appreciated.

Russ
Jul 18 '05 #1
3 2356
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'

Any help much appreciated.

Russ

First it might be better to ask this question on wxPython-user group rather
than here - it may help you in the future. *
I can't follow the code so I'll provide what I'd normally do.

First I would set my var
#I assume much here
mytextVar=txtMsg.GetValue()
#next create the control
Tcontrol=wx.TextCtrl(self,10,mytextVar, size=(200,300) ....
#make sure you add what style etc to the control
John
Jul 18 '05 #2
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
Jul 18 '05 #3
John Fabiani <jf******@yolo.com> wrote in message news:<z1*******************@newssvr14.news.prodigy .com>...
First it might be better to ask this question on wxPython-user group rather
than here - it may help you in the future.
I can't follow the code so I'll provide what I'd normally do.


Thanks, John.

As it happened, after I posted my question, I had lunch, and when I
came back to it, I got it working! Typical :-)

Thanks again for your help,

Russ
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Grant Edwards | last post: by
1 post views Thread by mdk.R | last post: by
reply views Thread by Scott | last post: by
2 posts views Thread by Nicolas Pourcelot | last post: by
3 posts views Thread by John Salerno | last post: by
5 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.