本文整理汇总了Python中ttk.Frame.after方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.after方法的具体用法?Python Frame.after怎么用?Python Frame.after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Frame
的用法示例。
在下文中一共展示了Frame.after方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mainframe
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import after [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)
#.........这里部分代码省略.........