Example #1
0
    def __init__(self, word_list):
        frame_xrc.xrcWordList.__init__(self, None)
        # load some images into an image list
        #创建图像列表
        self.word_list = word_list

        self.il = wx.ImageList(200, 200, True)
        for im, info in word_list:
            try:
                img = ImageTool.pilImage_to_wxImage(im)
            except:
                print im, im.size, info
                continue
            bmp = wx.BitmapFromImage(img)
            self.il.Add(bmp)

        # create the list control
        #创建列表窗口部件
        self.list = xrc.XRCCTRL(self, "img_list_ctrl")

        # assign the image list to it
        self.list.AssignImageList(self.il, wx.IMAGE_LIST_NORMAL)

        # create some items for the list
        #为列表创建一些项目
        for x in range(len(word_list)):
            img_index = x
            name = str(word_list[x][1])
            self.list.InsertImageStringItem(x, name, img_index)

        self.BindEvent()
Example #2
0
    def __init__(self, word_list):
        wx.Frame.__init__(self, None, -1, "PyOCR", size=(600, 400))

        # load some images into an image list
        # 创建图像列表
        w, h = word_list[0][0].size
        il = wx.ImageList(w, h, True)
        for im, _x, _y in word_list:
            # im.save(str(_x)+str(_y)+".png")
            img = ImageTool.pilImage_to_wxImage(im)
            bmp = wx.BitmapFromImage(img)
            il_max = il.Add(bmp)

        # create the list control
        # 创建列表窗口部件
        self.list = wx.ListCtrl(self, -1, style=wx.LC_ICON | wx.LC_AUTOARRANGE)

        # assign the image list to it
        self.list.AssignImageList(il, wx.IMAGE_LIST_NORMAL)

        # create some items for the list
        # 为列表创建一些项目
        for x in range(25):
            img = x % (il_max + 1)
            self.list.InsertImageStringItem(x, "%02d" % x, img)