Python, Linux, Desktop Environment

J

jeremyvoros

So, I've written my first GUI app in python. I've turned it into a
binary .exe and .app that runs on Windows and Mac respectively, but on
my Linux box, where I wrote the thing, I still have to drop to the
command line and ./myscript.py. What can I do to make it a "click and
run" sort of application in KDE or Gnome on Linux?
 
B

bruno at modulix

So, I've written my first GUI app in python. I've turned it into a
binary .exe and .app that runs on Windows and Mac respectively, but on
my Linux box, where I wrote the thing, I still have to drop to the
command line and ./myscript.py. What can I do to make it a "click and
run" sort of application in KDE or Gnome on Linux?

There are *no* "click and run" on linux, since the GUI is an option,
not a part of the OS.

What you're looking for is WM/DesktopManager specific. You'll find the
answers in the Gnome and KDE manuals.
 
Y

Yves Glodt

I don't really understand what you mean... Have you tried simply
creating a "shortcut"
that points to your script.py?
That should make it run with a click...


HTH,
Yves
 
J

Jorgen Grahn

There are *no* "click and run" on linux, since the GUI is an option,
not a part of the OS.

What you're looking for is WM/DesktopManager specific. You'll find the
answers in the Gnome and KDE manuals.

Yeah, and please don't accidentally remove the option to type 'myscript.py'
on the command line -- that's how I almost always start GUI programs. If I
like them enough, I edit my window manager's config so that it appears in a
suitable place in the menus. Nine applications have made that list during
the past fifteen years ;-)

/Jorgen
 
L

Lee Harr

So, I've written my first GUI app in python. I've turned it into a
binary .exe and .app that runs on Windows and Mac respectively, but on
my Linux box, where I wrote the thing, I still have to drop to the
command line and ./myscript.py. What can I do to make it a "click and
run" sort of application in KDE or Gnome on Linux?


Have you heard of a "shebang line"?

That is when the first line of a file starts with #!

You probably want ...

#!/usr/bin/env python


That will run the commandline from that first line.
Remember, it must be the very first thing (no spaces).


You may also need to be in a particular directory in
order to access program resources. I usually end up
making a little .sh script like ...

#!/bin/sh

cd /my/python/prog/dir && python myprog.py



Most of the recent window managers are using the
so called .desktop files. You could copy one of
those from another program (try creating a "link
to application" or an "application launcher" on
your desktop).

I think most wms will also just run your shell
script if the permissions are set correctly.
 
J

jeremyvoros

Thanks everyone.

Making a shortcut was just too obvious for me...

I just made a KDE shortcut that runs the python command for me.
 
F

Florian Diesch

So, I've written my first GUI app in python. I've turned it into a
binary .exe and .app that runs on Windows and Mac respectively, but on
my Linux box, where I wrote the thing, I still have to drop to the
command line and ./myscript.py. What can I do to make it a "click and
run" sort of application in KDE or Gnome on Linux?

If you can start it from command line, you can start it from any menu
etc. As it's not Python related your favourite Linux newsgroup/mailing
list/user group/... should be a better place to ask.
Maybe <http://www.opendesktop.org> is helpfull too.



Florian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top