#----------------------------------------------------------------------------
from wxPython.wx import *
-from wxPython.lib.mixins.listctrl import wxColumnSorterMixin
+from wxPython.lib.mixins.listctrl import wxColumnSorterMixin, wxListCtrlAutoWidthMixin
#---------------------------------------------------------------------------
import images
+
+class TestListCtrl(wxListCtrl, wxListCtrlAutoWidthMixin):
+ def __init__(self, parent, ID, pos=wxDefaultPosition,
+ size=wxDefaultSize, style=0):
+ wxListCtrl.__init__(self, parent, ID, pos, size, style)
+ wxListCtrlAutoWidthMixin.__init__(self)
+
+
+
class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1, style=wxWANTS_CHARS)
#self.sm_up = self.il.AddIcon(wxIconFromXPMData(images.getSmallUpArrowData()))
#self.sm_dn = self.il.AddIcon(wxIconFromXPMData(images.getSmallDnArrowData()))
- self.list = wxListCtrl(self, tID,
+ self.list = TestListCtrl(self, tID,
style=wxLC_REPORT|wxSUNKEN_BORDER)#|wxLC_VRULES|wxLC_HRULES)
self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
if 0:
- # for normal simple columns, you can add them like this:
+ # for normal, simple columns, you can add them like this:
self.list.InsertColumn(0, "Artist")
self.list.InsertColumn(1, "Title", wxLIST_FORMAT_RIGHT)
self.list.InsertColumn(2, "Genre")
tPopupID3 = 2
tPopupID4 = 3
tPopupID5 = 5
- #menu.Append(tPopupID1, "One")
+
+ # Show how to put an icon in the menu
item = wxMenuItem(menu, tPopupID1,"One")
- item.SetBitmap(images.getSmilesBitmap())
+ if wxPlatform == '__WXMSW__':
+ item.SetBitmap(images.getSmilesBitmap())
+
menu.AppendItem(item)
menu.Append(tPopupID2, "Two")
menu.Append(tPopupID3, "Three")