I've written a Python script using Tkinter to show one (single) window (the script works fine). Now, I've written a .desktop file to be able to start the script from the Ubuntu (16.04) dash:
[Desktop Entry]
Name=UNIX Time Converter
Exec=/home/tiuri/.local/share/applications/UnixTimeConverter.py
Type=Application
Terminal=False
Icon=/home/tiuri/.local/share/applications/unixtimeconverter.png
But this works only partly: I have an application in the dash with the correct icon and the correct name. On clicking it, two icons appear in the launcher: The application icon (as given in the .desktop) blinks for ten seconds and then disappears, while the second icon is connected to the Tkinter window and stays as long as the window is open. I would, however, like to have only one launcher icon with the image defined in the .desktop file and connected to the Tkinter window.
A minimal example for the Python script to reproduce the behaviour is:
#!/usr/bin/env python
from Tkinter import Tk, Label
def main():
master = Tk()
Label(master, text='Minimal example').pack()
master.mainloop()
if __name__ == '__main__':
main()
I guess that Ubuntu doesn't recognise the Tkinter window as an instance of the command just executed, but I don't really know whether this is a Python or an Ubuntu problem. Searching here and on Google didn't yield a solution, but maybe you have an idea? Thanks in advance!
shebandin first line of script#!/usr/bin/env pythonand setchmod +x script.pyand you can run script as normal program$ script.py- withoutpython. You can event remove extension`