“显示"在tkinter.font.Font.measure中 [英] "displayof" in tkinter.font.Font.measure
本文介绍了“显示"在tkinter.font.Font.measure中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下measure
方法在模块/usr/lib/python3.5/tkinter/font
或import tkinter.font
的class Font
中定义:
The following measure
method is defined in class Font
of module /usr/lib/python3.5/tkinter/font
or import tkinter.font
:
def measure(self, text, displayof=None):
"Return text width"
args = (text,)
if displayof:
args = ('-displayof', displayof, text)
return self._tk.getint(self._call("font", "measure", self.name, *args))
问题:
- 什么是
displayof
? - 何时以及如何使用
displayof
?
- What is
displayof
? - When and how do I use
displayof
?
推荐答案
它将小部件作为参数.虽然很少见,但有可能在具有不同像素密度的多台显示器上显示多个窗口.如果您有这样的设置,则可以决定使用哪个窗口小部件/显示器作为确定字符串大小的基础.
It takes a widget as an argument. While rare, it’s possible to have multiple windows displaying on multiple displays with different pixel densities. If you have such a setup, this lets you decide which widget/display to use as the basis for determining the size of the string.
此参数的默认值为根窗口.
The default for this parameter is the root window.
这篇关于“显示"在tkinter.font.Font.measure中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文