2 #----------------------------------------------------------------------------
4 # Purpose: Lest Icon List
9 # Licence: wxWindows, wxPython license
10 #----------------------------------------------------------------------------
13 from wxPython
.wx
import *
15 class AppFrame(wxFrame
):
16 def __init__(self
, parent
, id=-1, title
="New"):
17 wxFrame
.__init
__(self
, parent
, id, title
, wxPyDefaultPosition
, wxSize(420, 320))
18 if wxPlatform
== '__WXMSW__':
19 self
.icon
= wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO
)
20 self
.SetIcon(self
.icon
)
22 self
.CreateStatusBar()
24 self
.mainmenu
= wxMenuBar()
27 menu
= self
.MakeFileMenu()
28 self
.mainmenu
.Append(menu
, '&File')
30 self
.SetMenuBar(self
.mainmenu
)
32 self
.il
= wxImageList(32, 32)
33 self
.idx1
= idx1
= self
.il
.Add(wxNoRefBitmap('table.bmp', wxBITMAP_TYPE_BMP
))
34 self
.idx2
= idx2
= self
.il
.Add(wxNoRefBitmap('query.bmp', wxBITMAP_TYPE_BMP
))
36 self
.nb
= nb
= wxNotebook(self
, -1)
38 self
.list = wxListCtrl(nb
, 1100, wxDefaultPosition
, wxDefaultSize
)
40 nb
.AddPage(self
.list, "Tables")
42 self
.list.SetSingleStyle(wxLC_ICON
)
43 self
.list.SetWindowStyleFlag(wxSTATIC_BORDER|wxVSCROLL
)
44 self
.list.SetImageList(self
.il
, wxIMAGE_LIST_NORMAL
)
46 self
.qlist
= wxListCtrl(nb
, 1200, wxDefaultPosition
, wxDefaultSize
)
47 nb
.AddPage(self
.qlist
, "Queries")
49 self
.qlist
.SetSingleStyle(wxLC_ICON
)
50 self
.qlist
.SetWindowStyleFlag(wxSTATIC_BORDER|wxVSCROLL
)
51 self
.qlist
.SetImageList(self
.il
, wxIMAGE_LIST_NORMAL
)
56 self
.nb
.SetSelection(1)
57 self
.nb
.SetSelection(0)
59 #self.nb.ResizeChildren()
61 def MakeFileMenu(self
):
62 self
.fl_mn
= menu
= wxMenu()
65 menu
.Append(mID
, 'E&xit', 'Exit')
66 EVT_MENU(self
, mID
, self
.OnFileExit
)
71 def UpdateView1(self
):
74 self
.list.InsertImageStringItem(i
, vset
+ str(i
), self
.idx1
)
76 def UpdateView2(self
):
79 self
.qlist
.InsertImageStringItem(i
, vset
+ str(i
), self
.idx2
)
81 def OnFileExit(self
, event
):
84 #---------------------------------------------------------------------------
89 frame
= AppFrame(NULL
, -1, "Demo")
91 self
.SetTopWindow(frame
)
94 #---------------------------------------------------------------------------
107 if __name__
== '__main__':