本文整理汇总了Python中tkinter.ttk.Frame.grid_forget方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.grid_forget方法的具体用法?Python Frame.grid_forget怎么用?Python Frame.grid_forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Frame
的用法示例。
在下文中一共展示了Frame.grid_forget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GUI
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import grid_forget [as 别名]
#.........这里部分代码省略.........
self.resetBtn.grid(row=1, column=10, pady=10)
self.saveBtn = Button(self.canvas, text="Save", command=self._save)
self.saveBtn.grid(row=1, column=11, pady=10)
self.parametersFrame = Frame(self.canvas)
self._setParameters()
def _show(self,text):
""" Set text on info label """
self.info.set(text)
self.update()
def _setSliders(self):
""" Initialize all sliders used for set the gain for a defined frequency """
if len(self.sliders)>0: self.sliders = []
for widget in self.sliderFrame.winfo_children():
widget.destroy()
for i in range(self.MAX_F):
filter = self.filters[i]
gain = 0.0 if "gain" not in filter.keys() else filter["gain"]
slider = SliderFrequency(self.sliderFrame, str(int(float(filter["freq"]))),gain,0.0,20.0, filter["id"])
self.sliders.append(slider)
def _parseConfigFile(self):
""" Parse the configuration file and get values to set frequency sliders """
self.cp.parse()
self.filters = self.cp.filters()
def _run(self):
""" Save the current configuration into the config file """
self.isWritting = True
for i in range(self.MAX_F):
slider = self.sliders[i]
filter = self.filters[i]
param = self.parameters[i]
values = deepcopy(filter)
values["gain"] = str(slider.getGain())
values["freq"] = str(slider.getFrequency())
values["Q"] = param.getQ()
values["type"] = param.getType()
self.cw.write(values)
self.cw.close()
self._parseConfigFile()
self.isWritting = False
def _save(self):
""" Launch thread to save configuration """
if self.isWritting: return
Thread(target=self._run).start()
self._show("New configuration saved")
sleep(0.5)
self._show("")
def _resetGUI(self):
""" Cancel all modifications """
self._setSliders()
self._setParameters()
def _setParameters(self):
""" Initialize all parameters for frequency sliders, which are used in advanced mode """
if len(self.sliders)>0: self.parameters = []
for widget in self.parametersFrame.winfo_children():
widget.destroy()
for i in range(self.MAX_F):
filter = self.filters[i]
param = SliderParameter(self.parametersFrame,filter["type"], filter["Q"], int(filter["id"]))
self.parameters.append(param)
def _showParameters(self):
""" Turn advanced mode ON or OFF """
if self.isAdvancedMode:
self.parametersFrame.grid_forget()
self.isAdvancedMode = False
else:
self.parametersFrame.grid(row=2, column=0,columnspan=self.MAX_F, pady=10, padx=5)
self.isAdvancedMode = True
def _createConfigFile(self):
""" If not created, make a default config file """
frequency = [64,125,250,500,750,1000,1500,2000,3000,4000,6000,8000]
for i in range(self.MAX_F):
values = {"type":"Peaking","freq":str(frequency[i]),"gain":"0.0","Q":"0.717","id":str(i)}
self.cw.write(values)
self.cw.close()