- 论坛徽章:
- 0
|
from wxPython.wx import *
def _setupContext( memory, font=None, color=None ):
if font:
memory.SetFont( font )
else:
memory.SetFont( wxNullFont )
if color:
memory.SetTextForeground( color )
def write( text, bitmap, pos=(0,0), font=None, color=None):
"""Simple write into a bitmap doesn't do any checking."""
memory = wx.MemoryDC( )
_setupContext( memory, font, color )
memory.SelectObject( bitmap )
try:
memory.DrawText( text, pos[0],pos[1],)
finally:
memory.SelectObject( wxNullBitmap)
return bitmap
PS:
Resize bitmap:
start_image.Rescale(width, heght)
bitmap=wx.BitmapFromImage(self.start_image)
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/46672/showart_2069251.html |
|