Trying to make a button on an application that activates a microphone (function will perform speech to text in the future) and stops using microphone when left click is released. Have the following code to do so:
######################window construction stuff#####################
def __init__(self):
#create chat window
self.Window = Tk()
self.Setup()
def run(self):
self.Window.mainloop()
def Setup(self):
#building the actual core program window
#main window code here, not needed for the question
######################window construction stuff end#####################
###################button start#################################
vc= Button(self.Title,
text = "voice",
font = "sans-serif 8",
#width = 20,
#height = 20,
bg = "#002654",
fg = "white")
vc.bind('<ButtonPress-1>', self.voiceinput())
vc.bind('<ButtonRelease-1>', self.voiceterminate())
vc.place(relx = 0.95,
rely = 0.20,
relheight = 0.70,
relwidth = 0.05)
###################button end#################################
...
######These are the debug versions of the functions, obviously not the final version.########
def voiceinput(self):
print ("acknowledged.")
def voiceterminate(self):
print ("terminated.")
##################debug functions end#################
Now, currently, as soon as its run it will print "acknowledged" and "terminated" to the console as soon as its finished loading the program (without clicking on anything), and subsequent clicks or releases of the "vc" button do nothing. Is there something silly I'm missing with this?