我一直試圖與Tkinter一起創建一個GUI來選擇程序/網站 在啓動時啓動。Tkinter語法問題
web瀏覽器和subprocess.exe首戰在其他腳本中工作正常,併爲Tkinter的腳本模板的工作,但是當我開始增加更多的變數 它規定無效的語法(特別是在CoWeb
變量,在DEF)
任何人都可以幫助我嗎?我缺少一些基本的東西嗎?
from Tkinter import Tk, Label, Button
import subprocess
import webbrowser
class MyFirstGUI:
def __init__(self, master):
self.master = master
master.title("Greetings")
self.label = Label(master, text="Good Morning Mr. Swordy. What would you like to do?")
self.label.pack()
self.CoWeb_button = Button(master, text="ENE Website", command=self.CoWeb)
self.CoWeb_button.pack()
self.ProjWeb_button = Button(master, text="ENE Projects", command=self.ProjWeb)
self.ProjWeb_button.pack()
self.Excel_button = Button(master, text="Excel", command=self.Excel)
self.Excel_button.pack()
self.AutoCAD_button = Button(master, text="AutoCAD", command=self.AutoCAD)
self.AutoCAD_button.pack()
self.GEarth_button = Button(master, text="Google Earth", command=self.GEarth)
self.GEarth_button.pack()
self.close_button = Button(master, text="Close", command=master.quit)
self.close_button.pack()
def Excel(self):
subprocess.Popen([r"C:\Program Files (x86)\Microsoft Office\Office16\EXCEL.EXE"]
def CoWeb(self):
url = "https://intranet.enengineering.com/SitePages/Home.aspx"
webbrowser.open_new(url)
def ProjWeb(self):
url = "https://eneprojects.enengineering.com/SitePages/Home.aspx"
webbrowser.open_new(url)
def AutoCAD(self):
subprocess.Popen([r"C:\Program Files\Autodesk\AutoCAD 2016\acad.exe"]
def GEarth(self):
subprocess.Popen([r""C:\Program Files (x86)\Google\Google Earth Pro\client\googleearth.exe"]
root = Tk()
my_gui = MyFirstGUI(root)
root.mainloop()
你忘了所有的'subprocess.Popen([..]' –
總是右括號。
的定義提出問題FULL錯誤信息(Traceback) – furas