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()

1 Answers1

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

PossiblyAShrub
  • 447
  • 5
  • 6