def create_signal_slot(self): self.Com_Open_Button.clicked.connect(self.com_open_button_clicked) self.Com_Close_Button.clicked.connect(self.com_close_button_clicked) self.Send_Button.clicked.connect(self.send_button_clicked) self.Com_Refresh_Button.clicked.connect( self.com_refresh_button_clicked) self.uart.readyRead.connect(self.com_receive_data) # 接收数据 # self.uart.connectNotify.connect(lambda x: print("New connect")) self.hexSending_checkBox.stateChanged.connect(self.hex_showing_clicked) self.hexSending_checkBox.stateChanged.connect(self.hex_sending_clicked) # self.About_Button.clicked.connect(self.Goto_GitHub) self.pushButton_readMCU.clicked.connect(self.send_read_mcu) # self.checkBox_UseOpenCV.stateChanged.connect(self.on_open_cv_use_clicked) self.checkBox_showGrid.stateChanged.connect(self.on_show_grid_changed) self.pushButton_saveImg.clicked.connect(self.save_img) self.pushButton_clear_dict.clicked.connect(self.on_clear_dict) # self.comboBox_transpose.currentIndexChanged.connect( # self.tab_piano.on_tranpose_change # ) # self.textEdit_Recive.textChanged.connect(lambda: self.textEdit_Recive.moveCursor(QTextCursor.End)) # self.textEdit_Recive. # 自定义信号槽 self.uart.signal_update_standard_gui.connect(self.update_standard_gui) self.tabWidget_other.currentChanged.connect(self.update_standard_gui) self.tab_piano.send_msg.connect(self.uart.write) # Action self.action_uart.changed.connect( lambda: self.dockWidget_uart.setHidden(not self.action_uart. isChecked())) self.dockWidget_uart.visibilityChanged.connect( lambda b: self.action_uart.setChecked(b)) self.action_exit.triggered.connect(lambda: QApplication.exit()) self.actionAbout_Qt.triggered.connect( lambda: QMessageBox.aboutQt(self, "About Qt")) self.actionAboutThis.triggered.connect(self.on_about_this) self.action_stop.triggered.connect( lambda: self.uart.write(b'\xc10 0\0'))
self.portLine.setText('{}'.format(experiment.properties['Monitor']['channel'])) self.timeResolutionLine.setText(experiment.properties['Monitor']['time_resolution']) self.refreshTimeLine.setText(experiment.properties['Monitor']['refresh_time']) self.totalTimeLine.setText(experiment.properties['Monitor']['total_time']) def apply_new_values(self): """Formats the values in the form and emits a custom signal *propertiesChanged* including a dictionary of the values that are provided (changed or not). """ new_values = {'port_monitor': int(self.portLine.text()), 'time_resolution': Q_(self.timeResolutionLine.text()), 'refresh_time': Q_(self.refreshTimeLine.text()), 'total_time': Q_(self.totalTimeLine.text()),} self.propertiesChanged.emit(new_values) if __name__ == "__main__": import sys from PyQt5.Qt import QApplication ap = QApplication(sys.argv) from PythonForTheLab.Model.experiment.IV_measurement import Experiment e = Experiment() session = {'port_monitor': 1, 'time_resolution': Q_('1ms'), 'refresh_time': Q_('20ms'), 'total_time': Q_('15s')} e.properties = session m = ConfigWindow(e) m.show() ap.exit(ap.exec_())
from PyQt5.QtBluetooth import * from PyQt5.Qt import QApplication if __name__=='__main__()': app=QApplication() service=QBluetoothServiceInfo() a='00:00:00:00:5a:ad' adQ=QBluetoothAddress(a) service.registerService(adQ) soc=QBluetoothSocket(service.socketProtocol()) soc.writeData('sadas') app.exit()
from PyQt5.QtGui import QMovie from PyQt5.QtWidgets import QWidget, QLabel from PyQt5 import Qt from PyQt5.Qt import QApplication import sys class loading(QWidget): def __init__(self): super().__init__() self.setFixedSize(200,300) self.label = QLabel(self) self.movie = QMovie('image/loading.gif') self.movie.start() self.show() app = QApplication(sys.argv) app.exit(app.exec())