Beispiel #1
0
 def draw_people(self):
     dw, dh = wx.DisplaySize()
     w = imgutil.rcd(((dw-self.cols*2)*1.0)/(self.cols*1.0))
     top = ((dh%w)/4)
     left = ((dw%w)/2)
     bmp = wx.BitmapFromImage(wx.ImageFromStream( cStringIO.StringIO(self.next_people())))
     dc = wx.PaintDC(self)
     dc.DrawBitmap(bmp, main_logo['postion'][0]*w+left, main_logo['postion'][1]*w+top, True)
Beispiel #2
0
    def next_people(self):
        avatar_path = self.lettory.next_people_avatar()
        if avatar_path and os.path.exists(avatar_path):
            dw, dh = wx.DisplaySize()
            w = imgutil.rcd(((dw-self.cols*2)*1.0)/(self.cols*1.0))
            background = Image.new('RGBA', (w*main_logo['postion'][2], w*main_logo['postion'][2]), main_logo['bg_color'])
            image = Image.open(avatar_path)
            image = imgutil._crop((w*main_logo['postion'][2], w*main_logo['postion'][2]), image, False)
            background.paste(image, (0, 0))
#            body_font = ImageFont.truetype(os.path.join(BASE_DIR, "xxk.ttf"), lottery_people['font_size'])
#            imgutil.draw_word_wrap(
#                    background,
#                    "%s:%s" % (id, name), 
#                    lottery_people['position'][0], 
#                    lottery_people['position'][1], 
#                    max_width=1000,
#                    fill=lottery_people['font_color'],
#                    font=body_font
#                )
            return imgutil.to_data(background)