[wxPython-dev] preview build
Robin Dunn
robin at alldunn.com
Mon Oct 16 11:05:28 PDT 2006
jmf wrote:
> w2k, py25, wxpy latest ansi
>
> - Did the wx._gdi.Colour() became a "4-tuple" as the property (!)
> Background
> says? Alpha channel?
It's not really a tuple, but a wx.Colour instance, but as the CHANGES
doc says it now includes an alpha component. I've tried to make it
possible to use either 3 values or 4 values in various places, such as
the typemap that converts from a tuple to a wx.Colour, but one place
where I didn't was in the __len__ and __getitem__ methods so that things
like this will still work:
r,g,b = color
If you want to be able to tuple-unpack all 4 values then you can do it
like this:
r,g,b,a = color.Get(True)
>
> - About getter/setter stuff.
> I like it. Should or can it be considered as the new programming style ?
Yes.
>
> - Getter/setter (2).
> A more annoying point lies in the keys* events. <event>.KeyCode is now a
> property and GetKeyCode() is a method. That is fine. Unfortunately,
> AltDown,
> ControlDown and ShiftDown are methods and no properties.
> <event>.Modifiers is a property and there is a GetModifiers() method!
The general approach has been to just make properties for things that
have a "Get" method, and to use the same name with the "Get" dropped.
If there is a matching "Set" method then that is used too. Also, I
tried not to make properties that conflicted with existing names in the
classes so that existing code using those methods wouldn't break, (other
than KeyCode which was explained here previously, and also in
CHANGES.txt, that it has been a compatibility alias for GetKeyCode for
several years...)
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-dev
mailing list