Feb-18-2017, 03:34 AM
class titlescreen: global drawing drawing ='...drawing...' def drawbackground(filename,constant=True): if constant==True: print ('===non-animated title screen===') print(drawing) elif constant==False: print('===animated title screen===') print (drawing) else: print('===unknown background type===') print('===cannot draw background===') titlescreen.drawbackground('yuzsgxsw')i need to make the variable drawing global before using it,if not it will give NameError,why?
the drawing variable is still titlescreen class ,right?
At the same time,can anyone teach me how to use the keyword self?