[pygame] PixelArray versus Surfarray + Numeric/NumPy
Hi everyone! I'm a hobby programmer and new to pygame. This is my first post to the list. I've been reading different docs and the the list archives to understand how best to move forward with experiments in image blending. The Surfarray tutorial on the docs page is excellent, but a little outdated. This seems to be a transitional period where the documentation and support for NumPy have not arrived and the pre-built Windows binaries for NumPy and Numeric don't support the latest python. As an alternative, can I just use pygame.PixelArray for all of my realtime blending needs? Is it too slow? If not, could anyone point me to some documentation on setting up a Windows build environment that will work for compiling pygame, python, and numpy together? Thanks very much for your help! Jordan
[pygame] Re: PixelArray versus Surfarray + Numeric/NumPy
Hello again. I may have posted prematurely. It seems that the easiest thing for me to do is to just set up a Python2.4 + Numeric dev environment and wait for the incompatibilities to sort themselves out. I still welcome any of your suggestions too my previous questions. Thanks again. On Mon, Jan 5, 2009 at 12:31 PM, Jordan Applewhite < jordan.applewh...@gmail.com> wrote: > Hi everyone! I'm a hobby programmer and new to pygame. This is my first > post to the list. > I've been reading different docs and the the list archives to understand > how best to move forward with experiments in image blending. The Surfarray > tutorial on the docs page is excellent, but a little outdated. This seems > to be a transitional period where the documentation and support for NumPy > have not arrived and the pre-built Windows binaries for NumPy and Numeric > don't support the latest python. As an alternative, can I just use > pygame.PixelArray for all of my realtime blending needs? Is it too slow? > > If not, could anyone point me to some documentation on setting up a Windows > build environment that will work for compiling pygame, python, and numpy > together? > > Thanks very much for your help! > > Jordan > > > > >
Re: [pygame] Re: PixelArray versus Surfarray + Numeric/NumPy
Marcus: Thanks for illuminating the difference between PixelArray and Surfarray. I'm trying to learn how use additive blending effectively, so I think I can use either module. Patrick & Lenard: Ok, I understand now that I should just use numpy. After I looked in the arraydemo.py example I could see that the the changes needed to use numpy were not very significant. Also, I'm finding this tutorial: http://www.scipy.org/Tentative_NumPy_Tutorial#head-b43db272311d8133ab8ba29b6e8ff921da5e792d to be very helpful. It seems like numpy would make it fun and easy to dynamically operate on tile maps, in addition to pixel surfaces. Many thanks, Jordan On Mon, Jan 5, 2009 at 2:24 PM, Lenard Lindstrom wrote: > Patrick Mullen wrote: > >> On Mon, Jan 5, 2009 at 10:02 AM, Jordan Applewhite >> wrote: >> >> >>> Hello again. I may have posted prematurely. It seems that the easiest >>> thing for me to do is to just set up a Python2.4 + Numeric dev >>> environment >>> and wait for the incompatibilities to sort themselves out. I still >>> welcome >>> any of your suggestions too my previous questions. >>> >>> Thanks again. >>> >>> >> >> By the way, you do mean python2.5 right? Python 2.6 and 3.0 are not >> widely supported yet, but 2.5 is. >> >> > Which platform. On Windows there is a Pygame 1.8.1 installer for Python > 2.6. And at http://www3.telus.net/len_l/pygame/ there are Pygame 1.9.0a0 > and NumPy 1.2.1 installers. NumPy 1.3 should be released soon and it will > support Python 2.6. As for the choice between Numeric and NumPy, NumPy is > now preferable. It was decided that Numeric will no longer be actively > supported. > > Lenard > > -- > Lenard Lindstrom > > >
[pygame] Adding __eq__ method to pygame Event class at runtime
Hi! I thought it would be nice to add an __eq__ method to the pygame.event.Event class at runtime. This would let me use == (rich comparison operator) on events in the manner of if pygame.event.wait() == trigger_event: pass I tried to do this with setattr like so (please pardon the one-liner): setattr( pygame.event.Event.__class__, '__eq__', lambda self, other: self.type == other.type ) I've tried several variations on this idea, but the attribute seems to be off-limits. I keep getting errors like "TypeError: can't set attributes of built-in/extension type 'builtin_function_or_method'". I notice that calling pygame.event.Event.__class__ lists it as a "builtin function or method.", but I'm not sure why this means I can't create the method. Could someone please point me in the right direction? Thanks, and I'm sorry if this is more about python than pygame. I'm hoping it passes the relevance threshold:)
Re: [pygame] Adding __eq__ method to pygame Event class at runtime
I'm afraid I don't have the skills to offer a patch. Oh well, there are lots of other ways to accomplish what I need. Thanks for the quick answer! On Mon, Apr 13, 2009 at 7:08 PM, René Dudfield wrote: > hi, > > Sorry, the Event class doesn't let you add attributes(like Nicholas says). > > If you have a patch at the C level we can add an __eq__ since it seems > like a good idea (I think). Or maybe someone will implement it for you. > > Or maybe we could allow events to have a dictionary associated with them... > so you can add methods and attributes like this... So it acts more like a > normal object. Will have to think about the implications of this... > > > cheers, > > > > > > On Tue, Apr 14, 2009 at 9:17 AM, Jordan Applewhite < > jordan.applewh...@gmail.com> wrote: > >> Hi! >> >> I thought it would be nice to add an __eq__ method to the >> pygame.event.Event class at runtime. This would let me use == (rich >> comparison operator) on events in the manner of >> >> if pygame.event.wait() == trigger_event: >>pass >> >> I tried to do this with setattr like so (please pardon the one-liner): >> setattr( pygame.event.Event.__class__, '__eq__', lambda self, other: >> self.type == other.type ) >> >> I've tried several variations on this idea, but the attribute seems to be >> off-limits. I keep getting errors like "TypeError: can't set attributes of >> built-in/extension type 'builtin_function_or_method'". I notice that >> calling pygame.event.Event.__class__ lists it as a "builtin function or >> method.", but I'm not sure why this means I can't create the method. >> >> Could someone please point me in the right direction? Thanks, and I'm >> sorry if this is more about python than pygame. I'm hoping it passes the >> relevance threshold:) >> >> >
Re: [pygame] Adding __eq__ method to pygame Event class at runtime
Lenard, your patch was enjoyable to read. I guess I should be looking at the chapter "Extending and Embedding the Python Interpreter". Thanks again, you guys are great. On Tue, Apr 14, 2009 at 12:59 AM, Lenard Lindstrom wrote: > Added to trunk in revision 2017. > > > Lenard Lindstrom wrote: > >> >> I'm working on it. For two events to be equal not only the types, but all >> attribute values will also have to be equal. I am currently testing the >> patch. >> >> Lenard >> >> Jordan Applewhite wrote: >> >>> I'm afraid I don't have the skills to offer a patch. Oh well, there are >>> lots of other ways to accomplish what I need. Thanks for the quick answer! >>> On Mon, Apr 13, 2009 at 7:08 PM, René Dudfield >> ren...@gmail.com>> wrote: >>> >>>hi, >>> >>>Sorry, the Event class doesn't let you add attributes(like >>>Nicholas says). >>> >>>If you have a patch at the C level we can add an __eq__ since it >>>seems like a good idea (I think). Or maybe someone will implement >>>it for you. >>> >>>Or maybe we could allow events to have a dictionary associated >>>with them... so you can add methods and attributes like this...So >>> it acts more like a normal object. Will have to think about >>>the implications of this... >>> >>> >>>cheers, >>> >>> >>> >>> >>> >>>On Tue, Apr 14, 2009 at 9:17 AM, Jordan Applewhite >>>mailto:jordan.applewh...@gmail.com>> >>>wrote: >>> >>>Hi! >>>I thought it would be nice to add an __eq__ method to the >>>pygame.event.Event class at runtime. This would let me use == >>>(rich comparison operator) on events in the manner of >>> >>>if pygame.event.wait() == trigger_event: >>> pass >>> >>>I tried to do this with setattr like so (please pardon the >>>one-liner): >>>setattr( pygame.event.Event.__class__, '__eq__', lambda >>>self, other: self.type == other.type ) >>> >>>I've tried several variations on this idea, but the attribute >>>seems to be off-limits. I keep getting errors like >>> "TypeError: can't set attributes of built-in/extension type >>>'builtin_function_or_method'". I notice that calling >>>pygame.event.Event.__class__ lists it as a "builtin function >>>or method.", but I'm not sure why this means I can't create >>>the method. >>> >>>Could someone please point me in the right direction? Thanks, >>>and I'm sorry if this is more about python than pygame. I'm >>>hoping it passes the relevance threshold:) >>> >>> >>> >>> >> >> > > -- > Lenard Lindstrom > > >
Re: [pygame] App Store
I've also been dreaming of a pygame distribution platform. I imagined something Steam-like that had social features like a friends list, a minimal chat client, reddit or digg-like user rating system to rank 'hotness', and the ability to invite people to multiplayer games. Also, since it seems like most pygames are FOSS, you could do neat things like p2p distribution and some kind of integrated support for mods or accepting patches. I know I went overboard seeing as all you're talking about is a package manager, but it seemed like an appropriate time to pipe up with this idea soup I've been simmering for awhile:) On Wed, May 13, 2009 at 6:44 PM, Yanom Mobis wrote: > how bout some sort of "Pygame Deployment System" like this: > > Pygame, SDL, and common libraries are built into the PDS. > > The user selects the game to download from a Tkinter interface. > > The game will be downloaded from a server. It will contain a file that > describes dependencies. Any dependencies are downloaded (and compiled, if > necessary, with the instructions provided by the game's file) into > $HOME/.pds/ > > Upon launching the game, the PDS will run something like this: > import sys > sys.path.append($HOME/.pds/) > import game_mainfile > > > > just my idea. tell me what you think. > > > > > > --- On *Wed, 5/13/09, Evan Kroske * wrote: > > > From: Evan Kroske > Subject: Re: [pygame] App Store > To: pygame-users@seul.org > Date: Wednesday, May 13, 2009, 5:03 PM > > Would the store really need to be specialized to ARM devices? One of > pygame's main goals is platform independence, so it seems that an app store > providing PyGame-based games would appeal to all Linux distros.. > I think this sounds like a timely idea that will fill a growing niche: the > desire for games on Linux without installation hassles. Many more people > would try PyGame-created games if they could install them and run them > through a gui without copying files or using the terminal. > > Anyway, that's my two cents. > > Regards, > Evan Kroske > > On Mon, May 11, 2009 at 9:00 PM, Cary Harper > http://mc/compose?to=cary.har...@xandros.com> > > wrote: > >> Hey Folks, >> >> Over the last two years the company I work for has been putting Linux on >> x86 based netbooks, but now MS has squashed that with offering exclusive >> deals to hardware companies for distributing Windows 7. In a couple of >> months, some of these hardware companies will be coming out with Linux based >> netbooks on an ARM architecture that we hope will server to ignite more >> interest in ARM and Linux. >> >> To do this, we know that we need to create excitement and a good user >> experience for the end user. To that end we are polishing the UI as much as >> possible and we are looking to get the support of communities like Pygame to >> develop and publish applications for these netbook devices in an app store >> dedicated to ARM-based Linux devices. >> >> The app store will support all software licenses with download links for >> source code where applicable as well as an ecommerce module for non-free >> software. To evaluate the app store experience you can check out >> presto.cnr.com, eeedownload.cnr.com and www.cnr.com. >> >> The reason I think the Pygame platform is so important is because 70% of >> the applications downloaded on the iPhone were games, with another 20% being >> entertainment type applications. >> >> We are doing work to make sure SDL and numerics are optimized for running >> on this ARM platform. >> >> What I would like to know is if this kind of opportunity is something this >> community would be interested in. >> >> Additionally, I can also offer to host an app store just for Pygame >> software, supporting all OS types, for free. The url would be >> pygame.cnr.com and I would give creative control over the branding of the >> site and the promotion of software on that site to the community. >> >> Hopefully you don't think this offer too lame or spam-like. >> >> Regards, >> >> Cary >> >> >> On May 9, 2009, at 9:59 AM, Chris McCormick wrote: >> >> Hi, >>> >>> Yes. Anything to break the current app-store hedgemony run by the big >>> corporations. >>> >>> Best, >>> >>> Chris. >>> >>> >>> On Fri, May 08, 2009 at 03:56:18PM -0700, Cary Harper wrote: >>> Would anyone be interested in putting their software into an App Store for ARM Linux Netbooks? --- >>> http://mccormick.cx >>> >> >> Cary Harper >> >> Senior Software Development Manager >> Xandros, Corp. >> 858.774.0943 | 858.587..6700 Ext 153 >> >> > >