def generatevideo(self):
"""生成视频"""
self.videowindow = tk.Toplevel(self.mainwindow)
self.videowindow.transient(self.mainwindow)
self.videowindow.title("生成视频")
self.videowindow.geometry("300x300+400+200")
self.viewbtn.config(state='disabled')
self.videowindow.bind("<Destroy>", self.videoclose)
# 时间选择
tk.Button(
self.videowindow,
width=15,
text='开始时间',
command=lambda: self.getdate2('start')
).place(x=20, y=10)
tk.Button(
self.videowindow,
width=15,
text='结束时间',
command=lambda: self.getdate2('end')
).place(x=20, y=50)
self.start_str = tk.StringVar()
ttk.Entry(
self.videowindow,
textvariable=self.start_str,
state='readonly'
).place(x=140, y=13)
self.end_str = tk.StringVar()
ttk.Entry(
self.videowindow,
textvariable=self.end_str,
state='readonly'
).place(x=140, y=53)
# 间隔时间
tk.Label(self.videowindow, width=15, text='间隔时间').place(x=20, y=90)
values_h = [f"{i:02d}" for i in range(25)]
values_m = [f"{i:02d}" for i in range(60)]
self.deltahours = ttk.Combobox(
master=self.videowindow,
height=15,
width=3,
state="normal",
font=("", 11),
values=values_h
)
self.deltahours.place(x=140, y=90)
self.deltahours.current(1)
ttk.Label(self.videowindow, text="时").place(x=190, y=90, width=20, height=20)
self.deltaminutes = ttk.Combobox(
master=self.videowindow,
height=15,
width=3,
state="normal",
font=("", 11),
values=values_m
)
self.deltaminutes.place(x=220, y=90)
self.deltaminutes.current(0)
ttk.Label(self.videowindow, text="分").place(x=270, y=90, width=20, height=20)
# 帧率设置
tk.Label(self.videowindow, width=15, text='帧率设置').place(x=20, y=125)
values_rate = [0.5, 1, 2, 5, 10, 20, 50, 100]
self.deltarate = ttk.Combobox(
master=self.videowindow,
height=15,
width=3,
state="normal",
font=("", 11),
values=values_rate
)
self.deltarate.place(x=160, y=125)
self.deltarate.current(1)
ttk.Label(self.videowindow, text="张/每秒").place(x=220, y=125, width=60, height=20)
# 拍摄类型选择
tk.Label(self.videowindow, width=15, text='拍摄类型选择').place(x=20, y=160)
self.transvideo_types = ttk.Combobox(
self.videowindow,
values=list(self.value_maps_figtype.keys()),
width=12,
state='readonly',
justify="center"
)
self.transvideo_types.set('')
self.transvideo_types.place(x=160, y=160)
self.transvideo_types.bind("<<ComboboxSelected>>", self.on_option_selected_figtype_video)
# 位点选择
tk.Label(self.videowindow, width=15, text='点位选择').place(x=20, y=195)
self.transvideo_points = ttk.Combobox(
self.videowindow,
state='readonly',
justify="center",
width=12
)
self.transvideo_points.place(x=160, y=195)
self.transvideo_points.bind("<<ComboboxSelected>>", self.on_option_selected_point_video)
# 操作按钮
tk.Button(
self.videowindow,
width=15,
text='开始生成',
height=3,
font=("", 11),
command=self.generate
).place(x=20, y=225)
tk.Button(
self.videowindow,
width=15,
text='查看视频',
height=3,
font=("", 11),
command=self.videothreading
).place(x=160, y=225)
详细注释上述代码
最新发布