tkinter's size is difference between xp and win7

94 views Asked by At

My GUI programing in winXP by tkinter, but i found it appears different size. I learn it because the system defult font is different. When using "control /name Microsoft.Personalization /page pageColorization" in CMD can open this page. But how i can set the project and font in python code?

1

There are 1 answers

2
patthoyts On BEST ANSWER

Since version 8.5 Tk defines some global named fonts that are initialized on Windows by reading the system theme defined fonts. So TkDefaultFont is the named font used by most Tk controls if not overridden. This means you change change TkDefaultFont and most of you controls will use the new font definition.

Otherwise, each control has a -font configuration option to pass in a font to use. And there is the option database for assigning options by widget class.

In tkinter the Tk font handling is provided by the tkinter.font package and using this the built-in named font objects can be accessed and modified.

import tkinter.font
# show the defined fonts
print(tkinter.font.names())
# access the default UI font
f = tkinter.font.nametofont('TkDefaultFont')
print(f.configure())
# modify the default font
f.configure(family='Tahoma')
print(f.configure())