[I know this question has been asked multiple times but I am still having trouble finding an option that works for me]
I am using replit.com to write my python code.
I made a program in python, but I want to turn it into an executable application (not a .exe as I am on mac). I saw multiple people use py2app but it doesn't work for me (probably due to the fact I am using an Online IDE). I also tried PyCharm, but when I write: "pip install py2app" to import the package, it just says that it doesn't know the command "pip".
The name of the file is: "main.py"
Here is my code in case it helps (it is pretty messy and confusing):
from tkinter import *
import math
root = Tk()
root.title('Minion Profit Calculator')
#Variables#
money = 0
actionT = 0
itemPerAc = 0
unitPr = 0
hasDia = IntVar()
diaSprMoney = 0
money1h = 0
#Labels#
acTime = Label(root, text="Action Time:")
itemAc = Label(root, text="Item/Action:")
unitPrice = Label(root, text="Unit Price:")
diaSpread = Label(root, text="Diamond Spreading:")
profitDis = Label(root, text="Profit (/24h):")
profit = Label(root, text="")
profit1Dis = Label(root, text="Profit (/1h)")
profit1 = Label(root, text="")
#Input Fields#
acTimeIn = Entry(root)
itemAcIn = Entry(root)
unitPriceIn = Entry(root)
#Checkboxes#
diaSpreadBox = Checkbutton(root, variable=hasDia, onvalue=1, offvalue=0)
#Click Event#
def isClicked():
actionT = float(acTimeIn.get())
itemPerAc = float(itemAcIn.get())
unitPr = float(unitPriceIn.get())
money = (86400/actionT*itemPerAc*unitPr)
diaSprMoney = (138240/actionT)
if (hasDia.get() == 1):
money = money diaSprMoney
money = math.trunc(money)
money1h = (money / 24)
money1h = math.trunc(money1h)
#Add $ before the number
money = str(money)
money1h = str(money1h)
money = ("$" money)
money1h = ("$" money1h)
profit.configure(text=money)
profit1.configure(text=money1h)
#Buttons#
cal = Button(root, text="Calculate", command=isClicked)
#Grid Placing#
acTime.grid(row = 0, column = 0)
itemAc.grid(row = 1, column = 0)
unitPrice.grid(row = 2, column = 0)
diaSpread.grid(row=3, column = 0)
profitDis.grid(row=5)
profit.grid(row=5, column=1)
profit1Dis.grid(row=6)
profit1.grid(row=6, column=1)
acTimeIn.grid(row=0, column=1)
itemAcIn.grid(row=1, column=1)
unitPriceIn.grid(row=2, column=1)
diaSpreadBox.grid(row=3, column=1)
cal.grid(row=4, columnspan=2)
root.mainloop
CodePudding user response:
Please try to move your code into a new python file on your machine. I don't think it's possible to do this using replit.
You have to download pip for you to do this properly. You can download pip here.
Once you have pip downloaded, you can use the Pyinstaller library to package Python programs as standalone executables. It works on Windows, Linux, and Mac.
Read this answer for more details.
If you want to stick with py2app
, just run pip install py2app
in your terminal once you have pip downloaded.