# 文档 C:/Users/Administrator/AppData/Local/Programs/Python/Python311/Doc/html/library/tk.html
# TIP: 如果不想要cmd, 扩展名py改为pyw
from tkinter import *
from tkinter.ttk import *
# 窗口
tk = Tk()
tk.title("联安通达audio/default.ini配置工具V0.0.1")
tk.geometry("1024x600")
tk.resizable(width=0, height=0)
def CreateSpinbox(master, from_, to, value, x, y, width, height):
spin = Spinbox(master, from_=from_, to=to, state="readonly")
spin.place(x=x, y=y, width=width, height=height)
spin.set(value)
return spin
# 基本配置
def tab_basic():
f = Frame(tk, padding=10)
f.pack(side=TOP, fill=BOTH, expand=1)
# Label(f, text="Hello World!").grid(column=0, row=0)
# Button(f, text="Quit", command=tk.destroy).grid(column=1, row=0)
Label(f, text="驱动").place(x=0, y=0, width=150, height=24)
combo = Combobox(f, values=('ak7604','rpaf','pnd'), state="readonly"); combo.place(x=150, y=0, width=100, height=24)
combo.set("ak7604")
Label(f, text="提示: 驱动和硬件相关, ak7604是外挂DSP, rpaf和pnd是T113的内置DSP", foreground="red").place(x=260, y=0, width=400, height=24)
Label(f, text="默认音源").place(x=0, y=30, width=150, height=24)
values = ("空源", "本地音乐","本地视频","蓝牙音乐","CarPlay","AndroidAuto","Aux","收音机")
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=30, width=100, height=24); combo.set("空源")
Label(f, text="音量最大值").place(x=0, y=60, width=150, height=24)
CreateSpinbox(f, from_=15, to=41, value=31, x=150, y=60, width=100, height=24)
Label(f, text="EQ段数").place(x=0, y=90, width=150, height=24)
CreateSpinbox(f, from_=3, to=36, value=36, x=150, y=90, width=100, height=24)
Label(f, text="提示: 某些驱动支持限定EQ段数小于所支持的最大段数", foreground="red").place(x=260, y=90, width=400, height=24)
Label(f, text="EQ增益最大值").place(x=0, y=120, width=150, height=24)
CreateSpinbox(f, from_=5, to=15, value=7, x=150, y=120, width=100, height=24)
Label(f, text="声场坐标最大值").place(x=0, y=150, width=150, height=24)
CreateSpinbox(f, from_=16, to=36, value=16, x=150, y=150, width=100, height=24)
Label(f, text="提示: 声场看作一个左上角是原点的坐标平面,右下角为坐标最大值", foreground="red").place(x=260, y=150, width=400, height=24)
Label(f, text="声场X坐标默认值").place(x=0, y=180, width=150, height=24)
CreateSpinbox(f, from_=0, to=18, value=8, x=150, y=180, width=100, height=24)
Label(f, text="声场Y坐标默认值").place(x=0, y=210, width=150, height=24)
CreateSpinbox(f, from_=0, to=18, value=8, x=150, y=210, width=100, height=24)
Label(f, text="导航时其他应用混音比例").place(x=0, y=240, width=150, height=24)
CreateSpinbox(f, from_=0, to=100, value=70, x=150, y=240, width=100, height=24)
Label(f, text="倒车时其他应用混音比例").place(x=0, y=270, width=150, height=24)
CreateSpinbox(f, from_=0, to=100, value=0, x=150, y=270, width=100, height=24)
return f
# 音源的分组
def tab_source_group_source(master):
f = LabelFrame(master, text="音源的分组", padding=5)
values = ("本地音乐","本地视频","蓝牙音乐","CarPlay","AndroidAuto","Aux","收音机","语音助手","响铃时语音助手","蓝牙电话铃声","蓝牙电话","CarPlay电话","导航")
Label(f, text="本地音乐").place(x=0, y=0, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=0, width=130, height=24); combo.set("本地音乐")
Label(f, text="本地视频").place(x=0, y=0, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=0, width=130, height=24); combo.set("本地音乐")
Label(f, text="蓝牙音乐").place(x=0, y=30, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=30, width=130, height=24); combo.set("本地音乐")
Label(f, text="CarPlay").place(x=0, y=60, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=60, width=130, height=24); combo.set("本地音乐")
Label(f, text="AndroidAuto").place(x=0, y=90, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=90, width=130, height=24); combo.set("本地音乐")
Label(f, text="Aux").place(x=0, y=120, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=120, width=130, height=24); combo.set("本地音乐")
Label(f, text="收音机").place(x=0, y=150, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=150, width=130, height=24); combo.set("本地音乐")
Label(f, text="语音助手").place(x=0, y=180, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=180, width=130, height=24); combo.set("语音助手")
Label(f, text="响铃时语音助手").place(x=0, y=210, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=210, width=130, height=24); combo.set("蓝牙电话")
Label(f, text="蓝牙电话铃声").place(x=0, y=240, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=240, width=130, height=24); combo.set("蓝牙电话")
Label(f, text="蓝牙电话").place(x=0, y=270, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=270, width=130, height=24); combo.set("蓝牙电话")
Label(f, text="CarPlay电话").place(x=0, y=300, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=300, width=130, height=24); combo.set("蓝牙电话")
Label(f, text="导航").place(x=0, y=330, width=150, height=24)
combo = Combobox(f, values=values, state="readonly"); combo.place(x=150, y=330, width=130, height=24); combo.set("导航")
return f
# 音源分组的音量
def tab_source_group_vol(master):
f = LabelFrame(master, text="音源分组的音量", padding=5)
Label(f, text="本地音乐").place(x=0, y=0, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=0, width=100, height=24)
Label(f, text="本地视频").place(x=0, y=0, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=30, width=100, height=24)
Label(f, text="蓝牙音乐").place(x=0, y=30, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=60, width=100, height=24)
Label(f, text="CarPlay").place(x=0, y=60, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=90, width=100, height=24)
Label(f, text="AndroidAuto").place(x=0, y=90, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=120, width=100, height=24)
Label(f, text="Aux").place(x=0, y=120, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=150, width=100, height=24)
Label(f, text="收音机").place(x=0, y=150, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=180, width=100, height=24)
Label(f, text="语音助手").place(x=0, y=180, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=210, width=100, height=24)
Label(f, text="响铃时语音助手").place(x=0, y=210, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=240, width=100, height=24)
Label(f, text="蓝牙电话铃声").place(x=0, y=240, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=270, width=100, height=24)
Label(f, text="蓝牙电话").place(x=0, y=270, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=300, width=100, height=24)
Label(f, text="CarPlay电话").place(x=0, y=300, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=330, width=100, height=24)
Label(f, text="导航").place(x=0, y=330, width=150, height=24)
CreateSpinbox(f, from_=0, to=31, value=10, x=150, y=0, width=100, height=24)
return f
# 音源分组和音量
def tab_source_group():
f = Frame(tk, padding=10)
f.pack(side=TOP, fill=BOTH, expand=1)
Label(f, foreground="red", text="提示:同一个分组的音源共享同一个音量值").place(x=200, y=0, width=300, height=24)
tab_source_group_source(f).place(x=0, y=30, width=300, height=395)
tab_source_group_vol(f).place(x=320, y=30, width=275, height=395)
return f
# 选项卡
notebook = Notebook(tk)
notebook.pack(side=TOP, fill=BOTH, expand=1)
notebook.add(tab_basic(), text="基本配置")
notebook.add(tab_source_group(), text="音源分组和音量")
notebook.add(Frame(tk, padding=10), text="主音量映射表")
notebook.add(Frame(tk, padding=10), text="混音音量映射表")
notebook.add(Frame(tk, padding=10), text="声场映射表")
notebook.add(Frame(tk, padding=10), text="EQ中心频率和Q值")
notebook.add(Frame(tk, padding=10), text="EQ增益映射表")
notebook.add(Frame(tk, padding=10), text="EQ增益")
tk.mainloop()
标签:24,150,界面,Python,text,height,width,place,tkinter From: https://www.cnblogs.com/kehuadong/p/17352517.html