当前位置: 首页 > 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 Shift+F10 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")ser=serial.Serial(port=a,baudrate=int(b),bytesize=bytesize,stopbits=stopbitsize,parity=paritysel,timeout=0.5)#   ser = serial.Serial('COM4', 9600, timeout=1)def print_hi(name):# Use a breakpoint in the code line below to debug your script.print(f'Hi, {name}')  # Press Ctrl+F8 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(target=recv_hander)th.setDaemon(True)th.start()def msg_send():msg = msginp.get()print_log(f'send==>{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(relx=0.01, rely=0.05, relwidth=0.1, relheight=0.1)comnum = Combobox(root, textvariable=comnumvar, values=['COM1', 'COM2', 'COM3', 'COM4', ])comnum.place(relx=0.08, rely=0.075, relwidth=0.1)comnum.current(3)lb_baud = Label(root, text='波特率')lb_baud.place(relx=0.01, rely=0.12, relwidth=0.1, relheight=0.1) #add 0.045baud = Combobox(root, textvariable=baudvar, values=['115200', '38400', '9600', '4800', ])baud.place(relx=0.08, rely=0.145, relwidth=0.1) #add 0.025baud.current(2)lb_databit = Label(root, text='数据位')lb_databit.place(relx=0.01, rely=0.19, relwidth=0.1, relheight=0.1)  #add 0.045databit = Combobox(root, textvariable=databitvar, values=['8', '7', '6', '5', ])databit.place(relx=0.08, rely=0.215, relwidth=0.1)     #add 0.025databit.current(0)lb_stopbit = Label(root, text='停止位')lb_stopbit.place(relx=0.01, rely=0.26, relwidth=0.1, relheight=0.1)stopbit = Combobox(root, textvariable=stopbitvar, values=['1', '2', ])stopbit.place(relx=0.08, rely=0.285, relwidth=0.1)stopbit.current(0)lb_parity = Label(root, text='校验位')lb_parity.place(relx=0.01, rely=0.33, relwidth=0.1, relheight=0.1)parity = Combobox(root, textvariable=parityvar, values=['None','Odd','Even',])parity.place(relx=0.08, rely=0.355, relwidth=0.1)parity.current(0)btnopen = Button(root, text='打开串口', command=open_com)btnopen.place(relx=0.01, rely=0.45, relwidth=0.1, relheight=0.05)btnclose = Button(root, text='关闭串口', command=close_com)btnclose.place(relx=0.12, rely=0.45, relwidth=0.1, relheight=0.05)lb1 = Label(root, text='串口数据接收')lb1.place(relx=0.25, rely=0.05, relwidth=0.7, relheight=0.1)msgshow = Text(root)msgshow.place(relx=0.25, rely=0.15, relwidth=0.7, relheight=0.3)lb2 = Label(root, text='串口数据发送')lb2.place(relx=0.25, rely=0.45, relwidth=0.7, relheight=0.1)msginp = Entry(root)msginp.place(relx=0.25, rely=0.55, relwidth=0.7, relheight=0.1)btnsend = Button(root, text='发送', command=msg_send)btnsend.place(relx=0.35, rely=0.86, relwidth=0.3, relheight=0.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.hengruixuexiao.com/news/23324.html

相关文章:

  • UltraEdit做网站教程seo怎么收费的
  • 昆山网站建设培训学校盐城seo网站优化软件
  • vi手册全套模板淘宝seo优化是什么意思
  • 网站建设hph下载合肥seo优化公司
  • 怎么在搜索引擎做网站登记免费广告推广软件
  • 徐州网站建设网站制作如何设计与制作网页
  • 造价企业怎么登陆建设部网站纹绣培训班一般价格多少
  • 做网站是不是需要服务器百度竞价排名平台
  • app官网抖音seo推荐算法
  • 每个网站都有服务器吗肇庆疫情最新消息
  • 网站建设报告书总结青岛seo整站优化
  • 网站建设广告图青岛官网优化
  • 东莞做网站优化自己怎么免费做网站网页
  • 网站建设项目招标文件seo概念
  • 网站设计语言青海百度关键词seo
  • 温州给企业做网站品牌策划案例
  • 贵阳网站建设推广高明搜索seo
  • 做图片站 把图片放到其它网站可以吗怎么申请建立网站
  • 网站做链接操作步骤济南搜索引擎优化网站
  • 爱网站黄爱站之家
  • 网站建设报价单 非常好用的报价模板.doc域名注册信息查询whois
  • 做直播平台网站赚钱吗网络舆情监测与研判
  • 七牛云微信打开wordpressseo关键词优化策略
  • 手工制作冰墩墩长沙网站优化体验
  • 网站写动态新闻有什么好处最好的推广平台排名
  • 旅游地网站制作百度网站名称和网址
  • 网站建设 创业西安seo和网络推广
  • 网站设计问题seo关键词排名在线查询
  • 建设部人事考试网站官网企业培训课程
  • 网站后台管理系统如何安装nba排名西部和东部