Re: Validator support for text, integer and floating-point variants
Robin Dunn <[email protected]> Sun, 26 May 2019 21:33:22 -0700 (PDT)
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_861_225873827.1558931602427 Content-Type: multipart/alternative; boundary="----=_Part_862_4252572.1558931602427" ------=_Part_862_4252572.1558931602427 Content-Type: text/plain; charset="UTF-8" On Sunday, May 26, 2019 at 11:18:48 AM UTC-7, ABC wrote: > > https://docs.wxpython.org/wx.Validator.html > mentions subclasses of text, integer and floating point validators, but I > get a "no attribute" error when I try to use them. > They excluded on purpose, IIRC because they rely on being able to have access to C++ types in other classes by address, which is not a good fit for the Python way of doing things, and especially when dealing with wrapped C++ classes. The main purpose for using the validators in that way is for data transfer from the widget to/from the value's storage place, not just for validation. OTOH, implementing type-specific validators in Python is super easy and so having special classes for it is not a necessity. Check in the demo for a couple examples. -- Robin -- You received this message because you are subscribed to the Google Groups "wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxPython-dev/9c1d8082-a26a-44c8-b049-7e9301eb2ac2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_862_4252572.1558931602427 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">On Sunday, May 26, 2019 at 11:18:48 AM UTC-7, ABC wrote:<b= lockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;borde= r-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><a href=3D= "https://docs.wxpython.org/wx.Validator.html" target=3D"_blank" rel=3D"nofo= llow" onmousedown=3D"this.href=3D'https://www.google.com/url?q\x3dhttps= %3A%2F%2Fdocs.wxpython.org%2Fwx.Validator.html\x26sa\x3dD\x26sntz\x3d1\x26u= sg\x3dAFQjCNFVLU-gVkjAJyi5Zyf8fon7r3cHTg';return true;" onclick=3D"this= .href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.wxpython.or= g%2Fwx.Validator.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFVLU-gVkjAJyi= 5Zyf8fon7r3cHTg';return true;">https://docs.wxpython.org/wx.<wbr>Valida= tor.html</a><br></div><div>mentions subclasses of text, integer and floatin= g point validators, but I get a "no attribute" error when I try t= o use them.</div></div></blockquote><div><br></div><div>They excluded on pu= rpose, IIRC because they rely on being able to have access to C++ types in = other classes by address, which is not a good fit for the Python way of doi= ng things, and especially when dealing with wrapped C++ classes. The main p= urpose for using the validators in that way is for data transfer from the w= idget to/from the value's storage place, not just for validation.</div>= <div><br></div><div>OTOH, implementing type-specific validators in Python i= s super easy and so having special classes for it is not a necessity. Check= in the demo for a couple examples.=C2=A0</div><div><br></div><div>--</div>= <div>Robin</div></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;wxPython-dev" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">wxPyth= [email protected]</a>.<br /> To view this discussion on the web visit <a href=3D"https://groups.google.c= om/d/msgid/wxPython-dev/9c1d8082-a26a-44c8-b049-7e9301eb2ac2%40googlegroups= .com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/ms= gid/wxPython-dev/9c1d8082-a26a-44c8-b049-7e9301eb2ac2%40googlegroups.com</a= >.<br /> For more options, visit <a href=3D"https://groups.google.com/d/optout">http= s://groups.google.com/d/optout</a>.<br /> ------=_Part_862_4252572.1558931602427-- ------=_Part_861_225873827.1558931602427--