0

Hi everyone I am a beginner and I need to design a 3D world editor in python, I found a great code to start off here:

http://vpython.org/contents/contributed/chessboard.py

I tried to add an infinite while loop at the end of the code repeatingly asking for positions to check if it would move pieces in real time. I made sure that I have an exit to this loop when I type "quit".

run = True
while run:
    posi = raw_input("Input move: ")
    if posi == 'quit':
        run = False
    else:
        #this is the function that moves a piece. See chessboard.py
        thisBoard.parseString(posi)

The thing is that I can move pieces around and it works but nothing is displayed in my 3D window until I exit the while loop.

My question is how do I keep the while loop running while still refreshing my 3D board in real time?

I'm not especially asking for a straight answer but if anyone could tell me where to start looking for it?

Thanks in advance

  • 1
    Please add minimally reproducible code in order for us to help you. – mlegge Feb 12 '15 at 14:44
  • Sorry, I added it, but the while loop works, I can input 4 positions before typing 'quit' and 4 pieces move, the problem is that nothing is displayed in my window until I exit the while loop. – Mathias Hintjens Feb 12 '15 at 14:58
  • i am also getting an error `ImportError: No module named visual`.. can you plz help me resolve this error and also how do i install `vpython` on linux – Irfan Ghaffar7 Feb 18 '15 at 19:41
  • @IrfanGhaffar7 `sudo apt-get install python-visual` – Fahadkalis Feb 18 '15 at 19:48

1 Answers1

0

You forgot to put rate() or sleep() to refresh the screen as required in new version of Vpython. Read the 2nd and 3rd paragraph of the following link for more info: http://vpython.org/contents/docs/

Huy Pham
  • 11
  • 1