Display the value of a counter in a table

0

Live,

The goal is to simulate the iteration between the system and the user, and for this I have to know how many repetitions have been made in each test scenario.

I leave my code below,

Defines the Control Layout

countHF = 0
countRT = 0
countFNI = 0
countQC = 0
countCD = 0

root = Tk()
root.title("AT Control")
root.geometry("250x250")

title = Label(root, text="Test Scenarios", fg="Blue")
title.pack()

scenario_1 = Label(root, text="Sc01", fg="black")

scenario_2 = Label(root, text="Sc02", fg="black")

scenario_3 = Label(root, text="Sc03", fg="black")

scenario_4 = Label(root, text="Sc04", fg="black")

scenario_5 = Label(root, text="Sc05", fg="black")

title.grid(row=0, sticky=W)
scenario_1.grid(row=1)
scenario_2.grid(row=2)
scenario_3.grid(row=3)
scenario_4.grid(row=4)
scenario_5.grid(row=5)

title2 = Label(root, text="Count", fg="blue")
title2.pack()

Entry_Sc01 = Entry(root, textvariable=countHF)
Entry_Sc01.pack()

Entry_Sc02 = Entry(root, textvariable=countRT)
Entry_Sc02.pack()

Entry_Sc03 = Entry(root, textvariable=countFNI)
Entry_Sc03.pack()

Entry_Sc04 = Entry(root, textvariable=countQC)
Entry_Sc04.pack()

Entry_Sc05 = Entry(root, textvariable=countCD)
Entry_Sc05.pack()

title2.grid(row=0, column=1)
Entry_Sc01.grid(row=1, column=1)
Entry_Sc02.grid(row=2, column=1)
Entry_Sc03.grid(row=3, column=1)
Entry_Sc04.grid(row=4, column=1)
Entry_Sc05.grid(row=5, column=1)

varHF = StringVar()
varRT = StringVar()
varFNI = StringVar()
varQC = StringVar()
varCD = StringVar()

varHF.set(countHF)
varRT.set(countRT)
varFNI.set(countFNI)
varQC.set(countQC)
varCD.set(countCD)
root.update()


SClist = ['HF', 'RT', 'FNI', 'QC', 'CD']
timetest=time.asctime()
timetest=timetest.replace(':','-')


for count in range(0, 2):
    report = open('report'+timetest+".txt",'a')

    scenario = random.choice(SClist)

    # Write results in a document
    # Create file .txt

    t = repr(time.asctime())
    report.write(t+'\t'+scenario)

    if scenario == 'HF':
        happyflow()
        countHF += 1
        varHF.set(countHF)
        root.update()
        report.write('... Concluido!'+'\n')


    elif scenario == 'RT':
        rtravelers()
        countRT += 1
        varRT.set(countRT)
        root.update()
        report.write('... Concluido!'+'\n')


    elif scenario == 'FNI':
        flightnumberinterrupted()
        countFNI += 1
        varFNI.set(countFNI)
        root.update()
        report.write('... Concluido!'+'\n')


    elif scenario == 'QC':
        questioncertification()
        countQC += 1
        varQC.set(countQC)
        root.update()
        report.write('... Concluido!'+'\n')


    elif scenario == 'CD':
        customsdeclaration()
        countCD += 1
        varCD.set(countCD)
        root.update()
    report.write('... Concluido!'+'\n')
    report.close()

root.mainloop()

    
asked by anonymous 02.11.2015 / 13:04

1 answer

1

Resolved.

Entry_Sc01 = Entry(root, textvariable=varHF) Entry_Sc01.pack()

Entry_Sc02 = Entry(root, textvariable=varRT) Entry_Sc02.pack()

Entry_Sc03 = Entry(root, textvariable=varFNI) Entry_Sc03.pack()

Entry_Sc04 = Entry(root, textvariable=varQC) Entry_Sc04.pack()

Entry_Sc05 = Entry(root, textvariable=varCD) Entry_Sc05.pack()
    
02.11.2015 / 16:12