[wxPython-users] wxPython 2.8 transition, python alike properties
Robin Dunn
robin at alldunn.com
Wed Jan 10 11:14:43 PST 2007
Basil Shubin wrote:
> Hello friends!
>
> I have make transition from 2.6 to 2.8. One of the innovation of new
> wxPython is python alike properties! But for some case I don't realise
> how to use them, or exactly how to transite to them from 2.6 branch.
> Here a task list:
The general rule is that there are properties in a class for any
non-static method that has a GetFoo name that takes no parameters. If
there is also a matching SetFoo that takes only one parameter then it
will be set as the setter for that property.
>
> 1. SetStatusText("welcome") to StatusText = "welcome" No errors, but
> won't show the message inside StatusBar?
I assume you are talking about wx.Frame here. There is no GetStatusText
so there is no property, so you are just assigning to a normal attribute
named StatusText.
>
> 2. Is there property for wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)?
No, it is a staticmethod.
>
> 3. Is there property for SetSizerAndFit(sizer) and SetSizer(sizer)?
No getter for the first. There is a property for 'Sizer' though.
>
> 4. wx.Button's SetToolTipString("ToolTip") to ToolTipString = "ToolTip"
> No errors, but won't show the tooltip for this button?
No matching getters.
>
> 5. Is there property for wx.Buttons' SetDefault()?
No getter
>
> 6. Is there property for wx.TextCtrl's SetFocus()?
No getter
>
> 7. Is there property for wx.SpinCtrl's SetRange(1,1000)?
No, but there are properties for 'Min' and 'Max'
>
> 8. Is there property for wx.ListCtrl's + mixins:
> SetImageList(self.imagelist, wx.IMAGE_LIST_SMALL);
Yes, but there shouldn't be because the getter takes a parameter, and
the setter takes more than one. It's a bug that there is one there
currently.
> SetColumnWidth(0, 150);
> SetStringItem(index, 1, item);
> SetItemData(index, idx);
> SetItemState(index, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED);
> GetItemData(self.currentItem);
Each of these has too many parameters.
BTW, the properties are all listed in the class docs in the
Python-specific docs at http://wxpython.wxcommunity.com/docs/api/
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list