Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 Ö´ÐÐϵͳÃüÁî±È½Ï

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

×Ô¶¯½âѹ´óÁ¿Ñ¹ËõÎļþ Python ½Å±¾

֮ǰдÁËÒ»¸ö×Ô¶¯½âѹѹËõÎļþµ½Ñ¹ËõÎļþËùÔÚÎļþ¼ÐµÄ½Å±¾
ºó¸ù¾Ý×Ô¼ºÐèÒª£¬Ð´ÁËÁíÍâÁ½¸ö¡£Ô­ÀíÒ»Ñù
¶¼ÊÇʹÓÃwinrarµÄÃüÁî
µÚÒ»¸ö½Å±¾Ã»¿¼ÂÇÖܵ½£¬Ö»ÄܽâѹrarÎļþ
¸Ä½øºó¿ÉÒÔÖ§³ÖwinrarÖ§³ÖµÄ¸÷ÖÖÎļþ
°ÑÖ¸¶¨Îļþ¼ÐϵÄÎļþ±£´æµ½Ö¸¶¨Îļþ¼Ð
#rardir.py
import os
import sys
src=sys.argv[1]
dst=sys.argv[2]
......

PYTHONÉèÖÃĬÈÏÓïÑÔ±àÂë

ת×Ô http://www.javaeye.com/topic/561786
Ô­Ìû£ºhttp://www.cnblogs.com/jingleguo/archive/2008/06/02/1211820.html
µ±pythonÖм䴦Àí·ÇASCII±àÂëʱ£¬¾­³£»á³öÏÖÈçÏ´íÎó£º
UnicodeDecodeError: 'ascii' codec can't decode byte 0x?? in position 1: ordinal not in range(128)
0x??Êdz¬³ö128µÄÊý×Ö£¬pythonÔÚĬÈϵ ......

PythonÔÚwindowsϵķ¾¶ÎÊÌâ

    windowsϵķ¾¶Ïñ“f:\program files\python\backup”ÆäÖГ\”ÐèÒªÓÃתÒå·û£¬Ð´³É“\\”£¬»òÕßÇ°Ãæ¼Órд³Épath
= r’f:\program files\python\backup’µ«ÊÇÔÚµ÷ÓÃһЩϵͳÃüÁÈços.system(rar a path e:\backup)»á³ö´í£¬Ô­ÒòÊÇ“program files&rdquo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