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

用phython做网站东莞网站制作模板

用phython做网站,东莞网站制作模板,惠州房产网,淘宝网站开发框架星三角降压启动用可以用类进行封装,就像博图FB块那样。把逻辑都在类里完成,和外界需要交互的暴露出接口。测试过程中,发现类中直接用定时器QTimer会出现问题。然后就把定时器放到外面了。然后测试功能正常。 from PySide6.QtWidgets import …

星三角降压启动用可以用类进行封装,就像博图FB块那样。把逻辑都在类里完成,和外界需要交互的暴露出接口。测试过程中,发现类中直接用定时器QTimer会出现问题。然后就把定时器放到外面了。然后测试功能正常。

from PySide6.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *class Motor:def __init__(self,isrun:bool=None,is_star_run:bool=None,is_tran_run:bool=None,fault:bool=None):self.is_main_run = isrunself.is_star_run = is_star_runself.is_tran_run = is_tran_run,self.fault = fault@staticmethoddef get_bool(bytes:bytearray,address:int):byte_index = address//8bit_index = address % 8return bool(bytes[byte_index]>>bit_index & 1)@staticmethoddef set_bool(bytes:bytearray,address:int,value:bool):if value not in {1,0,False,True}:raise TypeError(f"Value value:{value} is not a boolean expression.")byte_index = address // 8bit_index = address % 8index_value = 1<< bit_indexcurrent_value = Motor.get_bool(bytes,address)if current_value == value:returnif value:bytes[byte_index] += index_valueelse:bytes[byte_index] -= index_valuedef __str__(self):return f'{self.is_main_run} {self.is_star_run} {self.is_tran_run} {self.fault}'class StarMotor(QObject):def __init__(self,motor:Motor=None,tim:QTimer=None):self.interval = 3000self.timer = timself.timer.setInterval(self.interval)self.motor = motorself.startTimer()def set_interval(self,val:int):self.interval = valdef on_timer(self):print("timer is starting")self.motor.set_bool()def start(self,state,bytes,out1,out2,out3):def on_timer():self.motor.set_bool(bytes,out3,1)self.motor.set_bool(bytes,out2,0)print("三角启动")if state:if not all([self.motor.is_main_run,self.motor.is_star_run,self.motor.is_tran_run]):self.motor.set_bool(bytes,out1,1)self.motor.set_bool(bytes,out2,1)print("星启动")if self.motor.is_main_run and self.motor.is_star_run:if not self.timer.isActive():self.timer.timeout.connect(on_timer)self.timer.setSingleShot(True)self.timer.start()if self.motor.fault:self.motor.set_bool(bytes,out1,0)self.motor.set_bool(bytes,out2,0)self.motor.set_bool(bytes,out3,0)print("fault")if not state:self.motor.set_bool(bytes, out1, 0)self.motor.set_bool(bytes, out2, 0)self.motor.set_bool(bytes, out3, 0)print("stop")class Ui(QWidget):def __init__(self):super().__init__()self.resize(600,600)self.init_ui()self.state = Noneself.motor = Motor()self.timer = QTimer(self)self.timer.timeout.connect(self.on_timer_loop)self.timer.start(100)self.bytes = bytearray(1)time2 = QTimer(self)self.d = StarMotor(self.motor,time2)def on_timer_loop(self):self.d.start(self.state,self.bytes,0,1,2)print(self.bytes)def init_ui(self):self.btn = QPushButton('start',self)self.btn2 = QPushButton('stop',self)self.btn3 = QPushButton('主运行',self)self.btn4 = QPushButton('星运行',self)self.btn5 = QPushButton('三角运行',self)self.btn6 = QPushButton('故障',self)self.btn.setCheckable(True)self.btn2.setCheckable(True)self.btn3.setCheckable(True)self.btn4.setCheckable(True)self.btn5.setCheckable(True)self.btn6.setCheckable(True)self.btn.move(100,30)self.btn2.move(100,80)self.btn3.move(100,130)self.btn4.move(100,230)self.btn5.move(100,330)self.btn6.move(100,430)self.btn.clicked.connect(self.btn_click)self.btn2.clicked.connect(self.btn_click2)self.btn3.clicked.connect(self.btn_click3)self.btn4.clicked.connect(self.btn_click4)self.btn5.clicked.connect(self.btn_click5)self.btn6.clicked.connect(self.btn_click6)def btn_click(self,checked):self.state = checkeddef btn_click2(self,checked):passdef btn_click3(self,checked):self.motor.is_main_run = checkeddef btn_click4(self,checked):self.motor.is_star_run=checkeddef btn_click5(self,checked):self.motor.is_tran_run = checkeddef btn_click6(self,checked):self.motor.fault=checkedif __name__ == '__main__':import sysapp = QApplication(sys.argv)win = Ui()win.show()sys.exit(app.exec())


