Advertisement
nairanupama13

FILE POOL DISPLAY IMAGES

Oct 7th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.02 KB | None | 0 0
  1. import random
  2. import numpy as np
  3.  
  4. ##-------------------------------- section I ------------------------------------------
  5.  
  6.  
  7. image_list = []
  8.  
  9. curve = np.array(["shape2.jpg", "shape3.jpg","shape7.jpg","shape8.jpg", "shape9.jpg","shape11.jpg","shape12.jpg", "shape13.jpg", "shape14.jpg"])
  10.  
  11. image_list.extend(curve)
  12.  
  13. close = np.array(["shape2.jpg", "shape3.jpg", "shape6.jpg", "shape7.jpg", "shape8.jpg", "shape9.jpg", "shape11.jpg", "shape12.jpg", "shape14.jpg"])
  14.  
  15. image_list.extend(close)
  16.  
  17. diag = np.array(["shape1.02.jpg", "shape3.jpg", "shape5.jpg", "shape6.jpg", "shape13.jpg"])
  18.  
  19. image_list.extend(diag)
  20.  
  21. sym = np.array(["shape2.jpg", "shape3.jpg", "shape4.jpg", "shape5.jpg", "shape6.jpg", "shape7.jpg", "shape10.jpg", "shape14.jpg"])
  22.  
  23. image_list.extend(sym)
  24. image_list = np.unique(image_list)
  25.  
  26. text = ['curve?', 'sym?', 'diag?', 'sym']
  27.  
  28. #counter = 0
  29. for symbo in image_list:
  30.     #counter += 1
  31.     #print counter
  32.     #print symbo
  33.     exp.sym_cnvs = self.offline_canvas()
  34.     xc = exp.sym_cnvs.xcenter()
  35.     yc = exp.sym_cnvs.ycenter()
  36.     chosen_text = random.choice(text)
  37.     exp.text_cnvs = self.offline_canvas()
  38.     cx = exp.text_cnvs.xcenter()
  39.     cy = exp.text_cnvs.ycenter()
  40.     sympic = exp.get_file(symbo)
  41.     #print type(sympic)
  42.     exp.sym_cnvs.image(sympic, xc, yc)
  43.     exp.text_cnvs.set_font("mono",100)
  44.     exp.text_cnvs.text(chosen_text, cx, cy)
  45.    
  46.    
  47.     if symbo in diag:
  48.         if chosen_text == 'diag?':
  49.             exp.set("correct_response", "y")
  50.         else:
  51.             exp.set("correct_response", "n")
  52.            
  53.     if symbo in curve:
  54.         if chosen_text == 'curve?':
  55.             exp.set("correct_response", "y")
  56.         else:
  57.             exp.set("correct_response", "n")
  58.            
  59.     if symbo in close:
  60.         if chosen_text == 'close?':
  61.             exp.set("correct_response", "y")
  62.         else:
  63.             exp.set("correct_response", "n")
  64.            
  65.     if symbo in sym:
  66.         if chosen_text == 'sym?':
  67.             exp.set("correct_response", "y")
  68.         else:
  69.             exp.set("correct_response", "n")
  70.  
  71. RUN PHASE:
  72.  
  73. exp.sym_cnvs.show()
  74. self.sleep(3000)
  75. exp.sym_cnvs.clear()
  76.  
  77.  
  78. exp.text_cnvs.show()
  79. #self.sleep(3000)
  80. exp.text_cnvs.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement