def main(): app = QtGui.QApplication(sys.argv) # create function with default size and position show_form_defaults = functools.partial(psytml.show_form, size=(900, 600), position=(0, 0)) psytml.show_form("./sampleHTML/intro1.html", (900, 400), None) results1 = show_form_defaults("./sampleHTML/item_c_1.html") results2 = show_form_defaults("./sampleHTML/item_c_2.html") # Note the demographics use jsVal (by Karl Seguin & Timo Haberkern) # released under LGPL (and are in German) demographics = psytml.show_form(filename="./sampleHTML/demographics.html", size=(900, 500), position=(200, 200)) print(results1) print(results2) print(demographics)
select = "gabor1" text.draw() win.flip() core.wait(0.1) if "q" in event.getKeys(): break # make the psychopy window empty and show mouse again mouse.setVisible(True) win.flip() win.flip() # on some graphics cards win.flip must be called twice to get an # empty screen ## Present html trials with psytml for trial_num, item in enumerate(items): data_trial = psytml.show_form(item, (900, 700), None) data_trial.update({"id":id_, "condition":condition, "trial": trial_num+1}) # here you could add other information that should be written to each trial. data.append(data_trial) # add current trial to the data list. ## Writing the trial data: data_header = ["id", "condition", "trial", "content", "causal", "power", "resp"] # The header needs to match the keys in the dictionary stored in data # the header will be written as the first line in the data file (as long as # print_header is True when calling writeTrials) # when called like this a file with the same name will be overwritten helper.writeTrials(header=data_header, list=data, path=DATA_FOLDER, expName=EXP_NAME, id=id_) ## Get demographic data and show final screens # Note the demographics use jsVal (by Karl Seguin & Timo Haberkern) relaesed # under LGPL demographics = show_form_intro("../sampleHTML/demographics.html")
#!/usr/bin/env python # -*- coding: utf-8 -*- # last mod 2012-09-20 13:49 KS import sys sys.path.append("../") # include folder, where the psytml.py file is in import psytml from PyQt4 import QtGui app = QtGui.QApplication(sys.argv) results = psytml.show_form("./sampleHTML/item_nc_1.html", size=(900, 600)) print(results) resp = int(results["resp"]) if resp < 0: print("unsatisfied") else: print("satisfied or neutral")
#!/usr/bin/env python # -*- coding: utf-8 -*- # last mod 2012-09-20 13:49 KS import sys, os sys.path.append("../") # include folder, where the psytml.py file is in import psytml from PyQt4 import QtGui app = QtGui.QApplication(sys.argv) file = "item_nc_1.html" print(os.path.isfile(file)) results = psytml.show_form(file, size=(800, 600)) print(results) resp = int(results["resp"]) if resp < 0: print("unsatisfied") else: print("satisfied or neutral")
select = "gabor1" text.draw() win.flip() core.wait(0.1) if "q" in event.getKeys(): break # make the psychopy window empty and show mouse again mouse.setVisible(True) win.flip() win.flip() # on some graphics cards win.flip must be called twice to get an # empty screen ## Present html trials with psytml for trial_num, item in enumerate(items): data_trial = psytml.show_form(item, (900, 700), None) data_trial.update( { "id": id_, "condition": condition, "trial": trial_num + 1 } ) # here you could add other information that should be written to each trial. data.append(data_trial) # add current trial to the data list. ## Writing the trial data: data_header = [ "id", "condition", "trial", "content", "causal", "power", "resp" ] # The header needs to match the keys in the dictionary stored in data # the header will be written as the first line in the data file (as long as # print_header is True when calling writeTrials)