wxPython -5 (wx.ListCtrl)
이번에는 간단히 데이타를 화면에 뿌려줄때 자주 사용하는 ListCtrl에 대해서 알아보겠습니다.
#-*-coding:mbcs-*-
import wx
class MyFrame(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,id,title,size=(400,300),pos=wx.Point(100,100),
style=wx.SYSTEM_MENU |wx.CAPTION|wx.CLOSE_BOX )
panel=wx.Panel(self,-1)
icon=wx.Icon('image\\pado.ico',wx.BITMAP_TYPE_ICO)
self.SetIcon(icon)
self.list1=wx.ListCtrl(panel,-1,wx.Point(5,10),wx.Size(380,250),style=wx.LC_REPORT | wx.SUNKEN_BORDER)
self.list1.InsertColumn(0,'first')
self.list1.InsertColumn(1,'seconde')
self.list1.InsertColumn(2,'third')
self.list1.SetColumnWidth(0,90)
self.list1.SetColumnWidth(1,190)
self.list1.SetColumnWidth(2,90)
self.list1.InsertStringItem(0,'pyton')
self.list1.SetStringItem(0,1,'http://www.python.org')
self.list1.SetStringItem(0,2,'good')
self.list1.InsertStringItem(1,'wxpython')
self.list1.SetStringItem(1,1,'http://wxpython.org')
self.list1.SetStringItem(1,2,'good')
self.list1.InsertStringItem(2,'yahoo')
self.list1.SetStringItem(2,1,'http://www.yahoo.com')
self.list1.SetStringItem(2,2,'idon`know')
class MyApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
self.frame=MyFrame(None,-1,'ListCtrl Example')
self.frame.Centre()
self.frame.Show()
self.SetTopWindow(self.frame)
return True
if __name__ == '__main__':
app=MyApp(0)
app.MainLoop()
역시 자세한 설명은 없습니다. 다들 아시는걸 올리는것아서 죄송하지만;;
'Python' 카테고리의 다른 글
python에서 스택, 큐 사용 (0) | 2007.05.25 |
---|---|
wxPython-4 (wx.Bitmap) (0) | 2007.04.12 |
wxPython -3 (wx.Icon) (0) | 2007.04.12 |