I'm not going to control the font.
Tk widgets that display text must use *some* font. If you do not select
one, then you get the system-dependent default.
for k, v in tk.Text().configure().items(): print(k, v)
....
font ('font', 'font', 'Font', <font object: 'TkFixedFont'>, 'TkFixedFont')
TkTextFont may be preferable for your purposes, although on Windows both
might be Courier New.
This is for a program that's
distributed to the general public, for use on a wide variety of
systems. But what I do in the current version is to use the ASCII
label strings by default, and have a command-line option to select
the "graphical" (non-ASCII Unicode) labels. What I want is to make
the graphical labels the default, and have the program detect, at
runtime, whether any of the glyphs used in the fancy labels would
render as "\uNNNN" in whatever the default font for the buttons is,
and automatically revert to the ASCII labels in that case.
I would not assume that the default covers more than ascii.
But to answer your question, this might work: fonts have a measure()
method that returns what the pixel length of a string would be if it
were to be displayed.
12
*If* the measure is, say, 50 or more for a character that would display
as \uNNNN, then you would know. Go ahead and experiment.
I'm assuming this is possible, because Tkinter itself seems to know
which glyphs are unavailable, or they'd probably be showing up as
those boxed number characters or question marks instead of "\uNNNN".
I do not know whether it is tk itself or a system graphics call that
translates a sequence of codes to pixels on the screen.