Python Forum
[Tkinter] previous and next buttons
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] previous and next buttons
#1
Hi

I have a db and i got the data and put them in python lists so I can get the records places 0,1,2...
for the first record i am able to assign the right data having the index of the first element which is [0]. Now if I click the button named next, what i can do to go to next record?

    global thephoto
    global answer1
    global answer2
    global answer3
    global answer4
    global correct_answer    

    thephoto = []
    answer1 = []
    answer2 = []
    answer3 = []
    answer4 = []
    correct_answer = []

    conn2 = sqlite3.connect('emsat_data.db')
    c2 = conn2.cursor()
    c2.execute("SELECT * from math_exam")
    conn2.commit()
    records = c2.fetchall()

    for record in records:
        thephoto.append(str(record[0]))
        answer1.append(str(record[1]))
        answer2.append(str(record[2]))
        answer3.append(str(record[3]))
        answer4.append(str(record[4]))
        correct_answer.append(str(record[5]))
        #how many questions are there in db
for first records I can access calling index [0] of each list but I think this is not the right way to deal with this. Any suggestions or tutorials appreciated.
Reply


Messages In This Thread
previous and next buttons - by rwahdan - Jul-13-2021, 09:39 AM
RE: previous and next buttons - by deanhystad - Jul-13-2021, 06:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need code for buttons to move to previous and next documents JayCee 1 2,030 Apr-11-2020, 08:25 PM
Last Post: JayCee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020