wxPython中的listctrl 如何在指定的列加入进度条

wxPython中的listctrl 如何在指定的列加入进度条

ListCtrl是比较简单的列表控件,操作起来没有Grid复杂,但要是想在指定的列中显示一个进度条,如迅雷等下载工具,显示一个下载进度,如何去实现呢?
好象不行。
能不能继承ListCtrl在OnPaint时进行处理呢?我试着

[Copy to clipboard] [ - ]
CODE:
import wx
import sys

musicdata = {
1 : ("Bad English", "The Price Of Love", "Rock"),
2 : ("DNA featuring Suzanne Vega", "Tom's Diner", "Rock"),
3 : ("George Michael", "Praying For Time", "Rock"),
4 : ("Gloria Estefan", "Here We Are", "Rock"),
5 : ("Linda Ronstadt", "Don't Know Much", "Rock"),
6 : ("Michael Bolton", "How Am I Supposed To Live Without You", "Blues"),
7 : ("Paul Young", "Oh Girl", "Rock"),
8 : ("Paula Abdul", "Opposites Attract", "Rock"),
9 : ("Richard Marx", "Should've Known Better", "Rock"),
10: ("Rod Stewart", "Forever Young", "Rock"),
11: ("Roxette", "Dangerous", "Rock"),
12: ("Sheena Easton", "The Lover In Me", "Rock"),
13: ("Sinead O'Connor", "Nothing Compares 2 U", "Rock"),
14: ("Stevie B.", "Because I Love You", "Rock"),
15: ("Taylor Dayne", "Love Will Lead You Back", "Rock"),
16: ("The Bangles", "Eternal Flame", "Rock"),
17: ("Wilson Phillips", "Release Me", "Rock"),
18: ("Billy Joel", "Blonde Over Blue", "Rock"),
19: ("Billy Joel", "Famous Last Words", "Rock"),
20: ("Billy Joel", "Lullabye (Goodnight, My Angel)", "Rock"),
21: ("Billy Joel", "The River Of Dreams", "Rock"),
22: ("Billy Joel", "Two Thousand Years", "Rock"),
23: ("Janet Jackson", "Alright", "Rock"),
24: ("Janet Jackson", "Black Cat", "Rock"),
25: ("Janet Jackson", "Come Back To Me", "Rock"),
26: ("Janet Jackson", "Escapade", "Rock"),
27: ("Janet Jackson", "Love Will Never Do (Without You)", "Rock"),
28: ("Janet Jackson", "Miss You Much", "Rock"),
29: ("Janet Jackson", "Rhythm Nation", "Rock"),
30: ("Janet Jackson", "State Of The World", "Rock"),
31: ("Janet Jackson", "The Knowledge", "Rock"),
32: ("Spyro Gyra", "End of Romanticism", "Jazz"),
33: ("Spyro Gyra", "Heliopolis", "Jazz"),
34: ("Spyro Gyra", "Jubilee", "Jazz"),
35: ("Spyro Gyra", "Little Linda", "Jazz"),
36: ("Spyro Gyra", "Morning Dance", "Jazz"),
37: ("Spyro Gyra", "Song for Lorraine", "Jazz"),
38: ("Yes", "Owner Of A Lonely Heart", "Rock"),
39: ("Yes", "Rhythm Of Love", "Rock"),
40: ("Cusco", "Dream Catcher", "New Age"),
41: ("Cusco", "Geronimos Laughter", "New Age"),
42: ("Cusco", "Ghost Dance", "New Age"),
43: ("Blue Man Group", "Drumbone", "New Age"),
44: ("Blue Man Group", "Endless Column", "New Age"),
45: ("Blue Man Group", "Klein Mandelbrot", "New Age"),
46: ("Kenny G", "Silhouette", "Jazz"),
47: ("Sade", "Smooth Operator", "Jazz"),
48: ("David Arkenstone", "Papillon (On The Wings Of The Butterfly)", "New Age"),
49: ("David Arkenstone", "Stepping Stars", "New Age"),
50: ("David Arkenstone", "Carnation Lily Lily Rose", "New Age"),
51: ("David Lanz", "Behind The Waterfall", "New Age"),
52: ("David Lanz", "Cristofori's Dream", "New Age"),
53: ("David Lanz", "Heartsounds", "New Age"),
54: ("David Lanz", "Leaves on the Seine", "New Age"),
}
#----------------------------------------------------------------------
class YListCtrl(wx.ListCtrl):
    def __init__(self,parent,id=-1, pos=wx.DefaultPosition,
        size=wx.DefaultSize, style=wx.LC_REPORT |wx.LC_VIRTUAL| wx.LC_HRULES|wx.LC_VRULES | wx.NO_FULL_REPAINT_ON_RESIZE):
        wx.ListCtrl.__init__(self, parent, id, pos, size, style)
   
        self.InsertColumn(0, "Artist")
        self.InsertColumn(1, "Title")
        self.InsertColumn(2, "Genre")
        self.SetColumnWidth(0, 150)
        self.SetColumnWidth(1, 220)
        self.SetColumnWidth(2, 100)
        
        self.itemDataMap = musicdata
        self.itemIndexMap = musicdata.keys()
        self.SetItemCount(len(musicdata))
        
        check_ctrl = wx.Gauge(self, -1, 50, (110, 50), (250, 25))
        check_ctrl.SetValue(25)
        self.AddControl(6, 2, check_ctrl,True)

        check_ctrl = wx.Gauge(self, -1, 50, (110, 50), (250, 25))
        check_ctrl.SetValue(25)
        self.AddControl(4, 1, check_ctrl,True)

    def AddControl(self, row,col,ctrl,fit=False):
        item_rect = self.GetItemRect(row)
        y = item_rect[1] # y position
        h = item_rect[3] # height size
        
        x = item_rect[0] # x position
        for i in range(0,col):
            x += self.GetColumnWidth(i)
            
        w = self.GetColumnWidth(col) # width size
        ctrl.SetPosition( (x, y) )
        if fit :
            ctrl.SetSize(wx.Size(w,h))
        
    def OnGetItemText(self, item, col):
        index=self.itemIndexMap[item]
        s = self.itemDataMap[index][col]
        return s
#----------------------------------------------------------------------
# The main window
#----------------------------------------------------------------------
# This is where you populate the frame with a panel from the demo.
#  original line in runTest (in the demo source):
#    win = TestPanel(nb, log)
#  this is changed to:
#    self.win=TestPanel(self,log)
#----------------------------------------------------------------------

class TestFrame(wx.Frame):

    def __init__(self, parent, id, title, size, style = wx.DEFAULT_FRAME_STYLE ):

        wx.Frame.__init__(self, parent, id, title, size=size, style=style)

        self.CreateStatusBar(1)

        self.win = YListCtrl(self)

def main(argv=None):
    #wx.InitAllImageHandlers()

    app = wx.PySimpleApp()
    f = TestFrame(None, -1, "ColumnSorterMixin used with a Virtual ListCtrl",wx.Size(500,300))
    f.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()

但一拖动滚动就有问题。这样的需求能用Grid实现吗?我是指在每行加上进度条
Grid好象是可以的。还有就是可以考虑使用scrolledwindow自已实现一个类似的
谢谢