|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
1.qtdesigner设计出的窗口比例与python打开的不符,怎样修改使其等比例
2.视频教程中可以在这个位置添加图片按钮,我的不可以添加,为什么或者从哪可以使用这个功能。
3.收音机按钮调试错误代码和错误如下
import sys
import PyQt5.QtWidgets as qw
from test import Ui_MainWindow
from PyQt5.QtWidgets import QMainWindow, QApplication
class MyWindow(QMainWindow, Ui_MainWindow):
def __init__(self):
super(MyWindow, self).__init__()
self.setupUi(self)
#绑定信号与槽
self.comboBox_bote.currentIndexChanged.connect(self.comboBox_bote_cb)
self.btn_send.clicked.connect(self.btn_send_cb)
self.action_start.triggered.connect(self.action_start_cb)
self.action_pause.triggered.connect(self.action_pause_cb)
self.action_stop.triggered.connect(self.action_stop_cb)
self.action_clean.triggered.connect(self.action_clean_cb)
self.radioButton_recv_ascii.toggled(self.radioButton_recv_ascii_cb)
self.radioButton_send_ascii.toggled(self.radioButton_send_ascii_cb)
#初始化窗口
self.statusbar.showMessage("status:ok")
#初始化界面
self.radioButton_recv_ascii.setChecked(True)
self.radioButton_send_ascii.setChecked(True)
def comboBox_bote_cb(self):
content = self.comboBox_bote.currentText()
print("combox's value is",content)
text = "您当前选中了%s"%content
qw.QMessageBox.information(self,"提示",text,qw.QMessageBox.Ok | qw.QMessageBox.Cancel)
def btn_send_cb(self):
print("you clicked btn_send.")
text = self.textEdit__get.toPlainText()
print("text is",text)
#增加combox的下拉选项
self.comboBox_uart.addItem(text)
def action_start_cb(self):
print("you clicked action_start")
def action_pause_cb(self):
print("you clicked action_pause")
def action_stop_cb(self):
print("you clicked action_stop")
def action_clean_cb(self):
print("you clicked action_clean")
def radioButton_recv_ascii_cb(self):
print("you selected radioButton_recv_ascii")
def radioButton_send_ascii_cb(self):
print("you selected radioButton_send_ascii")
if __name__ == '__main__':
app = QApplication(sys.argv)
myWin = MyWindow()
myWin.show()
sys.exit(app.exec_())
错误如下
File "D:\pycharm\pyqt设计\severy.py", line 19, in __init__
self.radioButton_recv_ascii.toggled(self.radioButton_recv_ascii_cb)
TypeError: native Qt signal is not callable
Process finished with exit code 1
|
|