[Tutor] Why use decorators ?

sudhanshu gautam sudhanshu9252 at gmail.com
Sat May 2 07:41:49 CEST 2009


Last night was using a pyglet for creating some good graphical applications
,it was my first introduction with the pyglet,so just went on pyglet.org and
downloaded a pdf file .

Now simply made two programs that is mentioned in the pdf of the pyglet



program 1.It is simple program that prints 'HELLO WORLD'


program2.It is simple takes the keyboard and mouse events


Now I am going to write both the code then regarding queries also.

1.import pyglet
window=pyglet.window.Window()

lable=pyglet.text.Lable('Hello, world',
 font_name='Times New Roman',
 font_size=36,
 x=window.width//2, y=window.height//2,
 anchor_x='center', anchor_y='center')
*@window.event  *
def on_draw():
    window.clear()
    label.draw()
pyglet.app.run()

okay I just drop second example just tell me why we are using that all the
code that is showed in RED color .


2What is Event Handlers as well as What is DECORATORS TELL ME ALSO

regards
sudhanshu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090502/f8dc1b61/attachment.htm>


More information about the Tutor mailing list