本文整理汇总了Python中tkinter.ttk.Frame.winfo_children方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.winfo_children方法的具体用法?Python Frame.winfo_children怎么用?Python Frame.winfo_children使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Frame
的用法示例。
在下文中一共展示了Frame.winfo_children方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_status_bar
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import winfo_children [as 别名]
def create_status_bar(self, master):
statbar = Frame(master, padding = '3 3 3 3')
statbar.grid(column=0, row=2, sticky=(EW, S))
Label(statbar, text='RDFS File:', padding='0 3 0 3').grid(row=0, column=0, sticky=SE)
rdfsFileNameLbl = Label(statbar, textvariable=self.rdfsFileName,
background='#bbb', relief=SUNKEN, padding='3 3 3 3')
rdfsFileNameLbl.grid(column=1, row=0, sticky=(EW))
Label(statbar, text='Template file:', padding='0 3 0 3').grid(row=1, column=0, sticky=SE)
templateFileNameLbl = Label(statbar, textvariable=self.templateFileName,
background='#bbb', relief=SUNKEN, padding='3 3 3 3')
templateFileNameLbl.grid(column=1, row=1, sticky=(EW))
statbar.columnconfigure(1, weight=1)
for child in statbar.winfo_children():
child.grid_configure(padx=3, pady=3)
示例2: qbtConvertor
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import winfo_children [as 别名]
class qbtConvertor(Tk):
""" GUI Application for migration from uTorrent to qBittorrent """
def __init__(self):
Tk.__init__(self)
self.title("uT to qBt convertor")
#main frame
self.main_frame = Frame(self, padding="3 3 12 12")
self.main_frame.grid(column=0, row=0, sticky=(N, W, E, S))
self.main_frame.columnconfigure(0, weight=1)
self.main_frame.rowconfigure(0, weight=1)
#uT part
self.ut_data = StringVar()
self.ut_label = Label(self.main_frame, text="uT data")
self.ut_label.grid(column=0, row=1, sticky=(W))
self.ut_entry = Entry(self.main_frame, width=100, textvariable=self.ut_data)
self.ut_entry.grid(column=1, row=1, sticky=(W))
self.ut_button = Button(self.main_frame, text="Browse", command=self.load_file)
self.ut_button.grid(column=2, row=1)
#qBt part
self.qbt_folder = StringVar()
self.qbt_label = Label(self.main_frame, text="qBt folder")
self.qbt_label.grid(column=0, row=4, sticky=(W))
self.qbt_entry = Entry(self.main_frame, width=100, textvariable=self.qbt_folder)
self.qbt_entry.grid(column=1, row=4, sticky=(W))
self.qbt_button = Button(self.main_frame, text="Browse", command=self.open_dir)
self.qbt_button.grid(column=2, row=4, sticky=(W, E))
#convertor
self.convertor_button = Button(self.main_frame, text="Convert", command=self.convert,
width=50)
self.convertor_button.grid(column=1, columnspan=2, row=5)
self.progress_bar = Progressbar(self.main_frame, orient=HORIZONTAL, length=300, mode="indeterminate")
self.progress_bar.grid(column=1, columnspan=3, row=6)
#set padding for each element
for child in self.main_frame.winfo_children():
child.grid_configure(padx=5, pady=5)
def convert(self):
message = messagebox
if not self.qbt_folder.get() or not self.ut_data.get():
message.showerror("ERROR", "Specify paths!")
return
self.progress_bar.start()
convertor(self.ut_data.get(), self.qbt_folder.get())
self.progress_bar.stop()
def load_file(self):
file_name = filedialog.askopenfilename(filetypes=(("UT resume file", "*.dat"),
("All", "*")))
if file_name:
self.ut_data.set(file_name)
def open_dir(self):
dir_name = filedialog.askdirectory()
if dir_name:
self.qbt_folder.set(dir_name)
示例3: GUI
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import winfo_children [as 别名]
class GUI(Tk):
"""
The main module for the GUI
Show an interface to allow to configure differents filters
wich are used to filtering audio
parameter:
root: Frame
The main frame
"""
def __init__(self,root):
Tk.__init__(self,root)
self.root = root
self.MAX_F = 12
self.info = StringVar()
self.sliders = []
self.parameters = []
self.filters = []
self.isAdvancedMode = False
self.isWritting = False
self.configFile = "config.xml"
self.cw = ConfigWritter(self.configFile)
if not isfile(self.configFile): self._createConfigFile()
self.cp = ConfigParser(self.configFile)
self._parseConfigFile()
self.canvas = Canvas()
self.canvas.pack(expand=YES,fill=BOTH)
self.initialize()
def initialize(self):
""" Initialize all graphicals components of the GUI """
self.sliderFrame = Frame(self.canvas)
self.sliderFrame.grid(row=0, column=0,columnspan=self.MAX_F, pady=10, padx=5)
self._setSliders()
self.infoLabel = Label(self.canvas, text="", textvariable=self.info)
self.infoLabel.grid(row=1, column=2,columnspan=5)
self.advancedBtn = Button(self.canvas, text="Advanced", command = self._showParameters)
self.advancedBtn.grid(row=1, column=0, pady=10)
self.resetBtn = Button(self.canvas, text="Reset", command=self._resetGUI)
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]
#.........这里部分代码省略.........
示例4: PylinacGUI
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import winfo_children [as 别名]
class PylinacGUI(Frame):
def __init__(self, master=None):
super().__init__(master)
self.pack()
self.notebook = Notebook(self)
self.init_pf()
self.init_vmat()
self.init_catphan()
self.init_logs()
# self.init_tg51()
self.init_star()
self.init_planar_imaging()
self.init_winstonlutz()
self.init_watcher()
self.init_help()
for child in self.winfo_children():
child.grid_configure(padx=10, pady=10)
def init_help(self):
def upload():
webbrowser.open('https://www.dropbox.com/request/YKRu4AmuPsXu55uQq761')
def gotoforum():
webbrowser.open('https://groups.google.com/forum/#!forum/pylinac')
def gotogithub():
webbrowser.open('https://github.com/jrkerns/pylinac')
def gotortd():
webbrowser.open('https://pylinac.readthedocs.io/en/latest/')
self.help_tab = Frame(self.notebook)
Label(self.help_tab, text='Having trouble?\nWant to donate your images for program improvement?\nUpload them below')
Button(self.help_tab, text='Upload Files', command=upload)
Label(self.help_tab, text='Complete documentation is available on ReadTheDocs')
Button(self.help_tab, text='ReadTheDocs', command=gotortd)
Label(self.help_tab, text='Help is also available in the Pylinac forum')
Button(self.help_tab, text='Go to forum', command=gotoforum)
Label(self.help_tab, text='The source code of this program and all analyses is available on Github')
Button(self.help_tab, text='Github', command=gotogithub)
self.notebook.add(self.help_tab, text='Help/Upload Images')
for child in self.help_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_watcher(self):
def load_yaml():
f = filedialog.askopenfilename()
self.watch_yaml.set(f)
def load_dir():
f = filedialog.askdirectory()
self.watch_dir.set(f)
def process_dir():
watcher.process(directory=self.watch_dir.get(), config_file=self.watch_yaml.get(), force=self.watch_force.get())
def open_dir():
webbrowser.open(self.watch_dir.get())
self.watch_tab = Frame(self.notebook)
self.watch_yaml = StringVar(value=osp.join(osp.dirname(__file__), 'watcher_config.yml'))
self.watch_dir = StringVar()
self.watch_force = BooleanVar(value=False)
Button(self.watch_tab, text='Load YAML config file...', command=load_yaml).grid(column=1, row=1)
Label(self.watch_tab, textvariable=self.watch_yaml).grid(column=1, row=2)
Button(self.watch_tab, text='Select analysis directory...', command=load_dir).grid(column=1, row=3)
Label(self.watch_tab, textvariable=self.watch_dir).grid(column=1, row=4)
Checkbutton(self.watch_tab, text='Force analysis (even previously analysed files)?', variable=self.watch_force).grid(column=1, row=5)
Button(self.watch_tab, text='Process directory', command=process_dir).grid(column=1, row=6)
Button(self.watch_tab, text='Open analysis directory', command=open_dir).grid(column=1, row=7)
self.notebook.add(self.watch_tab, text='Batch Processor')
for child in self.watch_tab.winfo_children():
child.grid_configure(padx=10, pady=5)
def init_vmat(self):
def load_open():
f = filedialog.askopenfilename()
self.vmat_openimg.set(f)
def load_dmlc():
f = filedialog.askopenfilename()
self.vmat_dmlcimg.set(f)
def analyze_vmat():
images = (self.vmat_openimg.get(), self.vmat_dmlcimg.get())
if self.vmat_test.get() == 'DRGS':
v = vmat.DRGS(image_paths=images)
else:
v = vmat.DRMLC(image_paths=images)
v.analyze(tolerance=self.vmat_tol.get())
fname = osp.join(self.vmat_dmlcimg.get().replace('.dcm', '.pdf'))
fname = utilities.file_exists(fname)
v.publish_pdf(fname)
self.vmat_pdf.set(fname)
utilities.open_path(fname)
#.........这里部分代码省略.........