試圖讓用戶輸入並進行搜索谷歌Tkinter的用戶輸入
例子:
客戶端的輸入條目=商業電子郵件
輸出=打開了 鉻的新選項卡>搜索谷歌的, 「INTEXT:gmail.com的商務郵件」
from tkinter import *
import webbrowser
root = Tk()
def main():
global userInput
root = Tk()
Label2 = Label(text="GhostTest")
Label2.pack()
userInput = Entry(bd=2)
userInput.pack()
Button1 = Button(text="Search,", command=userInput)
Button1.pack()
def GoogleSearch():
new = 2
userInput = Entry(bd=2)
term = Entry(userInput)
tabUrl = "http://google.com/?#q="
webbrowser.open(tabUrl+str(term.get()),new=new);
root.mainloop()
if __name__=='__main__':
main()
問題是什麼?你收到錯誤信息還是什麼?如果你得到錯誤,然後把完整的錯誤信息。 – furas
用正確的縮進更新,我遇到的問題是,當我按下搜索按鈕 – Ghost
首先你應該說這是有問題的,它只是沒有做任何事情。 – furas