Python note (51)
Python class
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 "Current Value:" + 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 =
Current Value: 101
Current Value: 102
Current Value: 11
Current Value: 12
>>>
Pygame notes
>>> 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 ("hello", True, red)
>>> Screen. fill (green)
>>> Screen. Bits (textImage, (90,90 ))
>>> Pygame. display. update ()