2011-01-19 3 views

答えて

2

ListCtrlは複数行のエントリをサポートしていないため、ObjectListViewでは使用できません(FAQ参照)。

それはUltimateListCtrl

import wx 
from wx.lib.wordwrap import wordwrap 
import wx.lib.agw.ultimatelistctrl as ULC 

class Frame(wx.Frame): 
    def __init__(self, *args, **kw): 
     wx.Frame.__init__(self, *args, **kw) 

     self.list = ULC.UltimateListCtrl(self, agwStyle=ULC.ULC_REPORT|ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) 
     items = ['A', 'b', 'a really really long line that if would be nice if it could word-wrap'] 
     colWidth = 100 
     self.list.InsertColumn(0, "AA", width=colWidth) 
     for item in items: 
      item = wordwrap(item, colWidth, wx.ClientDC(self)) 
      self.list.InsertStringItem(0, item) 

app = wx.App(False) 
frm = Frame(None, title="ULC wordwrap test") 
frm.Show() 
app.MainLoop() 
0

wxListCtrlの機能はかなり限定されています。基本以外の何かをするには、wxGridにアップグレードすることを検討してください。これには豊富な機能があります。

+0

私は現在ListCtrlあるObjectListViewを使用していますを使用して、しかし、可能であり、それが実現しています。だから私はこのオブジェクトでラップする必要があります。私がwxGridに 'アップグレード'した場合、どのように移行しますか? wxGridはOLVと同じように動作しますか? (オブジェクトのリストを取る) – Iacks

+0

'ObjectListView'とは何ですか?名前はwxWidgetsのようには見えません – ravenspoint

+0

私の質問にはリンクがあり、wxListViewをラップします。 – Iacks