0

Im fairly new to Vpython and Ive created a simulation for circular motion. I tried adding controls to the simulation and so far I am able to pause the simulation but when i do pause it, the entire control panel becomes unresponsive and i am unable to resume the simulation. Does anyone know why this may be or how i can fix this?

 def playorpause(self, goorno):
    self.pause = goorno

def actual_sim(self):

    c = controls()  # Create controls window
    # Create a button in the controls window:

    # b = Button(pos=(-50, 0), width=60, height=60, text="Pause", action=lambda: self.change)
    # play = Button(pos=(50, 0), width=60, height=60, text="Play", command = self.play_sim)

    b = button(pos=(-50, 0), width=60, height=60, text='Pause', action=lambda: self.playorpause(True))
    play = button(pos=(50,0), width = 60, height = 60, text = "play", action =lambda: self.playorpause(False))

  def loop():
#### simulation code
        if self.pause == False:
            loop()
Samir Hussain
  • 23
  • 1
  • 5

1 Answers1

0

I'm not sure, because I don't really understand your code, but a repetitive loop needs to include a rate statement. Otherwise the program will lock up, unable to output anything.

user1114907
  • 972
  • 8
  • 15