【发布时间】:2015-08-10 17:34:56
【问题描述】:
我正在尝试使用Courier New 的font 制作tkinter Menu 小部件。不幸的是,font attribute 似乎不起作用。我正在使用Python 3.4.1。下面是代码:
from tkinter import *
class Arshi(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.pack(fill=BOTH)
self.topbar()
def topbar(self):
self.menufont = ("Courier New", 9)
self.menu = Menu(self, font=self.menufont)
self.master.config(menu=self.menu)
root = Tk()
root.title("Arshi")
window = Arshi(root)
window.mainloop()
【问题讨论】:
-
您在哪个平台上运行?我认为您不能在某些平台(特别是 windows 和 osx)上更改菜单字体。
-
@BryanOakley 我在 Windows 8 上运行
标签: python python-3.x tkinter