osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make sure the window title is visible in tkinter


On 2019-06-26, Cousin Stanley <cousinstanley at gmail.com> wrote:

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

>   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 ....

IIRC, there is a way to get tkInter to render a string in a particular
font so that you can then find out how wide the result is in pixels.
It's been a long time since I needed to do that, and it was a bit of a
hassle.  I'm not sure how you would make sure it's rendered in the
same font as the window title.

-- 
Grant Edwards               grant.b.edwards        Yow! I'm a fuschia bowling
                                  at               ball somewhere in Brittany
                              gmail.com