【发布时间】:2022-08-17 22:53:53
【问题描述】:
如何将通过 Tkinter 收到的输入传递给 getLink 函数?我希望它在我按下按钮时将输入发送到函数。
import tkinter as tk
import requests
pencere=tk.Tk()
pencere.title(\"İnstagram Share App\")
pencere.geometry(\"360x480\")
def getLink(url):
r = requests.get(url)
with open(\'00.jpeg\', \'wb\') as f:
f.write(r.content)
def buton_link():
link = ent1.get()
return link
e1=tk.Label(text=\"Image Link\",font=\"Arial 12 bold\")
e1.pack()
ent1=tk.Entry(width=30)
ent1.pack()
b1=tk.Button(text=\"Link\",bg=\"black\",fg=\"white\",font=\"Arial 20 bold\",command=buton_link())
b1.pack()
pencere.mainloop()
link = buton_link()
getLink(link)