Re: [Pgu-devel] pgu with py2exe
Status: Beta
Brought to you by:
philhassey
From: Phil H. <phi...@ya...> - 2007-05-26 16:18:18
|
Glenn, You need to include (from pgu) the data/themes folder. Hope that helps! Phil Glenn Ledder <gle...@ma...> wrote: pgu with py2exe After a necessary break, I'm back to finishing my software project. I'm still stuck on getting py2exe and pgu to work together. I put together a test case. I'll be grateful for any help! I probably have made some obvious mistake, but I just can't see it. Here is the code for the file test.py. ################################################ import pygame, sys from pygame.locals import * from pgu import text, gui pygame.init() white = (255, 255, 255) width = 200 height = 100 def finish(): sys.exit() # create the display screen screen = pygame.display.set_mode((200,100)) screen.fill(white) # create GUI object pgu = gui.App() IO = gui.Container(width=200,height=100) # define widget quitt = gui.Button("QUIT") quitt.connect(gui.CLICK, finish) IO.add(quitt,width/2-25,height/2-10) # show the display pgu.init(IO) pgu.paint(screen) pygame.display.update() # handle input events while True: for event in pygame.event.get(): if event.type == QUIT: sys.exit() elif event.type == KEYDOWN and event.key == K_ESCAPE: sys.exit() pgu.event(event) pgu.paint(screen) pygame.display.update() ################################################ When I double-click on test.py, the file runs correctly. Here is the code for setup.py. ################################################ # setup.py from distutils.core import setup from pgu import text, gui import py2exe, pygame, sys import shutil setup(windows=["test.py"]) shutil.copytree('data','dist/data') shutil.copytree('pgu','dist/pgu') ################################################ I got a command window and set it to the Python25 directory. Then I entered python setup.py py2exe This resulted in a huge output dump in the command window. There are a lot of lines like skipping byte-compilation of C:\Python25\pgu\gui\theme.py to pgu\gui\theme.pyc Then there are a lot of lines about copying stuff from the pygame folder, followed by the usual stuff that certain modules appear to be missing and a list of dll files in system32. I don't think any of this stuff is important because py2exe works fine when test.py does not use pgu. After this operation, the new C:\Python25\dist\ folder contains subfolders called data and pgu, and these appear to be identical to the data and pgu folders in C:\Python25\. Finally, when I double-click on C:\Python25\dist\test.exe, I get the following log: C:\Python25\dist\library.zip\pgu\gui\theme.py:72: DeprecationWarning: raising a string exception is deprecated Traceback (most recent call last): File "test.py", line 18, in <module> File "pgu\gui\app.pyc", line 42, in __init__ File "pgu\gui\theme.pyc", line 41, in __init__ File "pgu\gui\theme.pyc", line 49, in _preload File "pgu\gui\theme.pyc", line 72, in _load could not find theme default I checked the directories and there are files C:\Python25\dist\pgu\gui\theme.pyc and C:\Python25\dist\library.zip\pgu\gui\theme.pyc, although there is no C:\Python25\dist\library.zip\pgu\gui\theme.py. One last bit of information. When I double-click on test.exe, I actually do get a pygame window of the correct size; however, the window is black and there is no "Quit" button. Can anyone diagnose the problem for me? Is there something wrong with the way I use pgu commands in test.py? Thanks! Glenn ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________ Pgu-devel mailing list Pgu...@li... https://lists.sourceforge.net/lists/listinfo/pgu-devel --------------------------------- We won't tell. Get more on shows you hate to love (and love to hate): Yahoo! TV's Guilty Pleasures list. |