[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] pygame ingration with wxpython
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] pygame ingration with wxpython
- From: "Ian Mallett" <geometrian@xxxxxxxxx>
- Date: Sat, 12 Apr 2008 20:18:11 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sat, 12 Apr 2008 23:18:17 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=gtBrTDyFhVZoNmz2G/rXaNwtoHTE+cmSpTkFyxUs5zs=; b=d1ZUnAlq8bEU9+xq89hMaJthYbQE62iYl00+nvUiqgECsoeWSB4UvUrBZw9fNMY5Pldlf5cyo5+tYZmA97aI74BRaO2sobukfZkaWTdBbfgnUQDI3WCVVIs2mFlSUjG7fPcm9xRqRmC5oC959Vpzg7kBlacAibQmoPt09OG02ok=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=giT/3f0zcFaIeB0BTNBeb2CIsHPPnzm+Mj4rRdxgy0HxTagWU3PK/GMLO53BfCXviVfPruzloTPfnOEIgWnKGSG8NAJJTStXKxZeBuHMFKX2KfxJDGd2zLZbfkqAQeC0RpJ9nTiyI95QlYx43XXPQWY9YGn8I+tXQPprLXZYi+I=
- In-reply-to: <002101c88a82$ec7bd860$82c513ac@xxxxxxxx>
- References: <AciKgurcQkDhEEEkShOZSBRqp3yjhA==> <002101c88a82$ec7bd860$82c513ac@xxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
I've done:
class SDLThread:
def __init__(self,screen):
self.m_bKeepGoing = self.m_bRunning = False
self.screen = screen
self.color = (255,0,0)
self.rect = (10,10,100,100)
def Start(self):
self.m_bKeepGoing = self.m_bRunning = True
thread.start_new_thread(self.Run, ())
def Stop(self):
self.m_bKeepGoing = False
def IsRunning(self):
return self.m_bRunning
def Run(self):
while self.m_bKeepGoing:
GetInput()
Draw()
self.m_bRunning = False;
class SDLPanel(wx.Panel):
def __init__(self,parent,ID,tplSize):
global pygame
wx.Panel.__init__(self, parent, ID, size=tplSize)
self.Fit()
os.environ['SDL_WINDOWID'] = str(self.GetHandle())
os.environ['SDL_VIDEODRIVER'] = 'windib'
import pygame
pygame.init()
icon = pygame.Surface((1,1));icon.set_alpha(0);pygame.display.set_icon(icon)
global Surface
Surface = pygame.display.set_mode(tplSize)
#Load any images, etc. here, then continue to:
self.thread = SDLThread(Surface)
self.thread.Start()
def __del__(self):
self.thread.Stop()
def GetInput():
global SelectedWindow
keystate = pygame.key.get_pressed()
mrel = pygame.mouse.get_rel()
mpos = pygame.mouse.get_pos()
mpress = pygame.mouse.get_pressed()
for event in pygame.event.get():
#do stuff
Obviously pretty rough. Perhaps it will be useful to you, though.