Re: DataViewCtrl : Error raised while trying to set header Attributes
Inda Licio <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
El miércoles, 11 de septiembre de 2019, 7:55:13 (UTC-3), Walid Sakr
escribió:
>
> I created a DataViewListCtrl and added some values and is working fine,
> then i tried to assign some attributes to column headers to change colour
> and font
> as such
>
> listctrl = wx.dataview.DataViewListCtrl(self,
> wx.ID_ANY,style=wx.dataview.DV_MULTIPLE |
> wx.dataview.DV_ROW_LINES | wx.dataview.DV_HORIZ_RULES |
> wx.dataview.DV_VERT_RULES)
>
> font_bold = wx.Font( wx.FontInfo(12).Bold())
> head_txt_colr = wx.Colour("BLUE")
> head_bac_colr = wx.Colour("DARK GREY")
>
> listctrl.SetHeaderAttr(wx.ItemAttr(head_txt_colr, head_bac_colr,
> font_bold))
>
>
>
> and this was the error message raised
>
>> listctrl.SetHeaderAttr(wx.ItemAttr(head_txt_colr, head_bac_colr,
>>> font_bold))
>>
>> AttributeError: 'DataViewListCtrl' object has no attribute 'SetHeaderAttr'
>>
>>
>
> the thing is DataViewListCtrl inherits from DataViewCtrl which has this
> method as shown below
>
>
>> SetHeaderAttr(*self*, *attr*)
>
>
> <https://wxpython.org/Phoenix/docs/html/wx.dataview.DataViewCtrl.html#wx.dataview.DataViewCtrl.SetHeaderAttr>
>
> Set custom colours and/or font to use for the header.
>
> This method allows customizing the display of the control header (it does
> nothing if DV_NO_HEADER style is used).
>
> Currently it is only implemented in the generic version and just returns
> False without doing anything elsewhere.
> Parameters: *attr* (*wx.ItemAttr*
> <https://wxpython.org/Phoenix/docs/html/wx.ItemAttr.html#wx.ItemAttr>) –
> The attribute defining the colour(s) and font to use. It can be default, in
> which case the attributes are reset to their default values.
> Return type: *bool*
> Returns: True if the attributes were updated, False if the method is not
> implemented or failed.
>
> New in version 3.1.1.
>
>
> the problem is i tried implementing DataViewCtrl instead of a
> DataViewListCtrl to avoid this error but unfortunately its raising the same
> error !!!
>
Hola
se pudo solucionar el error AttributeError: 'DataViewListCtrl' object has
no attribute 'SetHeaderAttr'
saludos
--
You received this message because you are subscribed to the Google Groups "wxPython-users" 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-users/33ff99bd-0a21-411a-8dd1-68e28b890a3c%40googlegroups.com.