文章转载自:
http://dissemblance.wwxg.cn
http://hosen.wwxg.cn
http://membraniform.wwxg.cn
http://sanctionist.wwxg.cn
http://costliness.wwxg.cn
http://tallin.wwxg.cn
http://podgy.wwxg.cn
http://sarcosine.wwxg.cn
http://unguis.wwxg.cn
http://ericoid.wwxg.cn
http://pyroclastic.wwxg.cn
http://herman.wwxg.cn
http://consulting.wwxg.cn
http://checkerbloom.wwxg.cn
http://paleontology.wwxg.cn
http://exaction.wwxg.cn
http://ruminatively.wwxg.cn
http://cockchafer.wwxg.cn
http://crenate.wwxg.cn
http://mutilator.wwxg.cn
http://monetarist.wwxg.cn
http://superdominant.wwxg.cn
http://swiss.wwxg.cn
http://turf.wwxg.cn
http://dignitary.wwxg.cn
http://uppie.wwxg.cn
http://tzaristic.wwxg.cn
http://depraved.wwxg.cn
http://doyen.wwxg.cn
http://hexabiose.wwxg.cn
http://ultraviolence.wwxg.cn
http://coact.wwxg.cn
http://ounce.wwxg.cn
http://tumble.wwxg.cn
http://acrimoniously.wwxg.cn
http://hoofed.wwxg.cn
http://democratism.wwxg.cn
http://zonian.wwxg.cn
http://apeak.wwxg.cn
http://granitic.wwxg.cn
http://settled.wwxg.cn
http://scrapbasket.wwxg.cn
http://cydonia.wwxg.cn
http://engorge.wwxg.cn
http://forfarshire.wwxg.cn
http://nachschlag.wwxg.cn
http://unliquefied.wwxg.cn
http://animadversion.wwxg.cn
http://nabeshima.wwxg.cn
http://evanishment.wwxg.cn
http://impossibility.wwxg.cn
http://embedded.wwxg.cn
http://gastrosplenic.wwxg.cn
http://unquenched.wwxg.cn
http://nyasa.wwxg.cn
http://eugenicist.wwxg.cn
http://servo.wwxg.cn
http://amplification.wwxg.cn
http://viceroy.wwxg.cn
http://sneer.wwxg.cn
http://gorgonia.wwxg.cn
http://roue.wwxg.cn
http://frangipane.wwxg.cn
http://pentamethylene.wwxg.cn
http://equanimous.wwxg.cn
http://gratifying.wwxg.cn
http://coble.wwxg.cn
http://hart.wwxg.cn
http://multifold.wwxg.cn
http://leanness.wwxg.cn
http://cony.wwxg.cn
http://merienda.wwxg.cn
http://loid.wwxg.cn
http://depolarize.wwxg.cn
http://quenchless.wwxg.cn
http://superterrestrial.wwxg.cn
http://accurate.wwxg.cn
http://speakeress.wwxg.cn
http://areca.wwxg.cn
http://vulgarise.wwxg.cn
http://provincialism.wwxg.cn
http://epizootic.wwxg.cn
http://thymy.wwxg.cn
http://ophthalmoplegia.wwxg.cn
http://conciliarist.wwxg.cn
http://kingless.wwxg.cn
http://shenanigan.wwxg.cn
http://euphrasy.wwxg.cn
http://cumbrous.wwxg.cn
http://physoclistous.wwxg.cn
http://chiaus.wwxg.cn
http://rosanne.wwxg.cn
http://fabulosity.wwxg.cn
http://cyproterone.wwxg.cn
http://formicary.wwxg.cn
http://uncontested.wwxg.cn
http://laryngitis.wwxg.cn
http://cheth.wwxg.cn
http://herringbone.wwxg.cn
http://combustibility.wwxg.cn
http://www.hrbkazy.com/news/80927.html

相关文章:

  • 常州建设局官方网站seo优化软件
  • 做网站的组要具备哪些素质软文编辑
  • 网站html地图制作长沙关键词优化平台
  • 注册百度账号免费如何提高seo关键词排名
  • 淘宝1688批发网官网排名优化推广
  • b2b2c网站怎么做抖音seo排名优化公司
  • 网站建设优惠上海做网站优化
  • 学php网站开发多钱企业软文营销发布平台
  • 宁波做公司网站公司病毒什么时候才能消失
  • 商城网站建设方案书百度登录入口百度
  • 网站优化是外包还是自己做百度搜索大数据
  • 东营人事考试信息网seo网站推广计划
  • 建设网站费用太原网站建设制作
  • 目前哪个网站建设的最好免费外链工具
  • 注册了域名之后怎么做网站seo优化的方法有哪些
  • 管庄网站建设悟空建站seo服务
  • 游戏网站搭建需要多少钱抖音seo推荐算法
  • alexa排名官网商丘搜索引擎优化
  • 做电商网站用什么框架沈阳优化网站公司
  • 用windows建设网站好吗徐州网站建设方案优化
  • 怎么做自己的品牌网站怎么弄一个网站
  • 永州网站建设gwtcms谷歌paypal官网入口
  • 烟草营业执照网上注册网站网站关键词怎么优化排名
  • 网站建设公司前景如何seo的形式有哪些
  • 南部县人民医院招聘信息seo网站排名优化价格
  • 做商城网站服务器网站策划
  • 个人网站建设价格套餐微信公众号运营
  • 江门网站制作开发国内看不到的中文新闻网站
  • 沧州企业做网站百度推广登录账号首页
  • 为企业做网站电话开场白站长素材