Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Python ÓÎÏ·³õѧ

import sys, pygame, time
size = width, height = 700,700
fontColor = (0,0,255)
class walk:
'''This is a game about war.
Just like war 3.'''
def __init__(self):
'''Init the screen.
Get param and init the screen'''

#print ('this is init funnction')
def initMainGraph(self):
print ('¤³¤³¤Ç¥á¥ó»­Ãæ¤ò³õÆÚ»¯')
def outputChar(self, screen, imgRect):
oc = pygame.font.SysFont('Arial', 36)
str = 'Let\'s Start the Game'
wid = 100
hei = 300
for i in str:
surf = oc.render(i,0,fontColor)
rec = surf.get_rect()
wid += 20
rec.topleft = (wid, hei)
screen.blit(surf,rec)
pygame.display.flip()
time.sleep(0.25)
def slow(self, screen, imgRect):
print ('slow show')

def runGame():
pygame.init()
screen = pygame.display.set_mode(size)
bgimg = pygame.image.load('world.png').convert_alpha()#load bgImage
imgRect = bgimg.get_rect() #get the Area of the Image
screen.blit(bgimg,imgRect)
pygame.display.flip()
luxs = walk() #create a object
luxs.outputChar(screen, imgRect)
time.sleep(3)
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit(0)

runGame()

³õѧÕߣ¬×öÁËÒ»¸öСÀý×Ó£¬ÏÔʾ±³¾°Í¼ºÍÎı¾


Ïà¹ØÎĵµ£º

Python 3 ½Ì³ÌÒ»:ÈëÃÅ

PythonÒѾ­ÊÇ3.1°æ±¾ÁË,Óëʱ¾ã½ø¸üн̳Ì.
±¾ÎÄÊʺÏÓÐJava±à³Ì¾­ÑéµÄ³ÌÐòÔ±¿ìËÙÊìϤPython
±¾ÎijÌÐòÔÚwindows xp+python3.1a1 ²âÊÔͨ¹ý.
±¾ÎÄÌáµ½µÄidleÖ¸python shell,¼´°²×°pythonºóÄãÔڲ˵¥¿´µ½µÄIDLE(python gui)
ÔÚidleÀïctrl+n¿ÉÒÔ´ò¿ªÒ»¸öд°¿Ú,ÊäÈëÔ´Âëºóctrl+s¿ÉÒÔ±£´æ,f5ÔËÐгÌÐò.
·²´ò¿ªÐ´°¿Ú¼´Ö¸ctrl ......

Python »ù´¡ 1

1.½âÊÍÐÔ ¿ÉÒÔÖ±½Ó´ÓÔ´´úÂëÔËÐгÌÐò.ÔÚ¼ÆËã»úÄÚ²¿,Python½âÊÍÆ÷°ÑÔ´´úÂëת»»³É³ÆΪ×Ö½ÚÂëµÄÖмäÐÎʽ,È»ºóÔÙ°ÑËü·­Òë³É¼ÆËã»úʹÓõĻúÆ÷ÓïÑÔ²¢ÔËÐÐ.
2.#·ûºÅºóÃæµÄÄÚÈݶ¼ÊÇ×¢ÊÍ.
3.ÔÚ×Ö·û´®ÖÐÐÐÄ©µÄ'\'±íʾÏÂÒ»ÐеÄÄÚÈݺÍÉÏÒ»ÐÐÊǽÓ×ŵÄ;×Ö·û´®Ç°¼ÓÒ»¸ör±íʾijЩ²»ÐèҪתÒå·ûÄÇÑùµÄÌرð´¦ÀíµÄ×Ö·û´®;ÔÚ´¦ÀíÎı¾ÎļþµÄʱºòÊ ......

python Ö´ÐÐϵͳÃüÁî±È½Ï

תÔØ×Ô£ºhttp://purpen.javaeye.com/blog/98095
python Ö´ÐÐϵͳÃüÁî±È½Ï
¹Ø¼ü×Ö: python os system ϵͳÃüÁî
Ôڴ˱ȽÏÒ»ÏÂÁ½ÖÖ·½·¨Ö´ÐÐϵͳÃüÁîµÄ·½·¨,ÒÔ·½±ãÓÚÈÕºóÔËÓÃ:(
1. os.system()
system(command) -> exit_status  
      
Execute the  ......

pythonÐÔÄÜÔöÇ¿¹¤¾ßshedskin 0.3°æ·¢²¼

http://code.google.com/p/shedskin/ Shed Skin 0.3 - support for 3 new standard library modules (now about 20 in total): - itertools (jeremie roquet) - heapq (jeremie roquet) - csv (converted using shedskin) - 4 new example programs (now 44 in total!): - maximum weighted matching al ......

cÅÌÕûÀí Python½Å±¾

ÄÜÕûÀí´ó²¿·ÖÎÞÓÃÎļþ
#!/usr/bin/python
#syscleaner.py
import os
import os.path
#delete files and directory recursively
def itedel(dir):
print('in dir :'+dir)
for doc in os.listdir(dir):
try:
if(os.path.isdir(doc)):
itedel(dir+'\\'+doc)
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