Make sure the window title is visible in tkinter

Cousin Stanley cousinstanley at gmail.com
Wed Jun 26 10:03:50 EDT 2019


Cecil Westerhof wrote:

> I need to write a desktop program. I choose to use tkinter. 
> 
> How can I make sure the window title is visible? For example 
> when I have the following code :

>     from tkinter      import Button, filedialog, Label, messagebox, Tk
> 
> 
>     window = Tk()
>     window.title('A long window title')
>     Button (window, text = 'Short text').pack()
>     window.mainloop()
> 
> I see only a part of the 'A', but I would like to see 
> the complete :
>
>   'A long window title'
> 

  You might try setting a given window geometry
  to accomodate the long title .... 

  win_w = 400 
  win_h = 300

  ofs_h = 40
  ofs_v = 30

  window.geometry( "%dx%d+%d+%d" % ( win_w , win_h , ofs_h , ofs_v ) )

  
  Maybe add a bit of extra space for users 
  with different default font sizes ....

  Not a general solution 
  but perhaps workable ....


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona




More information about the Python-list mailing list