0

So i am creating a slot machine as a little project for fun and learning, I was wondering if there was a way to replace multiple lines of text in the console. I have it replacing one line but I would like to be able to print three lines then the top be replaced with the middle then middle with the bottom and continue untill the loop is finished. I am still a beginner so if there are any tips you have for me and or please feel free to critique my code. Thank you

import sys
import time
from random import randint

slot_possibilities = ["  Star ","  Moon ","  Sun! "," Monkey"]
wait_time = 15

print "--------------------------------"
print "|--------Monkey-----Slots------|"
print "|------------------------------|"
while wait_time != 0 :
    x = randint(0,3)
    y = randint(0,3)
    z = randint(0,3)
    sys.stdout.write("\r|" + slot_possibilities[x] + " || " + slot_possibilities[y] + " || "+ slot_possibilities[z] + " |")
    time.sleep(1)
    wait_time -= 1
print
print
Astrea
  • 63
  • 8
  • I believe [this](http://stackoverflow.com/questions/6169217/replace-console-output-in-python) answer tells you how to do what you want – scotty3785 Nov 08 '16 at 16:56
  • @scotty3785 Im not really sure if that helps. I can already replace a single line of text my code already does that and thats what that answer is doing am i wrong? – Astrea Nov 08 '16 at 17:02
  • 1
    You are going to need `curses` for this, see https://docs.python.org/2/library/curses.html There are many examples about using on the internet which should help you get started using curses, which is very powerful and useful once you know it. – Dartmouth Nov 08 '16 at 17:41
  • @Dartmouth wow that is cool thank you so much. Started working on it and man is this difficult but thats why I am doing this. Time To Learn Thanks – Astrea Nov 08 '16 at 18:47

0 Answers0