当前位置: 首页 > news >正文

淮安企业网站建设网页开发三件套

淮安企业网站建设,网页开发三件套,网站的标题与关键词,交换友情链接吧工具效果如下如所示 下面简单介绍一下操作流程 1.打开PyCharm软件 2.创建一个工程 3.给该工程命名 4.在main.py里面黏贴如下的代码 # This is a sample Python script. # Press ShiftF10 to execute it or replace it with your code. # Press Double Shift to search everyw…工具效果如下如所示 下面简单介绍一下操作流程 1.打开PyCharm软件 2.创建一个工程 3.给该工程命名 4.在main.py里面黏贴如下的代码 # This is a sample Python script. # Press ShiftF10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. import serial import threading import timefrom tkinter import * from tkinter.ttk import * from tkinter import messageboxdef open_serial(a,b,c,d,e):global serprint(串口号:,a)print(波特率:,int(b))print(数据位:,c)print(停止位:,d)print(检验位:,e)bytesize serial.EIGHTBITSif c 7:bytesize serial.SEVENBITSprint(select SEVENBITS)if c 6:bytesize serial.SIXBITSprint(select SIXBITS)if c 5:bytesize serial.FIVEBITSprint(select FIVEBITS)stopbitsize serial.STOPBITS_ONEif d 2:stopbitsize serial.STOPBITS_TWOprint(select STOPBITS_TWO)paritysel serial.PARITY_NONEif e Odd:paritysel serial.PARITY_ODDprint(select Odd)if e Even:paritysel serial.PARITY_EVENprint(select EVEN)serserial.Serial(porta,baudrateint(b),bytesizebytesize,stopbitsstopbitsize,parityparitysel,timeout0.5)# ser serial.Serial(COM4, 9600, timeout1)def print_hi(name):# Use a breakpoint in the code line below to debug your script.print(fHi, {name}) # Press CtrlF8 to toggle the breakpoint.def print_log(log):time_start time.time()date time.strftime(%Y-%m-%d %H:%M:%S, time.localtime())print(f{date}-{log})def recv_hander():while 1:if ser.is_open:data ser.read(1024).decode(gbk)print_log(data)msgshow.insert(END, data)def create_recv_thread():global thth threading.Thread(targetrecv_hander)th.setDaemon(True)th.start()def msg_send():msg msginp.get()print_log(fsend{msg})if ser.is_open:ser.write(msg.encode(gbk))def open_com():print_log(open com)com_val comnum.get()baud_val baud.get() # 获取当前选定项目的值databit_val databit.get()stopbit_var stopbit.get()parity_var parity.get()print(com_val)print(baud_val)open_serial(com_val, baud_val, databit_val, stopbit_var, parity_var)if ser.is_open:messagebox.showinfo(标题,串口打开成功)create_recv_thread()def close_com():print_log(close com)if ser.is_open:ser.close()# Press the green button in the gutter to run the script. if __name__ __main__:print_hi(PyCharm)root Tk()root.geometry(768x512)root.title(串口工具)comnumvar StringVar()baudvar StringVar()databitvar StringVar()stopbitvar StringVar()parityvar StringVar()lb_com Label(root, text串口号)lb_com.place(relx0.01, rely0.05, relwidth0.1, relheight0.1)comnum Combobox(root, textvariablecomnumvar, values[COM1, COM2, COM3, COM4, ])comnum.place(relx0.08, rely0.075, relwidth0.1)comnum.current(3)lb_baud Label(root, text波特率)lb_baud.place(relx0.01, rely0.12, relwidth0.1, relheight0.1) #add 0.045baud Combobox(root, textvariablebaudvar, values[115200, 38400, 9600, 4800, ])baud.place(relx0.08, rely0.145, relwidth0.1) #add 0.025baud.current(2)lb_databit Label(root, text数据位)lb_databit.place(relx0.01, rely0.19, relwidth0.1, relheight0.1) #add 0.045databit Combobox(root, textvariabledatabitvar, values[8, 7, 6, 5, ])databit.place(relx0.08, rely0.215, relwidth0.1) #add 0.025databit.current(0)lb_stopbit Label(root, text停止位)lb_stopbit.place(relx0.01, rely0.26, relwidth0.1, relheight0.1)stopbit Combobox(root, textvariablestopbitvar, values[1, 2, ])stopbit.place(relx0.08, rely0.285, relwidth0.1)stopbit.current(0)lb_parity Label(root, text校验位)lb_parity.place(relx0.01, rely0.33, relwidth0.1, relheight0.1)parity Combobox(root, textvariableparityvar, values[None,Odd,Even,])parity.place(relx0.08, rely0.355, relwidth0.1)parity.current(0)btnopen Button(root, text打开串口, commandopen_com)btnopen.place(relx0.01, rely0.45, relwidth0.1, relheight0.05)btnclose Button(root, text关闭串口, commandclose_com)btnclose.place(relx0.12, rely0.45, relwidth0.1, relheight0.05)lb1 Label(root, text串口数据接收)lb1.place(relx0.25, rely0.05, relwidth0.7, relheight0.1)msgshow Text(root)msgshow.place(relx0.25, rely0.15, relwidth0.7, relheight0.3)lb2 Label(root, text串口数据发送)lb2.place(relx0.25, rely0.45, relwidth0.7, relheight0.1)msginp Entry(root)msginp.place(relx0.25, rely0.55, relwidth0.7, relheight0.1)btnsend Button(root, text发送, commandmsg_send)btnsend.place(relx0.35, rely0.86, relwidth0.3, relheight0.1)root.mainloop()# See PyCharm help at https://www.jetbrains.com/help/pycharm/ 5.执行脚本 6.如果有提示“No module named serial”需要安装 pyserial在终端命令行输入pip install pyserial如下图所示 7.在windows下安装一对虚拟串口可以下载vspd安装最终结果如下所示 8.使用第三方工具进行数据互发测试 9.将该工具打包成exe可执行文件 在命令行终端输入python -m pysimplegui-exemaker.pysimplegui-exemaker 最后点击“Make EXE”生成如下所示的exe文件
http://www.dnsts.com.cn/news/247509.html

