0

I've been having problems running my python program on the mac.

Opening without the IDLE:

Firstly, whenever I open the program it opens with the IDLE by default. I would like it to open with the launcher, but when I tried opening it with the launcher, it came up with a preferences window that had no "Ok", "Next", or "Continue" button.

On Windows, if you open a python program, then by default it will run it with the launcher, causing it to go directly into the program without the user needing to go through any other windows. The .pyw extension can also be used to make it run without the console. How would I set the Mac so that it does this?

Background of tkinter buttons:

In the following function I have a menu with several buttons:

def MainMenu():
    Move() # This clears any widgets that are on the screen.
    Win.unbind("<Up>") # Win is the name of my window.
    Win.unbind("<Down>")
    Win.unbind("<Return>")
    Win.config(bg="#FFFF00")
    try:Welcome=GUI.Label(Win,text="Welcome "+Name+("."if Name[-1]!="."else"")+"\nYou should have £"+str(Cash)+("0"if str(Cash)[-2]=="."else"")+".\n What would you like to do?",bg="#FFFF00") # GUI is the variable containing the tkinter library.
    except IndexError:Welcome=GUI.Label(Win,text="Welcome "+Name+".\nYou should have £"+str(Cash)+".\n What would you like to do?",bg="#FFFF00")
    Welcome.place(x=0,y=0)
    ManualButton=GUI.Button(Win,text="Manual adjustment.",width=96,height=4,command=ManualChange,bg="#FFFF00")
    ManualButton.place(x=0,y=0)
    RecButton=GUI.Button(Win,text="Recall.",width=96,height=4,command=Recall,bg="#00FF00")
    RecButton.place(x=0,y=0)
    Setti=GUI.Button(Win,text="Settings",command=Settings,bg="#FFFF00",width=96,height=4)
    Setti.place(x=4,y=4)
    if Set:
        RecoButton=GUI.Button(Win,text="Record spending.",width=96,height=4,command=Spending,bg="#FF80C0")
        RecoButton.place(x=256,y=14)
    Win.update_idletasks()
    Welcome.place(x=Win.winfo_width()//2-Welcome.winfo_width()//2,y=16)
    ManualButton.place(x=Win.winfo_width()//2-ManualButton.winfo_width()//2,y=256)
    RecButton.place(x=Win.winfo_width()//2-ManualButton.winfo_width()//2,y=192)
    if Set:RecoButton.place(x=Win.winfo_width()//2-ManualButton.winfo_width()//2,y=128)
    Setti.place(x=Win.winfo_width()//2-ManualButton.winfo_width()//2,y=340)
    Win.update()

Here is a picture of the menu it creates (Name="S", Cost=8805.33, Set=True):

This is what it looks like on a Mac (Name="S", Cost=96, Set=True):

I would like to make the buttons look more like they do on Windows, or at least get rid of the grey space around the buttons. Does anyone have any idea how I'd do this?

Programmer S
  • 429
  • 7
  • 21
  • 1
    It's unclear what you mean by "How would I set it so that opening the program runs it without going through any other windows?". Also on Mac `tkinter` does not support the same color functions as windows, see: https://stackoverflow.com/q/1529847/499581 – l'L'l Dec 05 '18 at 20:58
  • @l'L'l I have edited my question. Is it easier to understand now, or is there still a problem? Also, thanks for the link. – Programmer S Dec 05 '18 at 22:03
  • Regarding the script automatically opening with Python Launcher, you can select a filetype on `Mac` to "Always open with...", maybe this is the similar `Windows` capability you are looking for? – l'L'l Dec 05 '18 at 22:08
  • @l'L'l As stated in the question, I have tried this. I am assuming the launcher works differently on the Mac. – Programmer S Dec 05 '18 at 22:10
  • On Mac `tkinter` generally uses the `X11` window manager, so maybe that’s part of the issue. I’m still a bit confused as to why you need/want to use the Python Launcher.app anyway. You could likely create a .command that executed the script or bundle it in an .app format using PyInstaller. – l'L'l Dec 05 '18 at 22:34

0 Answers0