本文整理汇总了Python中tkinter.Menu.config方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.config方法的具体用法?Python Menu.config怎么用?Python Menu.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Menu
的用法示例。
在下文中一共展示了Menu.config方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from tkinter import Menu [as 别名]
# 或者: from tkinter.Menu import config [as 别名]
def initUI(self):
self.parent.title("Gas Model")
self.fonts = {'fontname' : 'Helvetica',
'color' : 'r',
'fontweight' : 'bold',
'fontsize' : 14}
self.npts = 32;
self.sounds = 377.9683;
self.skip = 4000.
# self.dt = 5000.*self.skip/(self.npts * self.sounds)
menubar = Menu(self.parent)
menubar.config(font=("Helvetica", 14, "italic"))
self.parent.config(menu=menubar)
fileMenu = Menu(menubar, tearoff=0)
fileMenu.config(font=("Helvetica", 14, "italic"))
fileMenu.add_command(label="Load", command=self.onLoad)
fileMenu.add_command(label="Close", command=self.onClose)
fileMenu.add_command(label="Exit", command=self.quit)
menubar.add_cascade(label="File", menu=fileMenu)
fileMenu2 = Menu(menubar, tearoff=0)
fileMenu2.config(font=("Helvetica", 14, "italic"))
fileMenu2.add_command(label="Set Parameters", command=self.quit)
menubar.add_cascade(label="Parameters", menu=fileMenu2)
lbl1=Label(self.parent,text="Gas Network",fg = "black",font=("Helvetica", 14, "bold"))
lbl1.grid(sticky="N",pady=4,padx=5,row=0,column=0,columnspan=2)
self.f = plt.figure(figsize=(5,4), dpi=80)
self.cmap = plt.cm.jet #ok
self.a = self.f.add_subplot(111)
self.a.axis([-1, 1, -1, 1])
self.a.axis('off')
self.canvas = FigureCanvasTkAgg(self.f, master=self.parent)
self.G = nx.Graph()
nx.draw_networkx(self.G, pos=nx.spring_layout(self.G), ax=self.a)
self.canvas.show()
self.canvas.get_tk_widget().config(width=800-20, height=600-100)
self.canvas.get_tk_widget().grid(sticky="NW", pady=4, padx=5, row=1, column=0, columnspan=6, rowspan=6)
self.txt = Text(self.parent, width=54, height=33);
self.txt.grid(sticky="NW", pady=4, padx=5, row=1, column=8, columnspan=4, rowspan=6)
self.log = Text(self.parent, width=112, height=6);
self.log.grid(sticky="NW", pady=4, padx=5, row=7, column=0, columnspan=6,rowspan=2)
RunButton = Button(self.parent, text="Run", width=10, command=self.onRun).grid(sticky='SW', pady=4, padx=5, row=7, column=8)
DrawButton = Button(self.parent, text="Draw", width=10, command=self.onDraw).grid(sticky='SW', pady=4, padx=5, row=7, column=9)
StopButton = Button(self.parent, text="Stop", width=10, command=self.onStop).grid(sticky='SW', pady=4, padx=5, row=8, column=9)
QuitButton = Button(self.parent, text="Quit", width=10, command=self.quit ).grid(sticky='SW', pady=4, padx=5, row=7, column=10)
self.Loaded = False
self.Animate = False