0

I am trying to make my python executable into an app by putting it into a folder called "folder.app" then into "Contents" then into "MacOs" but whenever I try to open it it just doesn't do anything. Here is the Python code:

 #!/usr/bin/env python3
 import tkinter as tk
 from PIL import Image, ImageTk
 import time
 import os
 import ast
 #other stuff
 f = open("/Users/mimmo/ssh_login_system/login_info.txt", "r")
 contents = f.read()
 f.close()
 users = ast.literal_eval(contents)
 #variables
 stuff = ""
 newlist = []
 login = ""
 inp = ("| => ")
 rw = tk.Tk()
 rw.title("Login")
 rw.configure(bg="grey14")
 rw.geometry("500x200")
 def login(self):
 username = e1.get()
 password = e2.get()
 if username in users:
 if password == users[username]:
 rw.destroy()
 print ("\nlogin successful!\n")
 os.system("python3 connect")
 a = tk.Label(rw, text="Username:", fg='white', bg='grey14').grid(row=0)
 b = tk.Label(rw, text="Password:", fg='white', bg='grey14').grid(row=1)
 e1 = tk.Entry(rw)
 e2 = tk.Entry(rw, show="*")
 e2.bind("", login)
 e1.grid(row=0, column=1)
 e2.grid(row=1, column=1)
 rw.mainloop()
asked Jul 7, 2020 at 20:19
2
  • Have you tried googling how to build mac apps from python? Have you tried py2app? Commented Jul 7, 2020 at 20:22
  • I have but it always gives me a weird result. Commented Jul 7, 2020 at 20:28

1 Answer 1

1

Just placing a python executable into a folder with the .app extension doesn't make your python code a native app. Take a look at libraries that can build your python code into a native app - there are plenty and even more tutorials on how to use them, google around!

For macOS only apps py2app will work, but for other cross-platform options, refer to this existing answer

answered Jul 7, 2020 at 20:41
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.