[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Pygame Surfaces in wxPython
Hooray! Thanks!
Here's my working Sub-Window Code:
class MyCanvas(wx.ScrolledWindow):
def __init__(self, parent, id = -1, size = wx.DefaultSize):
wx.ScrolledWindow.__init__(self, parent, id, (0, 0), size=size, style=
wx.SUNKEN_BORDER)
## self.SetBackgroundColour("WHITE")
pygame_surface = pygame.image.load('Image.bmp')
image_string = pygame.image.tostring(pygame_surface, "RGB")
imgWx = wx.EmptyImage(pygame_surface.get_width(), pygame_surface.get_height())
self.SetClientSize((pygame_surface.get_width(), pygame_surface.get_height()))
self.SetMinSize(self.GetSize())
imgWx.SetData(image_string)
self.wx_bitmap = imgWx.ConvertToBitmap()
self.maxWidth = 1000
self.maxHeight = 1000
self.SetVirtualSize((self.maxWidth, self.maxHeight
))
self.SetScrollRate(20,20)
wx.EVT_PAINT(self, self.OnPaint)
def OnPaint(self, event):
dc = wx.PaintDC(self)
dc.DrawBitmap(self.wx_bitmap,0,0)
Ian