For example, I have a button Click to print a line of string
import tkinter as tkroot = tk.Tk()def say(): print(" Click success !")frame = tk.Frame(root)frame.pack()hi_there = tk.Button(frame, text=" Say hello ", fg="blue", command=say)hi_there.pack(side=tk.LEFT)root.mainloop()
I passed flask You can set up a local anti - web The server , I think in this web Set up on the server index.html, There's a button inside , Click to send POST (JSON Format ) The data of
How to make python Received this data , Then the trigger say()
# In fact, I just want to control through the LAN
flask Interface with post receive data content = request.form.get("content") Then call say That's all right.