我有一个python模块,当在tkinter应用程序中单击一个按钮并最终调用pynput on_click侦听器时,我需要调用一些函数,但是现在当我单击该按钮时,它侦听on_click事件并且不调用前两个事件函数(我有一个函数,它将在内部调用前两个函数,最后调用侦听器)
// execute funtion will call first two functions and finally call listener when a button1 in tkinter is clicked(which is not working as of now)
def execute():
button1.config(state='disabled')
capture()
create_masterfile()
#on_click(1, 1, button1, left)
def capture():
label.config(text="Started")
def create_masterfile():
//perform some actions
def on_click(x, y, button, pressed):
print ("Mouse clicked")
// Perform some actions
with Listener(on_click=on_click) as listener:
listener.join()
app = Tk()
app.title("Sample Application")
app.geometry("500x200+100+100")
label = Label(app, text="Not Started", height=0, width=100)
b = Button(app, text="Stop/Quit", width=20, command=app.destroy)
button1 = Button(app, text="Start", width=20, command=execute)
label.pack()
b.pack(side='bottom',padx=0,pady=0)
button1.pack(side='bottom',padx=5,pady=5)
app.mainloop()