1

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

3

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

Sign up to request clarification or add additional context in comments.

Comments

0

The first line needs to be:

#!/usr/bin/python

(no space before 'python'), and the script needs to be marked executable (chmod +x scriptname)

3 Comments

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.
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?
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

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.