Description
#Created by Felipe González (felgcoll)
#GUI to open an executable
import os
import tkinter
#Path
executables = {'spotify':r'C:\Users\usuario\AppData\Roaming\Spotify\Spotify.exe',
'opera':r'C:\Users\usuario\AppData\Local\Programs\Opera\launcher.exe',
'minecraft':r'C:\Users\usuario\AppData\Roaming\.minecraft\TLauncher.exe',
'word':r'"C:\Program Files (x86)\Microsoft Office\Office15\WINWORD.exe"',
'excel':r'"C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.exe"',
'cmd':r'C:\WINDOWS\system32\cmd.EXE',
'discord':r'C:\Users\usuario\AppData\Local\Discord\app-0.0.306\Discord.exe',
'pycharm':r'C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\bin\pycharm64',
'teams':r'C:\Users\usuario\AppData\Local\Microsoft\Teams\current\Teams.exe'}
from tkinter import *
from tkinter import messagebox, ttk
root = Tk()
root.config(width=480, height=320)
root.title("Open it fast")
frame = Frame(root)
frame.config(bg = 'sky blue', width=480, height=320)
frame.pack()
style = ttk.Style()
lab = Menubutton(frame, text = "WELCOME",
font=("Heveltica", 20), bg = 'sky blue')
lab.pack()
label1 = Menubutton(frame, text = "Please enter \n"
"the program you want to open",
font=("Heveltica", 18), bg = 'sky blue')
label1.pack()
entry = Entry(frame)
entry.pack()
def open_prog():
name = entry.get()
name = name.lower()
if name == "":
messagebox.showinfo('Oops', 'Please enter a program name')
elif name not in executables:
messagebox.showinfo('Oops', 'Sorry, enter a correct name')
else:
messagebox.showinfo('Running ' + name.capitalize(),
name.capitalize() + ' was open')
os.system(executables[name])
style.map("C.TButton",
foreground=[('pressed', 'black'), ('active', 'blue')],
background=[('pressed', '!disabled', 'black'), ('active', 'white')]
)
open = ttk.Button(frame, text = "Open", command = open_prog, style = "C.TButton")
open.pack()
root.mainloop()