반응형
아랫 부분에 찌그러진 그림이 크기를 변경한거다.

아랫 부분에 찌그러진 그림이 크기를 변경한거다.


혜진이가 물어보길래 도와주면서 해봤다.
  1. import  wx  
  2. import  images  
  3.   
  4. class DrawFrame(wx.Frame):  
  5.   
  6.     def __init__(self, parent, id, title):  
  7.         wx.Frame.__init__(self, parent, id, title)  
  8.         wx.EVT_PAINT(selfself.OnPaint)  
  9.           
  10.         self.SetBackgroundColour("WHITE")  
  11.           
  12.         bmp = images.getTest2Bitmap()  
  13.           
  14.         mask = wx.Mask(bmp, wx.BLUE)  
  15.         bmp.SetMask(mask)  
  16.           
  17.         self.bmp = bmp  
  18.         SSize=(23,100)  
  19.         self.bmp.SetSize(SSize)  
  20.   
  21.     def OnPaint(self, evt):  
  22.         pdc = wx.PaintDC(self)  
  23.         try:  
  24.             dc = wx.GCDC(pdc)  
  25.         except:  
  26.             dc = pdc  
  27.         rect = wx.Rect(0,0100100)  
  28.   
  29.         dc.DrawBitmap(self.bmp, 200250True)  
  30.         for RGB, pos in [((178,  34,  34), ( 50,  90)),  
  31.                          (( 35142,  35), (110150)),  
  32.                          ((  0,   0139), (170,  90))  
  33.                          ]:  
  34.             r, g, b = RGB  
  35.             penclr   = wx.Colour(r, g, b, wx.ALPHA_OPAQUE)  
  36.             brushclr = wx.Colour(r, g, b, 128)   # half transparent  
  37.             dc.SetPen(wx.Pen(penclr))  
  38.             dc.SetBrush(wx.Brush(brushclr))  
  39.             rect.SetPosition(pos)  
  40.             dc.DrawRoundedRectangleRect(rect, 8)  
  41.   
  42. app = wx.PySimpleApp(0)  
  43. frame = DrawFrame(None, -1"Draw on Frame")  
  44. frame.Show(True)  
  45. app.MainLoop()  

반응형

'Python' 카테고리의 다른 글

Python 웹프레임워크 Django  (0) 2008.05.30
운영체제 과제 프로세스 스케쥴링 시뮬레이션  (2) 2008.05.12
python list deepcopy, 형변환  (0) 2008.05.07
Posted by Real_G