from Tkinter import *
from PIL import Image, ImageTk
import os
class App:
def __init__(self,master):
master.minsize(width=666, height=666)
master["bg"] = "black"
self.button = Button(text="Camera1",command=self.playvid)
self.button.pack(side= "top")
self.img = ImageTk.PhotoImage(Image.open("car.png"))
self.panel = Label(master, image=self.img)
self.panel.pack(side = "bottom", fill = "both", expand = "yes")
def playvid(self):
os.system("gst-launch-1.0 videotestsrc ! autovideosink")
root = Tk()
app = App(root)
root.mainloop()
root.destroy()
这是我的代码。如果我按 s 键,我想停止创建os.system
窗口的gstreamer
进程,即如果我按 s 那么它应该相当于 ctrl + c 。
也可以在tkinter中播放视频吗?