本文整理汇总了Python中ttk.Frame.winfo_id方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.winfo_id方法的具体用法?Python Frame.winfo_id怎么用?Python Frame.winfo_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Frame
的用法示例。
在下文中一共展示了Frame.winfo_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startVid
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_id [as 别名]
def startVid(self):
gobject.threads_init()
video = Frame(self, background='black')
video.grid(row=0, column=0, columnspan=8, rowspan=4, padx=2, sticky=E+W+S+N)
window_id = video.winfo_id()
self.buf = gst.Buffer()
self.bin = gst.Bin("my-bin")
timeoverlay = gst.element_factory_make("timeoverlay", "overlay")
self.bin.add(timeoverlay)
pad = timeoverlay.get_pad("video_sink")
ghostpad = gst.GhostPad("sink", pad)
self.bin.add_pad(ghostpad)
videosink = gst.element_factory_make("ximagesink")
self.bin.add(videosink)
gst.element_link_many(timeoverlay, videosink)
self.player.set_property('video-sink', self.bin)
self.player.set_property('uri', 'file://%s' % (os.path.abspath(self.project.videoPath)))
bus = self.player.get_bus()
bus.add_signal_watch()
bus.enable_sync_message_emission()
bus.connect("message", self.on_message, window_id)
bus.connect('sync-message::element', self.on_sync_message, window_id)
self.play.configure(command=lambda: self.play_video())
self.back.configure(command=self.play_back)
示例2: initUI
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_id [as 别名]
def initUI(self):
self.parent.title("Simple FTP-Client")
self.pack(fill=BOTH, expand=True)
# self.parent.title("Buttons")
#frame2 = Frame(self)
#frame2.pack(anchor=W,side=LEFT)
#lbl2 = Label(frame2, text="Command Line", width=6)
#lbl2.pack(fill=X,anchor=W,expand=True,padx=5, pady=5)
#txt2 = Text(frame2)
#txt2.pack(fill=X,side=BOTTOM,pady=5, padx=5)
frame3 = Frame(self, width=400, height=500)
frame3.pack(side=BOTTOM,anchor=NW)
lbl3 = Label(frame3, text="Command Line", width=6)
lbl3.pack(fill=X,anchor=NE,expand=True,padx=5, pady=5)
txt = Text(frame3)
txt.pack(fill=BOTH,pady=5, padx=5)
wid = frame3.winfo_id()
os.system('xterm -into %d -geometry 400x400 -sb &' % wid)
f1 = Frame(self)
f1.pack(fill=X,side=LEFT, anchor=NW, padx=5, pady=10)
lb=Label(f1, text="Host:").grid(row=0, column=0)
e1 = Entry(f1)
e1.grid(row=0, column=1, padx=1)
f2 = Frame(self)
f2.pack(fill=X,side=LEFT, anchor=NW, padx=5, pady=10)
lb2=Label(f2, text="Username:").grid(row=0, column=2)
e2 = Entry(f2)
e2.grid(sticky=N,row=0, column=3, padx=5)
f3 = Frame(self)
f3.pack(fill=X,side=LEFT, anchor=NW, padx=5, pady=10)
lb=Label(f3, text="Password:").grid(row=0, column=0)
e3 = Entry(f3)
e3.grid(row=0, column=1, padx=5)
f4 = Frame(self)
f4.pack(fill=X,side=LEFT, anchor=NW, padx=5, pady=10)
lb4=Label(f4, text="Port:").grid(row=0, column=2)
e4 = Entry(f4)
e4.grid(row=0, column=3, padx=5)
connectButton = Button(self, text="Connect", command=callback)
connectButton.pack(expand=True,fill=X,side=LEFT, anchor=NW, padx=10, pady=10)
示例3: mainframe
# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import winfo_id [as 别名]
#.........这里部分代码省略.........
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)
if self.streamnm.result is not None:
s = str(self.streamnm)
else:
return
if s.startswith('http'):
self.stream = True
self.play()
else:
self.stream = False
showerror("Error","Incorrect Entry")
def play(self):
global fifofilename
if self.filenm is not None and self.filenm != "":
winid = self.videoFrame.winfo_id()
if self.mplayer_isrunning():
self.stop()
try:
self.paused = False
self.playbutton.configure(text="Pause")
if not self.stream:
self.player_process = Popen(["mplayer","-fs","-slave","-quiet","-wid",str(winid),self.filenm],stdin=PIPE, stdout=PIPE)
else:
self.player_process = Popen(["mplayer","-fs","-slave","-quiet","-wid",str(winid),self.streamnm], stdin=PIPE, stdout=PIPE)
self.stdout_thread = Thread(target=self.enqueue_pipe, args=(self.player_process.stdout, self.q))
self.stdout_thread.daemon = True
self.stdout_thread.start()
self.emptypipe()
self.seekthread = Thread(target=self.seekbar_setup, args=())
self.seekthread.daemon = True
self.seekthread.start()
except:
showerror("Error","".join(["Couldn't play video:\n",str(sys.exc_info()[:])]))
def getvidtime(self):
if self.mplayer_isrunning():
self.command_player("get_time_length")
output = self.readpipe()
while "ANS_LENGTH" not in output:
output = self.readpipe()
if "ANS_LENGTH" in output:
return output.split('ANS_LENGTH=')[1]
else:
return 0
def playpause(self, event=None):
if self.player_process is None: