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

python ¶íÂÞ˹·½¿é

Õâ¸öËãÊÇC++ǶÈëpython°É£¬ÀûÓÃpythonʵÏÖÏÔʾºÍʼþ´¦Àí£¬C++ʵÏÖÂß¼­
ÒÔºóÓÐʱ¼äÒ²»á·´¹ýÀ´ÊÔÊÔ£º£© 
import pygame
import sys
import os
import ctypes
def cur_file_dir():
#»ñÈ¡½Å±¾Â·¾¶
path = sys.path[0]
#ÅжÏΪ½Å±¾Îļþ»¹ÊÇpy2exe±àÒëºóµÄÎļþ£¬Èç¹ûÊǽű¾Îļþ£¬Ôò·µ»ØµÄÊǽű¾µÄĿ¼£¬Èç¹ûÊÇpy2exe±àÒëºóµÄÎļþ£¬Ôò·µ»ØµÄÊDZàÒëºóµÄÎļþ·¾¶
if os.path.isdir(path):
return path
elif os.path.isfile(path):
return os.path.dirname(path)

#call dll
path = cur_file_dir()
print path
rblogic = ctypes.CDLL(path+r'\rblogic.dll')
#pygame init
pygame.init()
screen = pygame.display.set_mode((640,500),0,32)
pygame.display.set_caption('RussiaBoxGame£¡_by warmtrue')
rblogic.InitGame()
moveflag = 0
font = pygame.font.Font(os.environ['SYSTEMROOT'] + u"\\Fonts\\simsun.ttc", 40)
fontsmall = pygame.font.Font(os.environ['SYSTEMROOT'] + u"\\Fonts\\simsun.ttc", 15)
fontless = pygame.font.Font(os.environ['SYSTEMROOT'] + u"\\Fonts\\simsun.ttc", 15)
#game main loop
while True:
screen.fill((0,0,0))
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
pygame.quit()
sys.exit()
elif event.type == pygame.KEYDOWN and event.key == pygame.K_UP:
moveflag = 4
elif event.type == pygame.KEYDOWN and event.key == pygame.K_LEFT:
moveflag = 1
elif event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN:
moveflag = 3
elif event.type == pygame.KEYDOWN and event.key == pygame.K_RIGHT:
moveflag = 2
elif event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
moveflag = 6
moveflag = rblogic.GameLoop(moveflag)
for i in range(0,19):
for j in range(0,10):
t = rblogic.check(i,j)
if t > 0:
if t ==


Ïà¹ØÎĵµ£º

Python IDE±È½ÏÓëÍÆ¼ö¡¾z¡¿

 ÎÒÏȸøÒ»¸ö³õ²½µÄ±í¸ñ°É£¬´ó¼ÒÈç¹ûÓÐʲôÒâ¼û£¬»òÓв¹³ä£¬»¶Ó­Ìá³ö¡£ÓÐЩÎÒûÓÐÓùý£¬ÏȲ»Ð´ÁË¡£
ÒÔÏÂÊÇÎÒʹÓùýµÄpython IDE:
     
³ýÁËPythonWin, VisualPythonÖ»Ö§³ÖWindows£¬ÆäËü¶¼ÖÁÉÙÖ§³ÖWin/Linux/Mac¡£
¸÷ÏÒ壺
×Ô¶¯²¹È«£º±äÁ¿/º¯ÊýÃû´òµ½Ò»°ëʱ£¬Ìáʾ¿ÉÄܵÄÍêÕûµÄ±äÁ¿/º¯ÊýÃû¡ ......

PythonÓÐÓõÄÄ£¿é

http://chardet.feedparser.org/  ×Ô¶¯¼ì²â±àÂë
http://effbot.org/zone/celementtree.htm  cElementTree
http://github.com/jaybaird/python-bloomfilter bloomfilter
http://docs.python.org/library/threading.html#threading.activeCount threading ......

µÚÒ»´ÎдÍêÕûµÄPython GUI³ÌÐò

 Ò¹ÀïÓÃÍâ¹ÒÈÝÒ×±»²é£¬Òò´ËÏëÈòËÊìµÄʱ¼ä¼¯Öе½°×Ì죬ÿ´Î¶¼Òª¿ÚË㣬Âé·³£¬ÕýºÃ¸Õ¸ÕѧÁËwxPython£¬Ò»Ê±ÊÖÑ÷£¬À´×Ô¼ºÐ´¸ö°É¡£Ëä˵´¿Êô×ÔÓé×ÔÀÖ£¬µ«Ò²Ñ§µ½²»ÉÙ¶«Î÷¡£ÏÖ¼ÇÓÚÏ¡£
1. ¹ØÓÚPythonµÄGUIÉè¼Æ
Ò»Ö±ÒÔÀ´¶¼Ã»ÓÐÒ»¸ö×ã¹»ºÃµÄKiller IDE£¬ÕâÒ²¹Ö²»µÃ£¬Ã»ÓÐÒ»¸ö×㹻ǿ´óµÄºǫ́£¬ÒªÏë×ö³ÉÖØÁ¿¼¶µÄIDE̸ºÎÈÝÒ×£¨ÒªÊ ......

PEP 0263 Defining Python Source Code Encodings

 
PEP 0263
Defining Python Source Code Encodings
Python will default to ASCII as standard encoding if no other
encoding hints are given.
To define a source code encoding, a magic comment must
be placed into the source files either as first or second
line in the file, suc ......

Python¼¸ÖÖ²¢·¢ÊµÏÖ·½°¸µÄÐÔÄܱȽÏ

 
#!/Library/Frameworks/Python.framework/Versions/2.5/bin/python
# encoding: utf-8
import sys, time
import thread
 
SLEEP_TIME = 0.0001
 
def run_benchmark(n, m):
    # print(">> Python 2.5.1, stackless 3.1b3 here (N=%d, M=%d)!\n" % (n, m))
    lock ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