如何使用tkinter中的变量执行response = requests.get(),这样我就可以发送一些bumbersto api,比如202122,并且请求看起来像"https://google.com/202122“。
def d():
response = requests.get("myserverip/send.php?host=e2<eq>#%s#&port=e2<eq>#%s#&time=e3<eq>#%s#&method=udp") % (e1, e2, e3)
print(response)
#call
def d1():
threading.Thread(target=d).start()
def window():
window = Tk()
window.title("tools")
window.geometry("530x240")
Label(window, text="1").grid(row=0)
Label(window, text="2").grid(row=1)
Label(window, text="3").grid(row=2)
e1 = Entry(window)
e2 = Entry(window)
e3 = Entry(window)
e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1)
Button(window, text='DOREQUEST', bg="gray", fg="white", command=d1).grid(row=3, column=1, sticky=E, pady=30)
frame_label.place(x=210, y=0)
window.mainloop()
#THREADING
p = Process(target=window)
p.start()
p.join()发布于 2022-02-22 13:53:55
def d():
a = e1.get()
b = e2.get()
c = e3.get()
print(a, b, c)
request = requests.get(f"http://google.com/{a}{b}{c}".format(a, b, c))
print(request)
#call
def d1():
threading.Thread(target=d).start()
def window():
window = Tk()
window.title("tools")
window.geometry("530x240")
Label(window, text="1").grid(row=0)
Label(window, text="2").grid(row=1)
Label(window, text="3").grid(row=2)
global e1, e2, e3
e1 = Entry(window)
e2 = Entry(window)
e3 = Entry(window)
e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1)
Button(window, text='DOREQUEST', bg="gray", fg="white", command=d1).grid(row=3, column=1, sticky=E, pady=30)
frame_label.place(x=210, y=0)
window.mainloop()
#THREADING
p = Process(target=window)
p.start()
p.join()https://stackoverflow.com/questions/69494054
复制相似问题