wxPython - get text from wxTextCtrl on a seperate frame

John Fabiani jfabiani at yolo.com
Wed Oct 27 10:12:47 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'
> 
> 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



More information about the Python-list mailing list