OcempGUI Help Requests

This place is for installation troubles and woes on running OcempGUI.


In the below example:

   1 button = Button ("Zażółć gęślą jaźń") # displays trash on the button
   2 button = Button ("Zażółć gęślą jaźń".decode('utf-8')) # this works fine

Note, that this is a problem in case gettext is used:

   1 button = Button (_(Hello, world)) # will not work
   2 # below line would be necessary and valid only
   3 # if the programmer is sure that gettext returns utf-8 string
   4 button = Button (_(Hello, world).decode('utf-8'))


Traceback (most recent call last):
  File "C:\OcempGUI-0.2.1\doc\examples\hello_world_signals.py", line 2, in ?
    from ocempgui.widgets import *
  File "C:\Python24\Lib\ocempgui\__init__.py", line 45, in ?
    import ocempgui.widgets
  File "C:\Python24\Lib\ocempgui\widgets\__init__.py", line 34, in ?
    import base
  File "C:\Python24\Lib\ocempgui\widgets\base.py", line 29, in ?
    from Style import Style
  File "C:\Python24\Lib\ocempgui\widgets\Style.py", line 36, in ?
    from themes import default
ImportError: No module named themes

Would be nice if somebody could help me, thanks --Krabb

Ahh thanks, there must be something wrong... the constant points to "@DATAPATH@". Rerunning the install.py (with the argument "install") prints the following: (Its german, sorry :/ )

"Der Befehl "pkg-config" ist entweder falsch geschrieben oder konnte nicht gefunden werden." means something like: "The command "pkg-config" isn't spelled correctly or could not be located."

Der Befehl "pkg-config" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
The following information will be used to build OcempGUI:
         Python:     2.4.3
         Pygame:     1.7.1release
         ATK:        not found
         Build Papi: False
running install
running build
running build_py
running install_lib
running install_data
byte-compiling c:\python24\Lib\site-packages\ocempgui\widgets\Constants.py to Constants.pyc

I´m a python beginner, i have no clue whats going on :( What does "ATK" stand for? Could you help me again? Thanks --Krabb


Traceback (most recent call last):
  File "elderlore.py", line 868, in ?
  File "elderlore.py", line 87, in __init__
  File "elderlore.py", line 634, in __init__
  File "el_gui.pyc", line 63, in __init__
  File "ocempgui\widgets\GenericDialog.pyc", line 103, in __init__
  File "ocempgui\widgets\DialogWindow.pyc", line 46, in __init__
  File "ocempgui\widgets\Window.pyc", line 110, in __init__
  File "ocempgui\widgets\BaseWidget.pyc", line 907, in <lambda>
  File "ocempgui\widgets\BaseWidget.pyc", line 408, in set_minimum_size
  File "ocempgui\widgets\BaseWidget.pyc", line 932, in <lambda>
  File "ocempgui\widgets\BaseWidget.pyc", line 513, in set_dirty
  File "ocempgui\widgets\Bin.pyc", line 205, in update
  File "ocempgui\widgets\BaseWidget.pyc", line 848, in update
  File "ocempgui\widgets\Window.pyc", line 314, in draw
  File "ocempgui\widgets\BaseWidget.pyc", line 767, in draw
  File "ocempgui\widgets\Window.pyc", line 307, in draw_bg
  File "C:\Python24\share\ocempgui\themes\default\DefaultEngine.py", line 1282, in draw_window
    font = String.create_font (fn, sz, fs)
  File "ocempgui\draw\String.pyc", line 135, in create_font
  File "ocempgui\draw\String.pyc", line 71, in create_file_font
RuntimeError: default font not found

Is there some font file I have to add ? My script is running fine through python.exe. Any help would be fine !

Thanks for your help. After solving this font problem, I bumped into the same py2exe problem Conrado met and talked about on dev forum. As a workaround, I isolated the files needed to run the binary file, and made a zip of them. You can find them here: http://sourceforge.net/project/showfiles.php?group_id=184938 You need to extract this file to the root of your C drive in order to run your binary file. I hope this will help anyone trying to use py2exe.


Woah, that seems a little out of my knowledge capacity ! :) Would you have any plan to implement such a feature in a future release ? Anyway, thanks for your explanations.


