在Tkinter中真正的自定义字体 [英] Truly custom font in Tkinter
问题描述
tkFont模块看起来应该像这样做,但是我看不到在哪里需要一个文件名,这个文件对于运行程序的系统来说通常是不可访问的。
提前感谢您的帮助。 解决方案
我找到这个讨论,他们讨论了如何使用一行文本作为图像并使用PIL来放置它进入窗口。这可能是一个解决方案。
我找不到使用tkFont在 tkFont手册页。
I am making an interface in Tkinter and I need to have custom fonts. Not just, say, Helvetica at a certain size or whatever, but fonts other than what would normally be available on any given platform. This would be something that would be kept with the program as an image file or (preferably) Truetype font file or similar. I don't want to have to install the desired fonts on every machine that is going to use the program, I just want to carry them around with the program in the same directory.
The tkFont module looks like it ought to do something like this, but I can't see where it would take a filename for a font not normally accessible to the system running the program. Thanks in advance for your help.
I found this discussion where they cover how to use a line of text as an image and use PIL to place it into the window. That might be a solution.
I could not find a way to use tkFont to import a bundled font in the tkFont man page.
这篇关于在Tkinter中真正的自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!