dimanche 2 avril 2017

Trying to add text from a random line from a text file

I am making a game in pygame for my sister for practising in pygame and I am trying to add a random line from a text file in to window name:

import pygame,random,sys

RandomMess = open('GameText.txt')
pygame.display.set_caption('Dream Land: {}').
#The .txt file currently has 4 lines but will be a lot more in the future... 
#These are the test lines: This is in beta, hi :), hello, hi

I have all the rest of the code in case anyone says that I haven't done any other code to make the window or anything. I want it to say: Dream Land: {} then in the braces add a random line from the file.




Aucun commentaire:

Enregistrer un commentaire