I’m trying to create a wx.ListCtrl (or similar widget) which is able to contain both an icon and two lines of text per item, where the two lines have a different font size. Quite similar to the Ubuntu System -> Administration -> Users and Groups tool actually.
I’ve tried both wx.ListCtrl, wx.SimpleHtmlListCtrl and wx.UltimateListCtrl, but none is apparantly able to do all I want (although SimpleHtmlListCtrl came pretty close)
If anyone have suggestions on how to accomplish this, I’d appreciate it.
Try VListCtrl or HtmlListCtrl. The Demo shows how you can override the
drawing or use HTML tables to create the effect you're going for. I
haven't tried it so I don't know if the HtmlListCtrl could use the IMG
tag or not.
Josh
···
On Sun, Feb 20, 2011 at 1:38 PM, Frank Aune <frank.aune@gmail.com> wrote:
Hi,
I'm trying to create a wx.ListCtrl (or similar widget) which is able to
contain both an icon and two lines of text per item, where the two lines
have a different font size. Quite similar to the Ubuntu System ->
Administration -> Users and Groups tool actually.
I've tried both wx.ListCtrl, wx.SimpleHtmlListCtrl and wx.UltimateListCtrl,
but none is apparantly able to do all I want (although SimpleHtmlListCtrl
came pretty close)
If anyone have suggestions on how to accomplish this, I'd appreciate it.
Best regards,
Frank
Try VListCtrl or HtmlListCtrl. The Demo shows how you can override the
drawing or use HTML tables to create the effect you're going for. I
haven't tried it so I don't know if the HtmlListCtrl could use the IMG
tag or not.
Josh
You can use the IMG tag in HtmlListCtrl, but you must do without the WXP tag.
Also, the MemoryFSHandler is very handy because it gives you more flexibility in regards to the image source. http://wiki.wxpython.org/wxHTML
Toni
···
On Mon, 21 Feb 2011 01:30:14 +0100, Josh English <joshua.r.english@gmail.com> wrote:
On Sun, Feb 20, 2011 at 1:38 PM, Frank Aune <frank.aune@gmail.com> wrote:
Hi,
I'm trying to create a wx.ListCtrl (or similar widget) which is able to
contain both an icon and two lines of text per item, where the two lines
have a different font size. Quite similar to the Ubuntu System ->
Administration -> Users and Groups tool actually.
I've tried both wx.ListCtrl, wx.SimpleHtmlListCtrl and wx.UltimateListCtrl,
but none is apparantly able to do all I want (although SimpleHtmlListCtrl
came pretty close)
If anyone have suggestions on how to accomplish this, I'd appreciate it.
Best regards,
Frank
Thanks for both replies. As mentioned in the OP, I've already tried
(Simple)HtmlListCtrl and it came pretty close to what I wanted,
however the following restricted me from using it:
1. Items are to be sorted in categories, and the categories shall have
another background color. The only way I could accomplish this in
SimpleHtmlListCtrl was to create a <table bgcolor="#D1D1D1"
border="0"> tag containing the category in question, however this
resulted in a small white frame around the table element which looked
funny. Almost as if the table element didn't fill the entire space of
the item, much like the table border was still drawn but not visible.
2. (Simple)HtmlListCtrl doesn't support any of the ListCtrl methods
AFAICS. Granted this is just an excuse to be lazy, but ... thus I was
hoping wx.agw.UltimateListCtrl would somehow come to my rescue.
Thanks for both replies. As mentioned in the OP, I've already tried
(Simple)HtmlListCtrl and it came pretty close to what I wanted,
however the following restricted me from using it:
1. Items are to be sorted in categories, and the categories shall have
another background color. The only way I could accomplish this in
SimpleHtmlListCtrl was to create a <table bgcolor="#D1D1D1"
border="0"> tag containing the category in question, however this
resulted in a small white frame around the table element which looked
funny. Almost as if the table element didn't fill the entire space of
the item, much like the table border was still drawn but not visible.
2. (Simple)HtmlListCtrl doesn't support any of the ListCtrl methods
AFAICS. Granted this is just an excuse to be lazy, but ... thus I was
hoping wx.agw.UltimateListCtrl would somehow come to my rescue.
You can try using custom renderers for the ULC items to get the effect
you want. These renderer classes must implement the methods
DrawSubItem, GetLineHeight and GetSubItemWidth, so you could create a
reneder that does what you want and use it for every item in ULC. The
demo shows you how to create and use custom renderers (see for example
UltimateRenderer_1, UltimateRenderer_2 and UltimateRenderer_3).
Obviously, if you have many items shown on screen (i.e., a very wide
and very tall UltimateListCtrl) this approach may be very resource
intensive (and possibly slow).