from __future__ import print_function
from ipywidgets import interact, interactive, fixed, interact_manual
from ipywidgets import RadioButtons, Text, Select, Dropdown, Label, jslink, Combobox, Output, HTML, VBox
from ipywidgets.widgets.widget import Widget, register, widget_serialization
from ipywidgets.widgets.widget_core import CoreWidget
from IPython.display import  display, clear_output

from traitlets import Unicode, Tuple, Instance, TraitError

# mcg is a list of lists 
# each list consists of a string (the stem) & a list of distractor tuples (distractor string and response string)
['The amount of gas exhaled after a maximal inpiration followed by a maximal expiration is the:', [('choose',''),('IC', 'Try again...'),('RV','Try again...'),('VC','Correct!'), ('TV', 'Try again...')]],
['The amount of gas in the lungs after a maximal inspiration is the:',[('choose',''),('IC','Try again...'),('IRV','Try again...'),('TLC','Correct!')]],
['Where does gas exchange occur?',[('choose',''),('pulmonary artery','Try again...'),('bronchioles','Try again...'),('alveoli','Correct!'), ('pleura', 'Try again...')]],
['The pleura that surrounds the lungs consists of two layers, the ________.',[('choose',''),('visceral & parietal pleurae','Correct!'),('mediastinal & parietal pleurae','Try again'),('visceral & mediastinal pleurae','Try again'),('none of the above','Try again')]],    
['finished',[('no option','')]]    

# without iteration


def f(stem,distractors):
    return stem,distractors

w=interactive(f, stem=stem, distractors=distractors);

# i=0
# while i < len(mcq):  # from the nested list of mcq items
#     stem=mcq[i][0]
#     distractors=mcq[i][1]
#     i += 1       # controls the while loop     
#     w=interactive(f, stem=stem, distractors=distractors);
#     display(w)