python 串口工具制作(2)

本文详细介绍了一款串口工具V1.01的制作过程,包括使用Python和Tkinter库进行界面设计,实现串口扫描、选择、发送数据等功能,并提供了完整的代码示例。

基于上一篇python TK之串口工具制作(1)的博文,我在这里做一些功能的完善,添加文本框数据编写发送功能。
首先我们在TK界面制作页面(按键初始化)增加文本框以及数据发送按钮:

#按钮初始化
def Button_Init():
 global root
 global com_list_tk
 global Test_Log
 global Entry_SN

 #串口读取写入
 Button(text='扫描串口', command=Scan_Com, width=24, height=3,font=('宋体', 11)).grid(row=0, column=0)
 Button(text='选择串口', command=Select_Com, width=24, height=3,font=('宋体', 11)).grid(row=1, column=0)
 #Button(text='选择串口', command=send_Com, width=24, height=3, font=('宋体', 11)).grid(row=0, column=1)
 Button(text='删除文本框', command=Delete_Text, width=24, height=3, font=('宋体', 11)).grid(row=0, column=1)
 Button(text='关闭串口', command=close_serial, width=24, height=3, font=('宋体', 11)).grid(row=1, column=1)

 Button(text='发送', command=send_data, width=10, height=2, font=('宋体', 11)).grid(row=3, column=2)
 Entry_SN = Entry(root)
 Entry_SN.grid(row=3, column=0, ipadx=131, ipady=10,columnspan=2)

 com_list_tk = Listbox(root)
 com_list_tk.grid(row=2, column=0, ipadx=28, ipady=60)
 Test_Log = scrolledtext.ScrolledText(root, width=23, height=20, font=('宋体', 11)
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值