Tarun Kumar
Tarun Kumar

Reputation: 11

how to run python application without use of terminal on ubuntu

I use Ubuntu.

Made a simple gui application in python using PyQt.

I can run this by using python interpreter as:

python application.py

I want to know whether is there any way to just run this application.py file by double-clicking on it as we do in windows(.exe files)!!!

Upvotes: 1

Views: 5415

Answers (3)

BuvinJ
BuvinJ

Reputation: 11046

Check this link:

https://askubuntu.com/questions/761365/how-to-run-a-python-program-directly

You need to change how the file manager acts when you double click on executable files too.

Upvotes: 0

stukat
stukat

Reputation: 66

Create a .desktop file like this and put it in /usr/share/applications/

[Desktop Entry]
Type=Application
Name=XChat Firefox
Exec=/usr/bin/your_script
Icon=/usr/share/icons/xchats_icon

found here: https://askubuntu.com/questions/60667/apply-icons-to-bash-scripts/60670#60670

Upvotes: 0

PM 2Ring
PM 2Ring

Reputation: 55479

You can just drag a file onto your desktop from your file manager to copy it (or link it) to the desktop. That should create an icon for the file on your desktop in most Linux distros.

To allow the system to run your script you need to ensure that the script starts with a proper shebang line, eg

#!/usr/bin/env python

and that the file has execute permissions. Your file manager will have some menu command to modify file permissions. Or you can just do it in the shell with

chmod a+x application.py.

If you've created a link to your script on the desktop you'll need to modify the permissions of the original file, not the link, since links don't have permissions themselves.

Then you can single-click the icon to launch it.

Upvotes: 1

Related Questions