python 类
class Mytest(object):
nownum=0
def __init__(self,value=100):
self.nownum=value
def inCrease(self):
self.nownum+=1
def deCrease(self):
self.nownum-=1
def toString(self):
return "当前值:"+str(self.nownum)
xx1=Mytest()
xx1.inCrease()
print xx1.toString()
xx1.inCrease()
print xx1.toString()
xx2=Mytest(10)
xx2.inCrease()
print xx2.toString()
xx2.inCrease()
print xx2.toString()
============================ RESTART: E:\test.py ============================
当前值:101
当前值:102
当前值:11
当前值:12
>>>
pygame手记
>>> import pygame
>>> from pygame.locals import *
>>> pygame.init()
(6, 0)
>>> screen=pygame.display.set_mode((500,550))
>>> myfont=pygame.font.Font(None,80)
>>> red=(255,0,0)
>>> green=(0,255,0)
>>> textImage=myfont.render("您好",True,red)
>>> screen.fill(green)
<rect(0, 0, 500, 550)>
>>> screen.blit(textImage,(90,90))
<rect(90, 90, 134, 56)>
>>> pygame.display.update()