I am having an issue when I convert a .py file into an .exe file. For some reason after it converts, I am getting the .exe file to open. Once it opens a command prompt window opens and then closes within a millisecond. And it never successfully Lauches. I am unsure if it is the version of Python that I am using to convert the file. Or if it could be one of the modules that could be affecting the conversion process. How to resolve this?
Here is the following code.
from tkinter import *
import tkinter as tk
import webbrowser
import subprocess
import time
master = Tk()
master.geometry("250x350")
master.title("Software Installation")
#======================================funtions==================================
def install_chrome():
chrome_download_link = "https://www.google.com/chrome/dr/download/?brand=AYYF&geo=US&gclid=EAIaIQobChMI8MO67O-0gQMVfButBh0spwPFEAAYASAAEgLZi_D_BwE&gclsrc=aw.ds"
webbrowser.open(chrome_download_link)
def install_office_2019():
office_2019_download_link = "https://www.microsoft.com//en-us//microsoft-365//store//download-office-2019//"
webbrowser.open(office_2019_download_link)
def run_windows_updates():
subprocess.call('cmd \/c start ms-settings:windowsupdate', shell=True)
def uninstall_office_365():
subprocess.call('appwiz.cpl', shell=True)
def disable_network_sharing(share_name):
command = f"net share {share_name} \/delete"
subprocess.Popen(command, shell=True)
disable_network_sharing("SharedFolder")
def install_egnyte():
chrome_download_link = "https://helpdesk.egnyte.com/hc/en-us/articles/204909984-Desktop-App-for-Windows-Installation"
webbrowser.open(chrome_download_link)
def install_sophos():
chrome_download_link = "https://login.sophos.com/login.sophos.com/oauth2/v2.0/authorize?p=B2C_1A_signup_signin&client_id=d8ce821f-a1da-4b03-b7e2-1d1a9cc028f3&redirect_uri=https%3A%2F%2Fcloud.sophos.com%2Fmanage%2Flogin%2Fazureb2c&scope=openid&response_type=id_token&prompt=login&state="
webbrowser.open(chrome_download_link)
def install_adobe():
chrome_download_link = "https://www.adobe.com/downloads.html"
webbrowser.open(chrome_download_link)
#=============================Icons=======================================================
var1 = IntVar()
Checkbutton(master, text="Delete office Programs", variable=var1).grid(row=0, sticky=W)
btn2 = Button(master, text = 'RUN',command=uninstall_office_365)
btn2.grid(row=0, column=1)
var2 = IntVar()
Checkbutton(master, text="Run Updates", variable=var2).grid(row=1, sticky=W)
btn2 = Button(master, text = 'RUN',command=run_windows_updates)
btn2.grid(row=1, column=1)
var3 = IntVar()
Checkbutton(master, text="Install Chrome", variable=var3).grid(row=2, sticky=W)
btn2 = Button(master, text = 'RUN',command=install_chrome)
btn2.grid(row=2, column=1)
var4 = IntVar()
Checkbutton(master, text="Install Office 19", variable=var4).grid(row=3, sticky=W)
btn2 = Button(master, text = 'RUN',command=install_office_2019)
btn2.grid(row=3, column=1)
var5 = IntVar()
Checkbutton(master, text="Install Sophos", variable=var5).grid(row=4, sticky=W)
btn2 = Button(master, text = 'RUN',command=install_sophos)
btn2.grid(row=4, column=1)
var6 = IntVar()
Checkbutton(master, text="Install Egnyte", variable=var6).grid(row=5, sticky=W)
btn2 = Button(master, text = 'RUN',command=install_egnyte)
btn2.grid(row=5, column=1)
var7 = IntVar()
Checkbutton(master, text="Turn off Network Sharing", variable=var7).grid(row=6, sticky=W)
btn2 = Button(master, text = 'RUN',command=disable_network_sharing)
btn2.grid(row=6, column=1)
var8 = IntVar()
Checkbutton(master, text="Install Adobe Reader ", variable=var8).grid(row=7, sticky=W)
btn2 = Button(master, text = 'RUN',command=install_adobe)
btn2.grid(row=7, column=1)
What I tried doing was I uses Pyintaller to convert the .py to .exe Then I tried to use Pyinstaller onefile to install Then I used auto-py-to-exe onefile
master.mainloop(), so none of your code has any effect at all. Tkinter, like all GUI frameworks, is event-driven. Those statement you ran don't actually do any drawing. All they do is send messages that get read and dispatched in themainloop. Did you not even run the script before trying to make an exe?