RES: [wxPython-users] Problem geting the content off a TextCtrl

Alejandro Michelin Salomon ( Adinet ) alejmsg at adinet.com.uy
Wed Jul 19 12:13:43 PDT 2006


Richard :

The problem is that i have a LoadData method to pass some data to my frame.
In this method i have a brong sentence :

self.txtidsystem = nIdSystem --> here this is the error.

When i change to :

self.txtidsystem.SetValue( str(nIdSystem) ) --> this is ok.

And this is ok now.

Thanks for replay

Alejandro MSG.
	

-----Mensagem original-----
De: Richard Burton [mailto:mrburton at gmail.com] 
Enviada em: quarta-feira, 19 de julho de 2006 15:26
Para: wxPython-users at lists.wxwidgets.org
Assunto: Re: [wxPython-users] Problem geting the content off a TextCtrl


This widget does have a GetValue (See wx.TextCtrl API or wxWindows)
wxTextCtrl::GetValue

Try str(self.txtidsystem.GetValue()) because the second parameter of
wx.MessageDialog is of type String.

Best Regards,

Richard Burton


On 7/19/06, Alejandro Michelin Salomon ( Adinet ) <alejmsg at adinet.com.uy>
wrote: 
Josiah :

I find the integer assingment to the control.

The problem is tha this control sames not have GetValue or SetValue 
attribute.

I try to print content of control in a dialog.

        dlg = wx.MessageDialog(self, self.txtidsystem.GetValue(),
                               'System Description mising',
                               wx.OK | wx.ICON_HAND
                               )
        dlg.ShowModal()
        dlg.Destroy()

The erro is in :
dlg = wx.MessageDialog(self, self.txtidsystem.GetValue(),

self.txtidsystem.GetValue () --> this has not property GetValue.

I don't now what this control doe not have this attributes.

Thanks in advance

-->-----Mensagem original-----
-->De: Josiah Carlson [mailto: jcarlson at uci.edu]
-->Enviada em: quarta-feira, 19 de julho de 2006 13:05
-->Para: Alejandro Michelin Salomon ( Adinet );
-->wxPython-users at lists.wxwidgets.org 
-->Assunto: Re: [wxPython-users] Problem geting the content off
-->a TextCtrl
-->
-->
-->
-->"Alejandro Michelin Salomon \( Adinet \)"
-->< alejmsg at adinet.com.uy> wrote:
-->> In side OnBtnSaveSystemButton i can't get the value for
-->this control.
-->>
-->> Defination:
-->>
-->> self is my frame.
-->>         self.txtidsystem =
-->wx.TextCtrl(id=wxID_SYSTEMS_NEWTXTIDSYSTEM,
-->>               name='txtidsystem', parent=self,
-->pos=wx.Point(120, 40),
-->>               size=wx.Size(128, 21),
-->style=wx._controls.TE_READONLY, 
-->> value='')
-->>         self.txtidsystem.SetFont(wx.Font(8, wx.SWISS,
-->wx.NORMAL, wx.NORMAL,
-->>               False, 'Tahoma'))
-->>
-->>
-->>     def OnBtnSaveSystemButton(self, event): 
-->>
-->>         sDescription = self.txtdescription.GetText()
-->>         nId          = self.txtidsystem.GetValue() -->
-->this line geave my
-->> the error: AttributeError: 'int' object has no attribute 'GetValue' 
-->>
-->> How to get/set the value for a TextCtrl?
-->
-->You use .GetValue() and .SetValue() .  You are assigning
-->some integer value to the txtidsystem attribute somewhere.
-->If you would like to discover where, add the following 
-->method to your frame definition.
-->
-->    def __setattr__(self, attr, value):
-->        if attr == 'txtidsystem' and isinstance(value, int):
-->            raise Exception, "Your problem is here 
-->        self.__dict__[attr] = value
-->
--> - Josiah
-->
-->
-->---------------------------------------------------------------------
-->To unsubscribe, e-mail:
--> wxPython-users-unsubscribe at lists.wxwidgets.org
-->For additional commands, e-mail:
-->wxPython-users-help at lists.wxwidgets.org
-->


---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org





-- 
-Richard Burton 





More information about the wxpython-users mailing list