ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pygame-users
pygame-users
Re: [pygame] [BUG] pygame-ctypes
by Alex Holkner other posts by this author
Aug 22 2006 5:48PM messages near this date
[pygame] [BUG] pygame-ctypes | Re: [pygame] [BUG] pygame-ctypes
Lenard Lindstrom wrote:

> While trying to run 20,000 Light Years in Space, version 1.2 I get 
> the following exception:
> 
> Traceback (most recent call last):
>   File "lightyears.py", line 23, in ?
>     startup.Main()
>   File "C:\prg\LightYears\code\startup.py", line 81, in Main
>     main.Main()
>   File "C:\prg\LightYears\code\main.py", line 103, in Main
>     quit = Main_Menu_Loop(n, clock, screen, (width, height))
>   File "C:\prg\LightYears\code\main.py", line 125, in Main_Menu_Loop
>     main_menu = current_menu = menu.Menu([
>   File "C:\prg\LightYears\code\menu.py", line 31, in __init__
>     (discard1, discard2,
>   File "C:\prg\LightYears\code\menu.py", line 149, in __Draw
>     extra.Tile_Texture(surf, "greenrust.jpg", r)
>   File "C:\prg\LightYears\code\extra.py", line 50, in Tile_Texture
>     output.set_clip(rect)
>   File "C:\PRG\PYGAME-CTYPES\CTYPES-SOC\pygame\surface.py", line 825, 
> in set_cli
> p
>     SDL_SetClipRect(self._surf, rect)
> ctypes.ArgumentError: argument 2: exceptions.TypeError: expected 
> LP_SDL_Rect instance instead of _RectProxy
>   
> 
Thanks, now fixed in r944.

> Since SDL_SetClipRect has argtypes defined _RectProxy's 
> _as_parameter_ is not used. A from_param method will not help here 
> either, as it must belong to the type object in the argtypes list, 
> not the object passed as an argument.
>   
> 
Yep sorry, the _as_parameter_ was cruft from some experimentation, it's 
removed now.  The RectProxy is used when rects have negative width or 
height, which is supported by Pygame but not SDL.  There's no nice way 
to handle this conversion, as many SDL functions modify the rectangle 
passed in (e.g., the blit functions).  The onus for normalizing the 
rectangle before grabbing "_r" (the SDL_Rect) is therefore on the caller 
(Pygame), and there are some places I haven't addressed this yet.

20k LYIS now works great on my computer... This game was really 
addictive in the Pyweek comp.  There's a large dump of exceptions when 
it quits, I think this is just the audio thread not shutting down 
correctly (may be a Pygame error, it's on my todo list).

Alex.
Thread:
Phil Hassey
Lenard Lindstrom
Alex Holkner
Alex Holkner
Phil Hassey
Alex Holkner

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved