Q:

Repeatedly iterating through a list, with buttons and bindings

So I'm making a maths test in TkInter (Python 3.4.3).  I want to use only one frame for all questions.  I have a list that contains all of the strings (QStringList, imported from another .py), which are used as the text variables for a label. 
When the user presses Return, or the Button, I want to iterate to the next item in the list, so there's a new question displayed. 
With my current code, I can only successfully do this once.  Presumably because the 'CurrentQ' variable gets set back to 0 each time. 
How do do this so that each time I call the function, the next list item is displayed? 
This code is in my TestPage(tk. Frame): class. 
def __init__(self,parent,controller):
    tk. Frame.__init__(self,parent)

    CurrentQ = 0

    #QUESTION LABEL
    self. CurrentQStringVar = tk. StringVar()
    self. CurrentQString = tk. Label(self, textvariable=self. CurrentQStringVar,
                               anchor='w',fg="black", bg="yellow", font=STANDARD_FONT)
    self. CurrentQString.grid(column=0,row=0,columnspan=2, sticky='EW')
    self. CurrentQStringVar.set(QStringList[CurrentQ])

    #ANSWER ENTRY BOX
    self. UserAnsEntryVar = tk. StringVar()
    self. UserAnsEntry = tk. Entry(self,textvariable=self. UserAnsEntryVar)
    self. UserAnsEntry.grid(column=0,row=1,sticky='EW')
    self. UserAnsEntry.bind("<Return>",
                           lambda event, CurrentQ=CurrentQ:
                           self. TestEnterKey(self,CurrentQ))
    self.UserAnsEntryVar.set("")

    #ANSWER BUTTON
    self. UserAnsButtonVar = tk. StringVar()
    self. UserAnsButton = ttk. Button(self,text="ENTER",
                                    command= lambda: self. TestEnterKey(self,CurrentQ))
    self. UserAnsButton.grid(column=0,row=2,columnspan=2, stick='EW')

def TestEnterKey(self,event,CurrentQ):
    CurrentQ += 1
    self. CurrentQStringVar.set(QStringList[CurrentQ])
    return CurrentQ

I tried to use the CurrentQ as an argument in the function, but maybe I have to use a lambda. 
edit: my actual QStringList is really long, and contains other (randomly generated) variables.  So for this I guess it'd be better to just have...
QStringList = ["Q1","Q2","Q3","Q4","Q5","Q6","Q7","Q8","Q9","Q10"]

A:

First, don't use lambda.  Lambda has its uses, but you rarely need it in Tkinter programs, and as often as not it just makes the code more complicated without giving anything in return.  
Instead, make the function that is called from the binding and from the button fetch the data it needs, when it needs it.  Since the binding sends an event and the command button does not, simply make the event parameter optional. 
Also, make CurrentQ an attribute of the object so that it's easily accessible and doesn't have to be passed around. 
def __init__(self,parent,controller):
    ...
    self. CurrentQ = 0
    ...
    self. UserAnsEntry.bind("<Return>",self. TestEnterKey)
    ...
    self. UserAnsButton = ttk. Button(self,text="ENTER", command=self. TestEnterKey)
    ...

def TestEnterKey(self,event=None):
    self. CurrentQ += 1
    self. CurrentQStringVar.set(QStringList[self. CurrentQ])

Another way you could cycle through the list of questions is to always use the first item in the list, and then move the first item to the end.  Python has a function that does something similar, letting you cycle through a list indefinitely.  See itertools.cycle.  
For example:
import itertools
...
self.questions = itertools.cycle(self. QStringList)
...
# this will always return the next question, looping
# back over the list as needed
next_question = self.questions.next()

Finally, you might want to consider not using a StringVar with the label.  There's really no need unless you're using the StringVar in more than one place.  Without it you can still change the text in the label, but you have one less object in your project that you have to manage.  
For example:
question = self.questions.next()
self. CurrentQString.configure(text=question)

