Enders_Game 13 Newbie Poster

I have a class with a button, it runs the command automatically when the gui is constructed (which i dont want it to do) but then doesnt work again after. What am I doing wrong? Builtin commands such as endcommand work as they should.

relevant excerpts (ignore the indent problem at the very beginning)

class GuiPart(object):    
    def __init__(self, master, queue, endCommand):
        self.queue = queue
        # Set up the GUI
        #tkinter.Button(master, text='Done', command=endCommand).grid(row=6,column=6)
        
        tkinter.Button(text='Update Variables', command=self.updateValues()).grid(row=3)

        Lp_pacingState = tkinter.Label(text="p_pacingState")
        Lp_pacingState.grid(row=1, column=3)
        Tp_pacingState = tkinter.Label(bg="white", relief="ridge",justify="center",width=9)
        Tp_pacingState.grid(row=1, column=4)
        ....
        
        self.textBoxes = {"p_pacingState" : Tp_pacingState, "p_pacingMode" : Tp_pacingMode, 
                     "p_hysteresis" : Tp_hysteresis, "p_hysteresisInterval" : Tp_hysteresisInterval,
                     "p_lowrateInterval" : Tp_lowrateInterval, "p_vPaceAmp" : Tp_vPaceAmp,
                     "p_vPaceWidth" : Tp_vPaceWidth, "p_VRP" : Tp_VRP}
    
    #def updateValues(self,input):
    def updateValues(self):
        testInput = ["p_pacingState=3", "garbage=poop", "p_VRP=5"]
        for updates in testInput:
            print("zzzz")
            var = updates.split("=")
            try:
                self.textBoxes[var[0]].config(text = var[1])
            except:
                pass

So I get "zzzz" printed 3 times at construction of gui (labels dont update their text though) and the button doesnt work after that.
Also if theres a better way to update boxes please tell me. I get input from a stream in no particular order or relevance.

Thanks in advance


EDIT: ANSWER - the button was calling self.updatevalues() which is the result of the function and not the function itself. so -> command=self.updatevalues no ()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.