ÇëÎÊÔõô¶ÔÒÔÏÂÕâ¶Î´úÂë×öµ¥Ôª²âÊÔÄØ£¿£¨°üÀ¨Ê¹Ó÷¾¶¸²¸Ç¡¢Ìõ¼þ¸²¸ÇµÈ°×ºÐ²âÊÔ·½·¨£©
class Case_one:
def __init__(self):
self.__a = 100
self.__b = 200
def function_a(self): ......
¡¡¡¡Mandelbrot Set£¨ÂüµÂ²ªÂÞ¼¯£©¿ÉÄÜÊÇ·ÖÐÎͼÐÎÖÐ×îÓÐÃûµÄͼÐΣ¬¹ØÓÚËüµÄ½éÉÜÎҾͲ»¶àдÁË£¬ÓÐÐËȤµÄ¿ÉÒԲο¼Õâ¸öÁ´½Ó ¡£ÏÂÃæÊǹØÓÚÈçºÎʹÓÃPythonÀ´»Õâ¸öͼÐεij¢ÊÔ¡£
¡¡¡¡ÓÉÓÚPython±ê×¼¿âÖл¹Ã»ÓжÔͼÐδ¦ÀíµÄÖ§³Ö£¬ÔÚ´ËÎÒʹÓÃÁËPIL ¡£ÏÈÀ´¿´Ò»ÕÅÉú³ÉµÄͼÐΣº
¡¡¡¡
¡¡¡¡Ïà¹ØµÄ´úÂë´óÖÂÊÇÕâÑùµÄ£ ......
ÎÒÃǵÄÏîÄ¿ÐèÒªÔÚmfcÖбàÒëpython½Å±¾²¢Éú³ÉexeÎļþ£¬Òò´ËÐèÒªÔÚ³ÌÐòÖÐǶÈëpython½âÊÍÆ÷£¬Í¬Ê±ÓÉÓÚÓõÄpygameÄ£¿é£¬Ò²ÐèҪһͬ¼ÓÈë½øÈ¥¡£ÎÒÒѾ±àÒëÁËpythonÔ´Îļþ£¬ÓпâÎļþºÍdllÎļþ£¬µ«ÊÇpygame²»ÖªµÀÔõô¼Ó½øÈ¥¡£pygameµÄrelease°æµÄsrcÎļþ¼ÐÖÐÓÐһЩcÎļþ£¬°²×°µ½pythonÖÐÓм¸¸ösdlµÄdllÎļþ£¬includeÖÐÓÐÍ·Îļþ¡£ÏëÇ ......
ÖÕÓÚÍêÁ˸ßһʱһ¸öССµÄÔ¸Íû£¬Ð´Ò»¸ö²ÂÊý×ÖµÄСÓÎÏ·£¡
Ï×ÉÏÔ´´úÂ룡
Python code:
#! /usr/bin/env python
# -*- coding:gb2312 -*-
import random
class game:
def __init__(self):
self.nub = 5 #¿ØÖÆÉú³ÉµÄËæ»úÊýλÊý£¬Î»ÊýΪnub-1
self.number = 0 #³õʼ»¯Ëæ ......
ÏÖÔÚÕâ¸öÏîÄ¿ÒªÓõ½ ¹ú¼Ê»¯£¬ÕÒÁ˺þã¬Ò²Ã»ÓÐÕÒµ½ºÃµÄÀý×Ó¡£
Ëѵ½Ò»²¿·ÖgettextµÄÀý×Ó£¬µ«Óе㿴²»¶®¡£
Çë¸÷λ´óϺָµãÏ£¿
http://blog.chinaunix.net/u/30664/showart_237334.html
ÒýÓÃ
http://blog.chinaunix.net/u/30664/showart_237334.html
ÎÒÊÔÁË£¬µ«Êǽá¹û²»¶Ô°¡£¬
¡°½«²½Öè1Éú³Éµ ......
ÎÒÓÐÈý¸öCPPÎļþ
wrap.cpp
C/C++ code:
#include <Python.h>
#include "bridge.h"
extern "C"
{
PyObject* bridge(PyObject* self, PyObject* args)
{
int n = 0;
int result = 0;
if (! PyArg_ParseTuple(args, "answer", &n))
return ......