[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Pygame Surfaces in wxPython
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Pygame Surfaces in wxPython
- From: "Brian Fisher" <brian@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 20 Jan 2008 23:43:51 -0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 21 Jan 2008 02:43:59 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=VQtbrUc9TdEE4eq4sdaP/gvNuQ04JPBsX735v4ZZNg4=; b=mT58/JEeaDCR4c3tbnZQj5AKT0UWf/q1VXxI0MSAQPVib+I188WHcHlOlBqNekTq707u1td/xlAvTTb54EQSkiBEwlk7xm42oItXG9GTu/2wKVL/mCaaSWaQiUxH0fS1H2/nKtqlADbw0WHIRItbW4sFP/ijG0SdM0gd14ggPjs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=EmLlZXdLn5/RXy9l4YQoh0h8U2BM82KnIVleT+jiCva2HN2I8Z5/fXsSiGeMedr74Psa0mlF17vDsgLnaBcSRlRMrwEsDxcGVE+ms3npjFsm1rUisDAzQ4xUPN1gwb94lhQGQI84d6kHAF+l8QIVnmZFng+lTdTh9IErnQs/Nf4=
- In-reply-to: <a62fab400801202259q3463be62h4a831eb25644a764@xxxxxxxxxxxxxx>
- References: <a62fab400801202259q3463be62h4a831eb25644a764@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Platform specific message loop problems of mixing pygame an wxPython
notwithstanding for the moment, it's pretty easy to get a pygame
surface into a wxPython bitmap by using a string as an intermediate.
Basically something like this:
image_string = pygame.image.tostring(pygame_surface, "RGB")
imgWx = wx.EmptyImage(image.get_width(), image.get_height())
self.SetClientSize((image.get_width(), image.get_height()))
self.SetMinSize(self.GetSize())
imgWx.SetData(image_string)
wx_bitmap = imgWx.ConvertToBitmap()
then bitmaps can be drawn to the PaintDC for the window with dc.DrawBitmap
On Jan 20, 2008 10:59 PM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
> Hi,
>
> I'm making a specialized paint program to deal with weird paint functions.
> The idea is that programmers want paint programs to be able to do things
> that they can't. For example, this program can make three channel
> heightmaps using a greyscale image. It can draw the red or green or blue
> sections of an image in any combination or separately. Etc. Feel free to
> email me for any other suggestions.
>
> Anyway, the problem. This program should use Pygame Surfaces because they
> are great and I know how to work with them. I'm using wxPython chiefly
> because of its menu support. I figured out after much deliberation of
> solutions and hassle over implementing them how to make menus and
> subwindows. I want to place Pygame Surfaces into these windows. Does
> anyone have any idea how to do that?
>
> Thanks,
> Ian
>