LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-30-2020, 10:37 PM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 18.04
Posts: 1,841

Rep: Reputation: 67
How to assign an icon to a window icon in the Ubuntu launcher?


I made a couple of tkinter windows in Python. They both work and do what I want.

I assigned 2 launchers to them with a file like this in /home/pedro/.local/share/applications

Quote:
[Desktop Entry]
Type=Application
Terminal=false
Name=My Tk Application
Exec=/home/pedro/myPython/tkinter/master2.py
Icon=/home/pedro/icons/icon1.png
StartupWMClass=myTkApp
and I locked the launchers to side panel in Ubuntu.

When I click one of my launchers, the window opens and I see a grey square with a question mark in it in the launcher panel. I suppose that is the default when no icon is assigned to the window.

Where can I assign a different icon to my window?

Do I need to do that in Python, or where??

Last edited by Pedroski; 07-30-2020 at 10:38 PM.
 
Old 07-31-2020, 07:37 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 14,976
Blog Entries: 9

Rep: Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240
I am unfamiliar with the Ubuntu launcher panel, but:
  • does /home/pedro/icons/icon1.png exist?
  • have you tried using an xdg icon name or have you tried moving icon1.png to /usr/share/pixmaps, or into the /usr/share/icons/hicolor/subfolder theme? In that case you could just call it with "Icon=icon1"
 
Old 07-31-2020, 03:45 PM   #3
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 18.04
Posts: 1,841

Original Poster
Rep: Reputation: 67
The launcher panel is a panel you can place left or right or bottom, I think. I set to "autohide", so it pops up when the mouse goes to the left side of the screen. My one contains a launcher for Firefox, Libre Office, other things.

My icons for my personalized launchers show up fine in the launcher panel.

But when I click the icon, the window opens and another icon appears in the launcher. That icon is the grey square with a question mark. It must be some kind of "default icon" for a window which has no icon assigned to it.

I found a solution in tkinter.

My master window is called master. I made a little icon with the text PyWin, it shows up nicely:

Quote:
master.iconphoto(True, tk.PhotoImage(file='/home/pedro/icons/winicon1.png'))
"True" passes the icon to other windows which open from the master window when I click a button. The master window already has its own icon.

Quote:
# the main window
master = tk.Tk(className='myTkApp')
master.iconphoto(True, tk.PhotoImage(file='/home/pedro/icons/winicon1.png'))
master.title("Master window to run other windows")
master.config(bg='light green')
master.geometry('1340x740')
master['padx'] = 10
master['pady'] = 10
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Long lag between clicking the Application Launcher icon and the launcher appearing in KDE alex14641 Slackware 2 03-28-2016 05:36 PM
[SOLVED] firefox launcher doesn't show icon on panel bar of slackware but launcher still there mshlinux Linux - Newbie 6 04-24-2013 10:56 PM
LXer: Move unity launcher to the bottom with Unity Bottom Launcher | PPA Ubuntu LXer Syndicated Linux News 0 12-19-2011 12:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration