this my code
#!/usr/bin/ python
from Tkinter import *
root = Tk(className="My first GUI") # creates root window
# all components of thw window will come here
root.mainloop() # To keep GUI window running
it just generates a window. i want to convert it into an executable file for Linux based machines i.e(when clicked on the executable file it should display the window directly). i don't want the user to run it from terminal.
2 Answers 2
Just put this in the first line of your script:
#!/usr/bin/env python
Make the file executable with
`chmod +x GuiFile.`py
Execute with
./GuiFile.py
for Windows, you can use py2exe or pyinstaller
answered Apr 24, 2017 at 9:31
user2623906
Sign up to request clarification or add additional context in comments.
Comments
The first line needs to be:
#!/usr/bin/python
(no space before 'python'), and the script needs to be marked executable (chmod +x scriptname)
answered Apr 24, 2017 at 9:30
Martin Bonner supports Monica
29.1k3 gold badges56 silver badges91 bronze badges
3 Comments
3gth
i get what you are saying is to make the script executable and then run it. i can do that but what i need is to convert the file into a format where anyone can click on it and it will execute the code in it.
Martin Bonner supports Monica
If you (double-)click on a script the system will execute the code in the script. Do you want to someone else to be able to run the script without installing Python?
3gth
python will be already available in another machine. just make the file executable is what i need. i don't want the other user to make it executable or run it from terminal
lang-py