Re: [Pgu-devel] Help getting started
Status: Beta
Brought to you by:
philhassey
From: <mat...@be...> - 2007-07-21 18:25:10
|
Thanks=2E =20 I've now got things partially working=2E I can display a dialog, but not = in a way that I can close it! I've taken the ColorDialog from example 7 and combined with the code from example 10 as shown below=2E The ColorDialog displays correctly on top of= my screen content, and the game blocks in the event loop shown below=2E The controls in the dialog work correctly except for the dialog close control (the red button top right) - clicking on this does nothing=2E I wondered if I needed to "open" the dialog instead of "add"ing it so I tried commenting out the c=2Eadd line and adding an app=2Eopen (as shown h= ashed out below)=2E This didn't make any difference though except that after a while I hit an exception of some sort=2E=2E=2E Can anyone offer any further suggestions please=3F <main game loop> =2E=2E=2E #open modal dialog app =3D gui=2EApp() app=2Econnect(gui=2EQUIT,app=2Equit,None) dialog =3D ColorDialog('#000000') c =3D gui=2EContainer(align=3D-1,valign=3D-1) c=2Eadd(dialog,0,0) app=2Einit(c) #app=2Eopen(dialog,0,0) =5Fquit =3D 0 while not =5Fquit: for e in pygame=2Eevent=2Eget(): if e=2Etype is QUIT: =5Fquit =3D 1 if e=2Etype is KEYDOWN and e=2Ekey =3D=3D K=5FESCAPE: =5Fquit = =3D 1 app=2Eevent(e) app=2Epaint(screen) pygame=2Edisplay=2Eflip() pygame=2Etime=2Ewait(10) From: Jasper Stolte [mailto:jasperstolte@gmail=2Ecom]=20 Sent: 16 July 2007 12:36 To: matandhelen Cc: pgu-devel@lists=2Esourceforge=2Enet Subject: Re: [Pgu-devel] Help getting started Hi, =20 >From your description I'm not really sure if it is the same problem I had earlier, but it very well could be=2E So here's what had me stumped for ho= urs in a similar situation: If we have a class myDialog, which inherits from gui=2EDialog, rather than doing something like (pseudocode) this: =20 dialog =3D myDialog() dialog=2Econtainer =3D theContainer dialog=2Eopen() =20 I needed to do something like this: =20 dialog =3D myDialog() theContainer=2Eopen(dialog, x, y) Hopefully this can get you started from example 10=2E Also it's been a whi= le since I did this, so things might've changed since then=2E =20 Regards, Jasper =20 =20 On 7/16/07, matandhelen <matandhelen@beeb=2Enet> wrote:=20 Hi, I have a game written using pygame, and I would love to add a UI using PGU= =2E It looks like it should do exactly what I want, but despite being a softwa= re engineer by trade, I just cannot get it to work (and I've been at it for a= couple of days now!)=2E All I want to do is add a really basic new game dialog when the game finishes=2E I've got a pygame screen full of content, and all I want to d= o is pop up a small modal dialog in the middle of it when the game ends, collec= t some values like number of players, and have an ok button that closes the dialog and relaunches the game=2E I've tried running, reading and adapting all of the examples=2E They run = fine if I don't change them, but as soon as I try to adapt them go wrong=2E I'= ve tried starting from example 10, but I can't work out how to: - launch a modal dialog (the colour picker doesn't "block")=20 - launch the dialog other than by connecting from another widget - do the necessary GUI initialisation without having a widget on the scree= n all the time=2E I would include some sample code but I haven't really got any - I don't ev= en know where to start: do I create an app or a dialog or both=3F How do I g= et the dialog to display, and how do I get it to display within an exisiting pygame screen=3F How do I open it in a way that blocks=3F I'm sure if I = knew=20 what I was doing it would only be a few lines of code=2E=2E=2E Can anyone help me=3F If I can get this working then I will be able to release my game for everyone to enjoy! Cheers -------------------------------------------------------------------------=20= This SF=2Enet email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML=2E No limits=2E Just data=2E Click to get it now=2E http://sourceforge=2Enet/powerbar/db2/ =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F Pgu-devel mailing list Pgu-devel@lists=2Esourceforge=2Enet https://lists=2Esourceforge=2Enet/lists/listinfo/pgu-devel -------------------------------------------------------------------- mail2web LIVE =96 Free email based on Microsoft=AE Exchange technology - http://link=2Email2web=2Ecom/LIVE |