本文整理汇总了Python中Tkinter.Radiobutton.config方法的典型用法代码示例。如果您正苦于以下问题:Python Radiobutton.config方法的具体用法?Python Radiobutton.config怎么用?Python Radiobutton.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Radiobutton
的用法示例。
在下文中一共展示了Radiobutton.config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: solver
# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import config [as 别名]
def solver(self):
solverheader = headersmall(self.frame, text="Solvers:")
direct = Radiobutton(self.frame, text="Direct", variable=self.params["solver"], value="direct",
bg=Styles.colours["grey"])
lbfgs = Radiobutton(self.frame, text="LBFGS", variable=self.params["solver"], value="lbfgs",
bg=Styles.colours["grey"])
message = Message(self.frame, text="Enable normalization if you use lbfgs", width=200)
try:
import nlopt
except:
self.params["solver"].set("lbfgs")
self.params["normalize"].set(1)
direct.config(state=DISABLED)
message.config(text="You do not have nlopt library installed to use the Direct Solver",
bg=Styles.colours["lightRed"])
normalize = Checkbutton(self.frame, text="Normalize Input", variable=self.params["normalize"],
bg=Styles.colours["grey"])
solverheader.grid(row=1, column=0, sticky=W, columnspan=2)
direct.grid(row=2, column=0, pady=0, sticky=W, padx=10)
lbfgs.grid(row=3, column=0, pady=0, sticky=W, padx=10)
message.grid(row=2, column=1, rowspan=1)
normalize.grid(row=3, column=1)
示例2: create
# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import config [as 别名]
#.........这里部分代码省略.........
ObjectiveToleranceFrame = Frame(UpperFrame, relief = 'ridge', bd=2)
ObjectiveToleranceFrame.pack(side='left')
Label(ObjectiveToleranceFrame, text='Objective function tolerance:').pack(side = 'left')
ObjTolEntry = Entry(ObjectiveToleranceFrame)
ObjTolEntry.pack(side='left')
self.ObjTolEntry = ObjTolEntry
UpperFrame.pack(side = 'top', expand=True, fill = 'x')
# Variables Frame
varsRoot = Frame(RootFrame)
# Lower frame
LowerFrame = Frame(varsRoot)
LowerFrame.pack(side = 'bottom', expand=True, fill = 'x')
from webbrowser import open_new_tab
About = Button(LowerFrame, text = 'About', command = lambda: open_new_tab('http://openopt.org/MultiFactorAnalysis'))
About.pack(side='left')
SaveButton = Button(LowerFrame, text = 'Save', command = self.save)
SaveButton.pack(side='left', padx = 15)
SaveAsButton = Button(LowerFrame, text = 'Save As ...', command = self.save)
SaveAsButton.pack(side='left')
Write_xls_Button = Button(LowerFrame, text = 'Write xls report', command = self.write_xls_report)
Write_xls_Button.pack(side='left', padx = 15)
# PlotButton = Button(LowerFrame, text = 'Plot', command = lambda: Plot(C, self.prob))
# PlotButton.pack(side='left')
ExperimentNumber = IntVar()
ExperimentNumber.set(1)
self.ExperimentNumber = ExperimentNumber
ObjVal = StringVar()
ObjEntry = Entry(LowerFrame, textvariable = ObjVal)
self.ObjEntry = ObjEntry
NN = StringVar(LowerFrame)
NN_Label = Label(LowerFrame, textvariable = NN)
names, lbs, ubs, tols, currValues = \
Frame(varsRoot), Frame(varsRoot), Frame(varsRoot), Frame(varsRoot), Frame(varsRoot)
Label(names, text=' Variable Name ').pack(side = 'top')
Label(lbs, text=' Lower Bound ').pack(side = 'top')
Label(ubs, text=' Upper Bound ').pack(side = 'top')
Label(tols, text=' Tolerance ').pack(side = 'top')
ValsColumnName = StringVar()
ValsColumnName.set(' Initial Point ')
Label(currValues, textvariable=ValsColumnName).pack(side = 'top')
self.ValsColumnName = ValsColumnName
# Commands Frame
CommandsRoot = Frame(RootFrame)
CommandsRoot.pack(side = 'right', expand = False, fill='y')
AddVar = Button(CommandsRoot, text = 'Add Variable', command = \
lambda: self.addVar(names, lbs, ubs, tols, currValues))
AddVar.pack(side = 'top', fill='x')
Next = Button(CommandsRoot, text = 'Next', command = lambda: ExperimentNumber.set(ExperimentNumber.get()+1))
#Next.pack(side='bottom', fill='x')
names.pack(side = 'left', ipady=5)
lbs.pack(side = 'left', ipady=5)
ubs.pack(side = 'left', ipady=5)
tols.pack(side = 'left', ipady=5)
currValues.pack(side = 'left', ipady=5)
#currValues.pack_forget()
varsRoot.pack()
Start = Button(CommandsRoot, text = 'Start', \
command = lambda: (Start.destroy(), \
Next.pack(side='bottom', fill='x'),
#C.pack(side = 'bottom', expand=True, fill='both'),
r1.config(state=DISABLED),
r2.config(state=DISABLED),
ObjTolEntry.config(state=DISABLED),
ObjEntry.pack(side='right', ipady=4),
NN_Label.pack(side='right'), \
self.startOptimization(root, varsRoot, AddVar, currValues, ValsColumnName, ObjEntry, ExperimentNumber, Next, NN,
goal.get(), float(ObjTolEntry.get()), C)))
Start.pack(side = 'bottom', fill='x')
self.Start = Start
if len(S) != 0:
for i in range(len(S['names'])):
tmp = S['values'][i] if self.x0 is None else self.x0.split(' ')[i]
self.addVar(names, lbs, ubs, tols, currValues, S['names'][i], S['lbs'][i], S['ubs'][i], S['tols'][i], tmp)
else:
self.addVar(names, lbs, ubs, tols, currValues)