相关文章:

  • 公司创建网站要多少钱网站 验证
  • 网站安全体系建设方案快推达seo
  • 网站友链查询接口质控中心网站建设申请
  • 郑州东区做网站电话互联网保险的发展
  • dw网站开发环境wordpress的页面图片排版
  • php 网站响应时间东莞百度seo排名
  • 有什么兼职做设计的网站网络课程网站模板
  • 众包网站建设东莞手机网站模板
  • 网站飘动网站优化竞争对手分析
  • 有什么教人做论文的网站吗重庆网站设计总部
  • 盐城市建设局网站短视频seo询盘获客系统软件
  • 查网站二级域名企业廉洁建设
  • 几个免费建立网站的平台以前做视频的网站
  • cn域名有名的网站长春火车站咨询电话号码是多少
  • 多语言网站 推广网络编辑培训学校
  • 地方旅游网站模板东莞注册公司需要什么资料
  • 做网站和做软件凡客科技
  • 重钢建设公司官方网站中国移动网站备案管理系统不能用
  • 专业网站建设效果显著WordPress文章不置顶
  • 上海网站推广费用阿勒泰地区网站
  • 陕西省建设厅特种工报名网站做网站用angular
  • 网页设计共享网站湖南企业建站系统费用
  • wordpress 分类目录字数优化大师官网入口
  • 答题网站开发教程ajax jsp网站开发从入门到精通
  • 百度包头网站建设一学一做看视频网站
  • 青岛网站建设设计嘉定网站设计
  • 做美食类网站现状那个网站可以做攻略
  • 淄博企业高端网站建设织梦网站被做跳转还被删除文件
  • 做外单什么网站好可以做业务推广的网站有哪些
  • 企业网站设计方案书如何制作一个报名微信小程序