text to the screen the __init__(method takes the parameters selfthe ai_settings and screen objectsand msgwhich contains the text for the button we set the button dimensions at vand then we set button_color to color the button' rect object bright green and set text_color to render the text in white at we prepare font attribute for rendering text the none argument tells pygame to use the default fontand determines the size of the text to center the button on the screenwe create rect for the button and set its center attribute to match that of the screen pygame works with text by rendering the string you want to display as an image at we call prep_msg(to handle this rendering here' the code for prep_msg()button py def prep_msg(selfmsg)"""turn msg into rendered image and center text on the button ""self msg_image self font render(msgtrueself text_colorself button_colorself msg_image_rect self msg_image get_rect(self msg_image_rect center self rect center the prep_msg(method needs self parameter and the text to be rendered as an image (msgthe call to font render(turns the text stored in msg into an imagewhich we then store in msg_image the font render(method also takes boolean value to turn antialiasing on or off (antialiasing makes the edges of the text smootherthe remaining arguments are the specified font color and background color we set antialiasing to true and set the text background to the same color as the button (if you don' include background colorpygame will try to render the font with transparent background at we center the text image on the button by creating rect from the image and setting its center attribute to match that of the button finallywe create draw_button(method that we can call to display the button onscreenbutton py def draw_button(self)draw blank button and then draw message self screen fill(self button_colorself rectself screen blit(self msg_imageself msg_image_rectwe call screen fill(to draw the rectangular portion of the button then we call screen blit(to draw the text image to the screenpassing it an image and the rect object associated with the image this completes the button class scoring