コード例 #1
0
 def new_thread(points, delay, n, lines, columns, fps = 0, 
                  test_class = DiagramTest):
     # test multi-thread execution: 
     VoronoiDiagram.start(title = test_class.__name__ + 
                          " - New-thread test", 
                          lines = lines, columns = columns, fps_limit = fps)
     # configure
     threads = []
     # create tests in different threads
     for i in xrange(0,n):
         test = test_class(points, delay)
         threads.append(test)
         VoronoiDiagram.new_diagram(test.diagram, label="test")
         test.start()
     # waiting until previewer terminates
     while VoronoiDiagram.in_state(Preview.RUNNING):
         pass
     # stop tests threads
     for t in threads:
         t.stop()