本文整理汇总了Python中ttk.Frame.winfo_children方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.winfo_children方法的具体用法?Python Frame.winfo_children怎么用?Python Frame.winfo_children使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Frame
的用法示例。
在下文中一共展示了Frame.winfo_children方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: playar
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_children [as 别名]
class playar(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.filenm=None
self.pack(fill=BOTH, expand=1)
self.parent = parent
self.initplayer()
def initplayer(self):
self.videoFrame = Frame(self, width=800, height=480)
self.videoFrame.pack(side="top", fill="both", expand=True)
self.buttonframe = Frame(self, padding="2 2 11 11")
self.buttonframe.pack(side="bottom", fill="x", expand=True)
self.selectbutton = Button(self.buttonframe, text="Select")
self.selectbutton.grid(column=0, row=0, sticky=W)
self.playbutton = Button(self.buttonframe, text="Play").grid(column=1, row=0, sticky=W)
for child in self.buttonframe.winfo_children(): child.grid_configure(padx=5, pady=5)
self.buttonframe.rowconfigure(0, weight=1)
self.buttonframe.columnconfigure(0, weight=1)
self.buttonframe.columnconfigure(1, weight=1)
def setwh(self,w,h):
self.videoFrame.configure(width=w, height=h)
def quit(self):
print "QUIT CALLED"
pg.quit()
self.destroy()
示例2: __init__
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_children [as 别名]
def __init__(self, master):
self.master = master
master.title("Convert SPC files")
mf = Frame(master, padding="10")
mf.grid(column=0, row=0, sticky=(N, W, E, S))
mf.columnconfigure(0, weight=1)
mf.rowconfigure(0, weight=1)
self.message = "Enter folder containing *.SPC files"
self.label_text = StringVar()
self.folder = StringVar()
self.output_fmt = StringVar()
self.label_text.set(self.message)
self.label = Label(mf, textvariable=self.label_text)
self.folder_label = Label(mf, text="Folder")
self.output_fmt_label = Label(mf, text="Output Format")
self.fmt_txt = Radiobutton(mf, text="TXT", variable=self.output_fmt, value='txt')
self.fmt_csv = Radiobutton(mf, text="CSV", variable=self.output_fmt, value='csv')
self.folder_entry = Entry(mf, textvariable=self.folder)
self.sel_foler = Button(mf, text="Browse", command=self.ask_dir)
self.convert_btn = Button(mf, text="Convert", command=self.convert)
# map on grid
self.label.grid(row=0, column=0, columnspan=4, sticky=W + E)
self.folder_label.grid(row=1, column=0, sticky=E)
self.output_fmt_label.grid(row=2, column=0, sticky=E)
self.folder_entry.grid(row=1, column=1, columnspan=2, sticky=W + E)
self.fmt_txt.grid(row=2, column=1, sticky=W)
self.fmt_csv.grid(row=2, column=2, sticky=W)
self.sel_foler.grid(row=1, column=3, sticky=W)
self.convert_btn.grid(row=3, column=1, columnspan=2, sticky=W + E)
for child in mf.winfo_children():
child.grid_configure(padx=5, pady=5)
示例3:
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_children [as 别名]
file_text = fp.read()
input_txt_updated.insert('0.0', file_text)
fp.close()
used_background = "green"
unrelevant_background = "grey"
# here we configure the highlighting
input_txt.tag_configure("relatioship_highlight",background=relationship_background)
input_txt.tag_configure("relevant_term_highlight",background=relevant_term_background)
input_txt.tag_configure("used_highlight",background=used_background)
input_txt.tag_configure("unrelevant_highlight",background=unrelevant_background)
input_txt_updated.tag_configure("relatioship_highlight",background=relationship_background)
input_txt_updated.tag_configure("relevant_term_highlight",background=relevant_term_background)
input_txt_updated.tag_configure("used_highlight",background=used_background)
input_txt_updated.tag_configure("unrelevant_highlight",background=unrelevant_background)
######################################################################
for child in inputdoc_frm.winfo_children(): child.grid_configure(padx=5, pady=5)
for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=5)
for child in supermainframe.winfo_children(): child.grid_configure(padx=5, pady=5)
#here we hide the form
inputdoc_frm_relationship.grid_forget()
root.mainloop()
示例4: IntVar
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_children [as 别名]
botp = IntVar()
kpseqs = BooleanVar()
kprval = BooleanVar()
kpgdata = BooleanVar()
#CHILD FRAMES------------------------------
rootframe = Frame(root, padding="10 10 10 10")
mainframe = Frame(rootframe)
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
mainframe.columnconfigure(0, weight=1)
mainframe.rowconfigure(0, weight=1)
for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=5)
fileframe = Frame(mainframe)
fileframe.grid(column=1, row=1, sticky=(W, E, N), columnspan=4)
paramsframe = LabelFrame(mainframe, text="Parameters")
paramsframe.grid(column=1, row=3, sticky=(W, N, E))
graphframe = LabelFrame(mainframe, text="Graph options")
graphframe.grid(column=2, row=3, sticky=(W, N, E))
optionsframe = LabelFrame(mainframe, text="Output Options")
optionsframe.grid(column=3, row=3, sticky=(W, N, E))
dialogframe = Frame(rootframe)
statusframe = Frame(rootframe)
示例5: mainframe
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_children [as 别名]
class mainframe(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.filenm=None
self.streamnm = None
self.pack(fill=BOTH, expand=1)
self.parent = parent
self.initplayer()
self.player_process = None
self.seekthread = None
self.fstate = False
self.paused = True
self.trackmouse = True
self.stdout_thread = None
self.stream = False
self.inhibit_slider_trigger = False
self.q = LifoQueue()
self.currtime = 0
self.endtime = -1
def initplayer(self):
self.parentframe = Frame(self)
self.parentframe.pack(fill=BOTH, expand=True)
self.videoFrame = Frame(self.parentframe, width=800, height=480)
self.videoFrame.pack(side="top", fill="both", expand=True)
self.buttonframe = Frame(self.parentframe, padding="2 2 1 1")
self.buttonframe.pack(side="bottom", fill="x", expand=False)
self.seekbar = Scale(self.buttonframe, from_= 0, to=100, orient=HORIZONTAL)
self.seekbar.grid(column=0, columnspan=4, row=0, sticky=[N, E, S, W])
self.seekbar.configure(command=self.seeked)
self.selectbutton = Button(self.buttonframe, text="Select File")
self.selectbutton.grid(column=0, row=1, sticky=[E,W])
self.streambutton = Button(self.buttonframe, text="Open HTTP", command=self.streamopen)
self.streambutton.grid(column=1, row=1, sticky=[E,W])
self.playbutton = Button(self.buttonframe, text="Play")
self.playbutton.config(command=self.playpause)
self.playbutton.grid(column=2, row=1, sticky=[E,W])
self.fullscreenbutton = Button(self.buttonframe, text="Fullscreen", command=self.togglefullscreen)
self.fullscreenbutton.grid(column=3, row=1, sticky=[E,W])
for child in self.buttonframe.winfo_children(): child.grid_configure(padx=5, pady=5)
self.buttonframe.rowconfigure(0, weight=1)
self.buttonframe.rowconfigure(1, weight=1)
self.buttonframe.columnconfigure(0, weight=1)
self.buttonframe.columnconfigure(1, weight=1)
self.buttonframe.columnconfigure(2, weight=1)
self.buttonframe.columnconfigure(3, weight=1)
self.selectbutton.configure(command=self.fileopen)
self.videoFrame.bind("<Button-1>",self.playpause)
self.parent.bind("<F11>", self.togglefullscreen)
self.parent.bind("<Motion>",self.mouseops)
def mouseops(self,event=None):
self.videoFrame.config(cursor="")
self.videoFrame.after(5000,self.cursorhandler)
if self.trackmouse:
x, y = self.parent.winfo_pointerx(), self.parent.winfo_pointery()
windowx, windowy = self.parent.winfo_width(), self.parent.winfo_height()
if windowy - 30 <= y:
if self.fstate:
self.buttonframe.pack(side="bottom", fill="x", expand=False)
self.trackmouse = False
self.parent.after(5000, self.mousetracker)
self.inhibit_slider_trigger = False
elif self.fstate:
self.buttonframe.pack_forget()
self.inhibit_slider_trigger = True
else:
self.inhibit_slider_trigger = True
def mousetracker(self):
print 'Mouse Tracker'
self.trackmouse = True
self.videoFrame.after(0,self.mouseops)
def cursorhandler(self):
self.videoFrame.config(cursor="none")
def togglefullscreen(self, event=None):
self.fstate = not self.fstate
self.parent.attributes("-fullscreen",self.fstate)
if self.fstate:
self.fullscreenbutton.config(text="Exit Fullscreen")
self.buttonframe.pack_forget()
self.videoFrame.config(cursor="none")
else:
self.fullscreenbutton.config(text="Fullscreen")
self.buttonframe.pack(side="bottom", fill="x", expand=False)
self.videoFrame.after(5000, self.cursorhandler)
def fileopen(self):
self.filenm = askopenfilename(filetypes=[("Supported Files","*.mp4;*.mkv;*.mpg;*.avi;*.mov"),("All Files","*.*")])
self.stream = False
self.play()
def streamopen(self):
self.streamnm = Dlog(self.parent)
#.........这里部分代码省略.........
示例6: GUI
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_children [as 别名]
#.........这里部分代码省略.........
f.close
except OSError:
print "Daha"
self.cells = []
grid = strGrid.splitlines()
self.n = len(grid)
print self.n
grid = [[0 for x in range(self.n)] for x in range(self.n)]
row = 0
col = 0
for i, v in enumerate(strGrid.splitlines()):
for j, w in enumerate(v.split()):
if w != " " and w != "\n" and w != "." :
print w
if col == self.n:
row += 1
col = 0
if row == self.n:
break
grid[row][col] = int(w)
col+=1
self.puzzle = grid
print self.puzzle
for i in range((self.n)):
self.cells.append([])
for j in range((self.n)):
self.cells[i].append(StringVar())
for child in self.sudokuGrid.winfo_children():
child.destroy()
for i in range((self.n)):
for j in range((self.n)):
self.cells[i][j].set(self.puzzle[i][j])
for i in range((self.n)):
for j in range(self.n):
Entry(self.sudokuGrid, width=3, justify=RIGHT,
textvariable=self.cells[i][j]).grid(
row=i+1, column=j+1)
tkMessageBox.showinfo( "Generated!", ("Valid Sudoku Puzzle Imported"))
print grid
def solvePuzzle(self):
if self.n == 0:
print "No grid. Generate a grid, or import one."
elif self.n == 6 or self.n == 8 or self.n == 10 or self.n == 12:
statement = TRUE
for i in self.puzzle:
if i != 0:
statement == FALSE
break
if statement == TRUE:
startTime = datetime.now()
sudokuGen.evenRecSolve(self.puzzle)
print self.puzzle
for i in range(int(self.n)):