# pygame demo.
The import pygame
Pygame. The init ()
Pygame. The font. Get_fonts ()
My_font=pygame. The font. SysFont (# 'Arial, 32) to create a font file
Win=pygame. Display. Set_mode ((800600))
TXT. Surf=my_font. Render (' This is a message! ', True, (0, 255))
Win. The fill (0, 0)
Win. Blit (txt_surf, (0, 0))
Pygame. Display. Flip ()
Then give me display error is
Traceback (the most recent call last) :
The File "C:/Users/Administrator/Desktop/Python code/13", line 6, the in & lt; module>
TXT. Surf=my_font. Render (' This is a message! ', True, (0, 255))
NameError: name 'TXT' is not defined
I feel my problems out on me doesn't define TXT?
Hope you can help me ~
CodePudding user response:
My is 2.7 version, because school can only use this version of theCodePudding user response:
TXT. Surf to txt_surfCodePudding user response:
Still less,,, can't run outCodePudding user response:
TXT. Surf txt_surf instead should be knocked at the wrongWin. The fill ((0, 0)) black color used said tuple (0, 0)
CodePudding user response:
TXT not defined, you copy the lessCodePudding user response:
The TXT, there is no definition, you can't find related instructions in your code, it must be a problem,Feelings are you likely to knock on the wrong: TXT. Surf to txt_surf