Re: [pygame] problems with using video

2008-12-31 Thread Joseph Rawson
On Monday 29 December 2008 19:26:50 Jake b wrote: On Mon, Dec 29, 2008 at 7:07 AM, Joseph Rawson umebos...@gmail.com wrote: python: ../../src/xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) ((xcb_req) - (dpy-request)) = 0)' failed. Is there any more to the message? I would guess its a

Re: [pygame] @

2008-12-31 Thread Yanom Mobis
so when you do this: @foo def bar(): pass you assume that a function foo() already exists. and it creates something like this: def foo(): def bar(): pass pass ? I'm sorry, I just got confused. - On Wed, 12/31/08, Noah Kantrowitz n...@coderanger.net wrote: From: Noah Kantrowitz

Re: [pygame] @

2008-12-31 Thread Michael Phipps
Yanom - A decorator is a method that takes another method as a parameter so that it can do something. It is usually used for aspect oriented programming. For example: def logThisMethodCall(methodCall) # Do some logging here @logThisMethodCall def myMethod(a,b,c) # do Somthing in here

Re: [pygame] @

2008-12-31 Thread Yanom Mobis
O! I get it now! It's used to insure that a specific function is always called before another. Thanks for clearing it up for me. --- On Wed, 12/31/08, Michael Phipps michael.phi...@bluetie.com wrote: From: Michael Phipps michael.phi...@bluetie.com Subject: Re: [pygame] @ To:

Re: [pygame] @

2008-12-31 Thread Michael George
Michael Phipps wrote: Yanom - A decorator is a method that takes another method as a parameter so that it can do something. It is usually used for aspect oriented programming. For example: def logThisMethodCall(methodCall) # Do some logging here @logThisMethodCall def myMethod(a,b,c)

Re: [pygame] @

2008-12-31 Thread Lin Parkh
While we're on this kind of topic what is the best approach in python to creating code macros? That is ability to write a higher level language (or script) which translates down into python? Decorators look like they would be part of that story. Is that the best way or is their a more general

Re: [pygame] problems with using video

2008-12-31 Thread Lenard Lindstrom
Joseph Rawson wrote: Hi, I am new to using pygame, and I have just started making my first application with it. I have been tasked to create a slideshow type of application for a client. Basically, it just displays a picture in the background with a text message scrolling along the bottom

Re: [pygame] @

2008-12-31 Thread Lenard Lindstrom
Sort of. Functions in Python are just objects. They can be passed around, assigned to variables, and even have attributes added to them. A decorator is a way to take a newly created function and do something to it, such as create a new function that calls it. The most common use of decorators

Re: [pygame] @

2008-12-31 Thread Noah Kantrowitz
No, i has nothing to do with runtime. Decorators are evaluated during class compile. --Noah On Dec 31, 2008, at 12:05 PM, Yanom Mobis wrote: O! I get it now! It's used to insure that a specific function is always called before another. Thanks for clearing it up for me. --- On Wed,

Re: [pygame] @

2008-12-31 Thread Noah Kantrowitz
Python has no such system. Boo is a python-like language that supports hygienic macros. --Noah On Dec 31, 2008, at 1:20 PM, Lin Parkh wrote: While we're on this kind of topic what is the best approach in python to creating code macros? That is ability to write a higher level language (or

Re: [pygame] @

2008-12-31 Thread Yanom Mobis
class compile? Anyway, does it effectively work that way? --- On Wed, 12/31/08, Noah Kantrowitz n...@coderanger.net wrote: From: Noah Kantrowitz n...@coderanger.net Subject: Re: [pygame] @ To: pygame-users@seul.org Date: Wednesday, December 31, 2008, 1:41 PM No, i has nothing to do with

Re: [pygame] @

2008-12-31 Thread Noah Kantrowitz
No, as I said, decorators are a rather advanced topic. Until you are more comfortable with the whole compiler process, I would just try writing a few small ones with various prints to see what happens. --Noah On Dec 31, 2008, at 2:57 PM, Yanom Mobis wrote: class compile? Anyway, does it

