Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Click to select text_input on screen with multiple inputs

In my experiment, I have a form with 20 text_inputs. The code below constructs this form:

form = widgets.form(self.experiment, cols=[3,3,2],rows=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
        margins=(0,0,0,0), spacing=3, theme='plain')
iceTextList = []
engTextboxList = []
pairsDict = [
                [u'crash', u'árekstur'],
                [u'surf', u'brim'],
                [u'chest', u'bringa'],
                [u'pump', u'dæla'],
                [u'cook', u'elda'],
                [u'grin', u'glott'],
                [u'spring', u'gormur'],
                [u'loaf', u'hleifur'],
                [u'dress', u'kjóll'],
                [u'actress', u'leikkona'],
                [u'color', u'litur'],
                [u'flour', u'mjöl'],
                [u'record', u'plata'],
                [u'shave', u'raka'],
                [u'belt', u'reim'],
                [u'cloak', u'skikkja'],
                [u'swing', u'sveifla'],
                [u'twin', u'tvíburi'],
                [u'wing', u'vængur'],
                [u'marsh', u'votlendi']
            ]
for pair in pairsDict:
    eng, ice = pair[0], pair[1]
    iceTextList.append(widgets.label(form,text = ice, center=True))
    engTextboxList.append(widgets.text_input(form, text='', stub='', frame=True, var=eng+'Resp', return_accepts=False))

iceHeader = widgets.label(form, text = 'Icelandic', center=True)
engHeader = widgets.label(form, text = 'English', center=True)

continueButton = widgets.button(form, text='Continue...', frame=True, center=True)

form.set_widget(iceHeader, (0,0), colspan=1)
form.set_widget(engHeader, (1,0), colspan=1)
form.set_widget(continueButton, (2,20), colspan=1)

for i in range(len(iceTextList)):
    form.set_widget(iceTextList[i], (0,i+1), colspan=1)
    form.set_widget(engTextboxList[i], (1,i+1), colspan=1)

Currently, you must press return or tab before you are able to select a new text_input to type into. Is there a solution that allows me to have multiple text_inputs on one form, and each of which can be selected by only clicking on it?

Comments

Sign In or Register to comment.