Have you run across this at all? I've been poking through the Renderer code and my own, trying to catch when it happens, but I can't pin it down yet. All I know is that it happens somewhere in clearing the Renderer and adding a lot of new widgets.

-- DavidEyk

Well, now here's a problem: I delved deeper in with the debugger, and every time I run it, the Segmentation Fault happens at different iterations of a loop in my code. Here's the (simplified) loop in question:

This is part of a loop to create Labels which eventually go into a Table which is wrapped in a VFrame. Each Table contains between 20-40 Labels. Here's simple take on the pattern: I create two Tables, add them to the Renderer, clear the Renderer, and create two more Tables. While iterating through the above loop for the fourth Table, I get the Segmentation Fault, but it varies as to which iteration of the loop faults. Sometimes it faults in the Label init, sometimes it faults in my loop, sometimes it faults in mkResourceLabel, which is just a factory method wrapper for Label().

I realize this is sketchy information--but it's as reproducible as I can get at the moment. What else would you like to know? --DavidEyk

I think I've tracked it down. I was subclassing Label and Entry to make widgets that tracked with variables on game objects. Here's the code for the Label subclass:

I was creating these ResourceLabels in the aforementioned loop, and I had a few of my ResourceEntry subclasses elsewhere on the screen. When I replaced the fancy subclassing with a fancy factory method that uses plain-vanilla widgets and some lambda magic, the segmentation fault disappears.

Might this have something to do with widgets being subclasses of Sprite? As you can see, I had to do a little dance to make the subclass work (with the repr and the del stuff). Any idea why this may have been happening? --DavidEyk

After some time and a lot of dead-ends, I think I may have accidentally discovered a solution. Running the garbage collector during the menu-state transitions seems to make the Segmentation Fault disappear (I was having unrelated(?) issues with zombie widgets). Or it may have been renaming _resource. So far so good. Thanks for taking the time to look at this. --DavidEyk




The first change I needed to make was in the String.py file inside the draw folder. On line 71 I needed to make this change:

The reason for this change was that the exe would be unable to find a font otherwise. I have read of other people fixing this just by including the font in the library.zip file built by py2exe, however I could not get this to work for some reason unless I made the change above.

The second change I needed to make was in the Constants.py file inside the widgets folder. At the end of the file I changed @DATAPATH@ to:

After doing so I moved the themes folder directly into the ocempgui folder.

These changes were made in an uninstalled version of ocempgui. This is because I was afraid that the .pyc files might prevent the changes from working, and also because I didn't want to mess anything in my actual installation up. After making the changes, everything seems to work now. The exe files built with py2exe seem to run on any computer, without needing to install python or ocempgui.

My question is, do you think these changes are safe? I feel like it is a very hackish way to get py2exe working with my program, and am unsure if these changes would prevent anything in ocempgui from working correctly. I should mention that I am only doing this to make self contained windows binaries. I have been writing all my programs in linux, so these changes will only affect things compiled with py2exe, not the source code.



Hanging on exit

Hello, I'm jumping into OcempGUI enthusiastically, since it looks very well developed. When I run the code from the FAQ in the section "Renderer integration into own pygame loop" via iPython everything works great and looks dandy until I attempt to close the window. At this point Python/Pygame becomes nonresponsive and eventually collapses into a force-quit. I tried out several other scripts from the example set, and they all displayed this behavior.

Interestingly, this behavior is limited to when I employ the iPython magic command "%run" to start the scripts. Normal command-line python interpreter prompts produce flawlessly-executing ocempGUI goodness. I wonder what could be causing this incompatibility. Certainly not a major flaw, but a curiosity.

This behavior noticed on WinXP with python 2.5.1, pygame 1.8.0, OcempGUI 0.2.9, iPython 0.8.2

Any ideas?

~~Theo

OcempGUIHelpRequests (last edited 2008-08-03 09:45:09 by Marcusva)

SourceForge.net Logo