Re: [pygame] @

2008-12-31 Thread Yanom Mobis
Thanks for the link. --- On Wed, 12/31/08, Lenard Lindstrom le...@telus.net wrote: From: Lenard Lindstrom le...@telus.net Subject: Re: [pygame] @ To: pygame-users@seul.org Date: Wednesday, December 31, 2008, 1:18 PM Sort of. Functions in Python are just objects. They can be passed

Re: [pygame] @

2008-12-31 Thread Yanom Mobis
oh. They showed up in some basic example code for pyglet: import pyglet window = pyglet.window.Window() label = pyglet.text.Label('Hello, world', font_name='Times New Roman', font_size=36, x=window..width//2,

Re: [pygame] mixer.music question

2008-12-31 Thread James Paige
Make sure you have the right version of libsdl installed. I had a problem like this once when I had the PulseAudio version of SDL installed when I should have had the ALSA version installed (your mileage may vary depending on your setup) --- James Paige On Tue, Dec 30, 2008 at 03:11:11AM

Re: [pygame] @

2008-12-31 Thread Lin Parkh
Thanks. The game context is I would like to write a scripting language on top of pygame/python for my game. - Original Message - From: Lenard Lindstrom le...@telus.net To: pygame-users@seul.org Sent: Wednesday, December 31, 2008 1:32 PM Subject: Re: [pygame] @ This is getting off

Re: [pygame] @

2008-12-31 Thread Noah Kantrowitz
Python _is_ the scripting language to use in your game. --Noah On Dec 31, 2008, at 4:56 PM, Lin Parkh wrote: Thanks. The game context is I would like to write a scripting language on top of pygame/python for my game. - Original Message - From: Lenard Lindstrom len- l...@telus.net

Re: [pygame] @

2008-12-31 Thread Lenard Lindstrom
A concrete example helps. Unfortunately, knowing how a decorator works does nothing to explain how it is being used any more than know how to declare a function tells you what all functions do. Anyway, the key thing to remember is a function declaration in Python is an executable statement, a

Re: [pygame] @

2008-12-31 Thread Lin Parkh
It is always possible to write game specific languages :-) Like AI languages. - Original Message - From: Noah Kantrowitz n...@coderanger.net To: pygame-users@seul.org Sent: Wednesday, December 31, 2008 1:58 PM Subject: Re: [pygame] @ Python _is_ the scripting language to use in your

Re: [pygame] @

2008-12-31 Thread Noah Kantrowitz
Possible, but not needed. I would recommend looking at either TinyPy or LunaticPython to do safe embedded Python or Lua respectively. Unless you expect users to running arbitrary downloaded code in your game, you can just use python+exec though. --Noah On Dec 31, 2008, at 7:14 PM, Lin

Re: [pygame] @

2008-12-31 Thread Jake b
If it doesn't execute on function call, I don't get what the use is? I thought if I did this, it would print out I am decorator ( but it only does it on function declaration ) def dec(f): print I am decorator!, f return f @dec def fn(x): return x ( And if it doesn't, then the

Re: [pygame] @

2008-12-31 Thread yanom
oh. They showed up in some basic example code for pyglet: import pyglet window = pyglet.window.Window() label = pyglet.text.Label('Hello, world',                           font_name='Times New Roman',                           font_size=36,                           x=window.width//2,

Re: [pygame] @

2008-12-31 Thread Noah Kantrowitz
Okay, think about the function classmethod(). It takes a single callable as an argument and return a callable. You could write this def make_from_str(cls, data): newobj = cls() newobj.parse(data) return newobj make_from_str = classmethod(make_from_str) inside a class.

Re: [pygame] @

2008-12-31 Thread Noah Kantrowitz
So doing the same conversion we start with def a(b): b() @a def eggs(): print 'spam' This becomes: def a(b): b() def eggs(): print 'spam' eggs = a(eggs) If you look your a() function doesn't return anything so eggs is set to the default return value which is always None. --Noah On Dec