Python Forum
[Tkinter] Help setting text/title in dock/panel in tkinter gui
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Help setting text/title in dock/panel in tkinter gui
Hello all, I have tried doing a bit of searching elsewhere and within this forum with various kselfey phrases/words for my issue and I am either not asking the right questions or I don't know so I have come here if you don't mind. I have only been learning tkinter just recently, but I know Python and PyQyt fairly well so I thought it was time to learn tkinter as well; always good to have choices.

In Ubuntu Linux in Gnome desktop I have simple test gui with a Frame and Button and I can set the window title just fine with a couple of ways with:
for example, but I can't figure out how to change the Gnome panel and docks text/title. I thought maybe I might have to set the Frame title it says it has no such attribute.

Any help/direction/comments is/are welcome.

Screenshot & code below:

[Image: tkinter-test-problem.png]

Here's my code:
#!/usr/bin/env python3
from sys import exit
from tkinter import (Button, Frame, Tk, PhotoImage)

class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        # self.winfo_toplevel().title('Tkinter Test')
        # selftest = Button(self, text="Text", command=lambda: prntw('Test'))
        selftest = Button(self, text="Text", command=lambda: self.winfo_toplevel().wm_state('iconic'))
        self.button_img = PhotoImage(data=self.button_img)
                        relief='flat', overrelief='flat')

def prntw(args):

def main():
    root = Tk()
    root.title('Tkinter Test')
    app = Application(master=root)

if __name__ == '__main__':
I think your asking about a window icon. To be honest it's usually the last thing on my mind when creating a gui. On linux you would use a bitmap x10 16 bits:
def main():
    root = Tk()
    root.title('Tkinter Test')
    app = Application(master=root)
on a window platform it's .ico
do a search for tkinter and window icon I believe the tk you see is the default icon.
Ok, so since there's no associated image file it shows the "TK" text in place of where the icon would be? It is a bit easier in PyQt it seems, but I'm sure they both have their pros and cons. I'll try adding an icon & see if what happens. Thanks for the feedback; I'll test it out & get back with my results and close this post out...

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter text widget word wrap position chrisdb 6 845 Mar-18-2021, 03:55 PM
Last Post: chrisdb
  [Tkinter] tkinter.Menu – How to make text-variable? Sir 3 808 Mar-10-2021, 04:21 PM
Last Post: Sir
Photo Tkinter TEXT background image _ShevaKadu 5 1,640 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  tkinter | Button color text on Click Maryan 2 517 Oct-09-2020, 08:56 PM
Last Post: Maryan
  [Tkinter] Text Upload LearningLittlebyLittle 0 416 Sep-04-2020, 07:55 PM
Last Post: LearningLittlebyLittle
  [Tkinter] Indentation for Tkinter-made Text Editor ShakeyPakey 4 1,133 Jun-08-2020, 03:13 PM
Last Post: menator01
  How to make button text bold in Tkinter? scratchmyhead 2 1,445 May-16-2020, 02:53 AM
Last Post: scratchmyhead
  [Tkinter] changing title text to bold in tkinter Kumarkv 2 2,379 May-09-2020, 10:41 PM
Last Post: Larz60+
  Tkinter - Need Help setting Height of a TextInputBox itslewis 1 454 Mar-22-2020, 02:37 AM
Last Post: deanhystad
  [Tkinter] Tkinter Winget python text Marc 5 794 Mar-13-2020, 11:17 PM
Last Post: Marc

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020