Home > other >  Code with pygame to knock out questions, strange, brother please help have a look
Code with pygame to knock out questions, strange, brother please help have a look

Time:11-20

I followed the teacher typed the code look like
# 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 the

CodePudding user response:

TXT. Surf to txt_surf

CodePudding user response:

Still less,,, can't run out

CodePudding user response:

TXT. Surf txt_surf instead should be knocked at the wrong
Win. The fill ((0, 0)) black color used said tuple (0, 0)

CodePudding user response:

TXT not defined, you copy the less

CodePudding 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