首页 > 编程语言 >Python tkinter界面

Python tkinter界面

时间:2023-04-25 14:44:08浏览次数:37  
标签:24 150 界面 Python text height width place tkinter

# 文档 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

相关文章

  • (完结篇)Python web框架FastAPI——一个比Flask和Tornada更高性能的API 框架
    今日鸡汤借问酒家何处有,牧童遥指杏花村。0前言    前几天给大家分别分享了(入门篇)简析Pythonweb框架FastAPI——一个比Flask和Tornada更高性能的API框架和(进阶篇)Pythonweb框架FastAPI——一个比Flask和Tornada更高性能的API框架。今天欢迎大家来到FastAPI系列分享的完结篇......
  • 使用Qt Designer生成的两个UI文件,实现在主界面中点击后弹出另一个界面
    QtDesigner生成的ui代码policy.py#Formimplementationgeneratedfromreadinguifile'policy.ui'##Createdby:PyQt6UIcodegenerator6.4.2##WARNING:Anymanualchangesmadetothisfilewillbelostwhenpyuic6is#runagain.Donotedit......
  • python 修改服务器网卡信息
    importosimportreimportnetifacesimportsubprocessclassNetWorkConfig:def__init__(self):pass@staticmethoddefcheck_network_isvalid(ip,netmask,gateway,dns):"""判断用户输入的网络配置是否可用:pa......
  • python 相关
    python判断文件是否存在os.path.exists(file_path):python多线程p1=threading.Thread(target=down)t1=threading.Thread(target=crawl)print("启动")p1.start()t1.start()print("join")p1.join()t1.join()python多线程与redis控制多线程的数量whileTr......
  • python编程基础
    Python并不是一门新的编程语言,1991年就发行了第一个版本,2010年以后随着大数据和人工智能的兴起,Python又重新焕发出了耀眼的光芒。在2019年12月份世界编程语言排行榜中,Python排名第三,仅次于Java和C语言。Python是一门开源免费的脚本编程语言,它不仅简单易用,而且功能强大......
  • 分享Python采集88个NET电子商务源码,总有一款适合您
    Python采集的88个NET电子商务源码下载链接:百度网盘请输入提取码 提取码:c0gh编辑众筹系统(RaiseDreams众筹梦想)V2.1.6云点滴客户关系管理CRMOA系统V1.02.13云点滴客户解决方案V1.0.0创想商务B2B网站管理系统V3.1冰兔(Btoo)网店系统V6.39ASP.NET4.0电子商城MVC+EF水果市场2......
  • windows环境下emacs的python简单配置
    首先参考了上一篇《emacs极简配置》,我的想法是打开兼容vim的viper到5级,然后一些基本的字体设定,然后如何执行python文件的一个全过程方法。1、先打开emacs,如果忘了怎么用了,看一下自带的教程,还是中文的,超级方便。2、学完后,键入C-xC-f并按~,这样就会打开默认的配置文件所在的目录......
  • Python之peewee|4-22
    frompeeweeimport*db=MySQLDatabase('my_database',user='xxx',password='P@x',host='xxxxxx',port=3306)classUser(Model):name=CharField()email=CharField()classMeta:......
  • Python语言中__init__与__new__的区别是什么?
    __new__和__init__二者都是Python面向对象语言中的函数,其中__new__比较少用,__init__相对常用,那么两者有什么区别呢?以下是详细的内容:__new__作用:创建对象,并分配内存__init__作用:初始化对象的值注意:1、与java相比,java只有一个构造器。而python__new__方法与__in......
  • python画甘特图
    #-*-coding:utf-8-*-#pipinstallplotly-ihttps://pypi.tuna.tsinghua.edu.cn/simpleimportplotlyaspyimportplotly.figure_factoryasffpyplt=py.offline.plot###test1df=[dict(Task="项目1",Start='2015-02-05',Finish......