[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] BUG, Userevents disapears in pygame 1.9



Bo,

Try increasing the value of pygame.NUMEVENTS. After reading through the event code, and checking through the SDL docs, I find this about User events:

"The contents of the structure members or completely up to the programmer, the only requirement is that type is a value from SDL_USEREVENT to SDL_NUMEVENTS-1 (inclusive)."

pygame.NUMEVENTS has a value of 32, which explains what you ran into.

Examining the font code, I see that apparently the check if the file exists is not working properly, and returning a success, which is why we get a RuntimeError rather than an IOError. To be specific for others, between the lines 589 and 631 is where the error is happening in font.c.

Bo, are you using the latest SVN version of pygame?

-Tyler

On Tue, May 12, 2009 at 8:03 AM, Bo Jangeborg <bo@xxxxxxxxxxx> wrote:
here is the old error out put for the fontloading

Traceback (most recent call last):
 File "C:\Projekt\eclipse\Pyos\System\DB_Edit\db_edit.pyw", line 1338, in <module>
  main()
 File "C:\Projekt\eclipse\Pyos\System\DB_Edit\db_edit.pyw", line 60, in main
  standalone=True)
 File "C:\Projekt\eclipse\Pyos\System\DB_Edit\db_edit.pyw", line 101, in __init__
  height_max = 20
 File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 7661, in __init__

  alpha, align, flags, **extra_attributes)
 File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 4401, in __init__
  self.font = get_font(self, font)
 File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 4870, in get_font
  fontobj = _Fontcache(parent.gui, font, parent.app.get_source_path())
 File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 4904, in __init__
  self.font_object = self.load_font(font_path)
 File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 4922, in load_font

  font_object = pygame.font.Font(fullname, self.size)
IOError: unable to read font filename


About the userevent.
User events works but only up to USEREVENT+7, anything after that disappears.
So I can work around it by having my own number sequence in the dictionary.

Bo)

Tyler Laing skrev:
Bo,

Okay, so the load_font is not raising an error, which is a bug,  and could you try modifying CALL_FUNCTION to be USEREVENT+1 ? 45 is the value of K_MINUS. I don't know if that would cause the issue, but if its still throwing an error for 25, then its not a conflict with a key value.

Thank you!

-Tyler

On Tue, May 12, 2009 at 7:43 AM, Bo Jangeborg <bo@xxxxxxxxxxx <mailto:bo@xxxxxxxxxxx>> wrote:

   ### Font error first.

   fullname = C:\Projekt\eclipse\Pyos\System\LiberationSans-Regular.ttf
   a file that does not exist.

   here is the full error trace:

   Traceback (most recent call last):
    File "C:\Projekt\eclipse\Pyos\System\DB_Edit\db_edit.pyw", line
   1338, in <module>
     main()
    File "C:\Projekt\eclipse\Pyos\System\DB_Edit\db_edit.pyw", line
   60, in main
     standalone=True)
    File "C:\Projekt\eclipse\Pyos\System\DB_Edit\db_edit.pyw", line
   101, in __init__
     height_max = 20
    File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 7660, in
   __init__
     alpha, align, flags, **extra_attributes)
    File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 4401, in
   __init__
     self.font = get_font(self, font)
    File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 4870, in
   get_font
     fontobj = _Fontcache(parent.gui, font, parent.app.get_source_path())
    File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 4904, in
   __init__
     self.font_object = self.load_font(font_path)
    File "C:\Projekt\eclipse\Pyos\System\widgets.py", line 4921, in
   load_font
     font_object = pygame.font.Font(fullname, self.size)
   RuntimeError: Can't seek in stream


   ### Event error

   I added  "print CALL_FUNCTION, eventdata" to your output
   and I changed your second print to events2

   and the combined output was this:

   []
   []
   45 {'item': ('Table view', <bound method DbEditor.set_table_view
   of <__main__.DbEditor instance at 0x02E7E030>>, None, 'Ctrl-T'),
   'gui': <System.widgets.Gui instance at 0x024C4BE8>, 'hit_pos':
   (18, 3), 'over_widget': <System.widgets.MenuItem instance at
   0x084EB5D0>}

   In other words the event  disappears without a trace.
   Bo)

   Tyler Laing skrev:

       Well, to the first bug, could we please see the exact text of
       the RuntimeError versus the IOError? The runtime error could
       be related to processing the font file, if the font loader
       didn't throw an error that there was no file.

       The second bug, can you please show what the output of this
       code does?:

       pygame.event.clear()
       pygame.event.post(pygame.event.Event(CALL_FUNCTION,  event_data))
       events = pygame.event.get()
       print events
       events2 = pygame.event.get(CALL_FUNCTION)
       print events




--
Visit my blog at http://oddco.ca/zeroth/zblog
------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.325 / Virus Database: 270.12.25/2109 - Release Date: 05/11/09 16:14:00

 




--
Visit my blog at http://oddco.ca/zeroth/zblog