Help for access method of wxPython object
Robin Dunn
robin at stop.spam.alldunn.com
Tue Apr 24 15:43:10 EDT 2001
You can also use wxPyTypeCast on what is returned from GetChildren, so the
OP could do this:
obj = wxPyTypeCast(self.GetChildren()[26], "wxTextCtrl")
obj.SetValue("Testing")
Hopefully the need for this ugly hack will also go away with the upcoming
changes I mentioned yesterday.
Robin
"Franz GEIGER" <fgeiger at datec.at> wrote in message
news:9c4id9$6ov$1 at newsreaderm1.core.theplanet.net...
> Had a similar problem. Thanks to Robin Dunn, he showed me how to solve it:
> You have to use Getters like this, to access the control:
>
> def GetTextctrlText(self):
> return wxPyTypeCast( self.FindWindowById(ID_TEXTCTRL_TEXT),
> "wxTextCtrl" )
>
> wxDesigner(), which I really can recommend, did this for me by a simple
> button click.
>
> See the related thread on this:
>
http://groups.google.com/groups?hl=en&lr=&safe=off&ic=1&th=40bf7162e9580db9&
> seekd=909081131#909081131
>
> Hope this helps.
>
> Best Regards
> Franz GEIGER
>
> "Neotaku" <neotaku at free.fr> wrote in message
> news:CieF6.475$6H6.2077927 at nnrp3.proxad.net...
> >
> > Hello,
> >
> > Here is my problem, i take an object control from a windows like
this
> > obj = self.GetChildren()[26]
> > print obj.GetName()
> >
> > self is a windows and the 26th object is a textcontrol. so this code
> > work well and i can get the control's name but when i want to do that :
> > obj.SetValue("Testing")
> >
> > i have always this error : AttributeError : 'wxWindowPtr' instance
has
> > no attribute 'SetValue'
> > i don't understand why it doesn't work ? the only way it can work is
> > like this : self.MyTextCtrl.SetValue("Testing")
> >
> > Thanks a lot for you help
> >
> > Using : wxPython, Boa Constructor, NT4 Win32
> >
>
>
More information about the Python-list
mailing list