PyQT中让QMessageBox按钮显示中文
来源:互联网 发布:c语言怎么产生随机数 编辑:程序博客网 时间:2024/05/16 16:11
QMessageBox.warning(self,'错误', '用户名和密码不匹配', QMessageBox.Yes, QMessageBox.Yes)
以上一条语句输出,但更改前这样显示的,中英文混合,看着别扭。
参考了http://srinikom.github.io/pyside-docs/PySide/QtGui/QMessageBox.html上的文档
self.box = QMessageBox(QMessageBox.Warning, "错误", "用户名和密码不匹配!") self.box.addButton(self.tr("确定"), QMessageBox.YesRole) #self.box.addButton(self.tr("取消"), QMessageBox.NoRole) self.box.show()
self.box = QMessageBox(QMessageBox.Warning, "错误", "用户名和密码不匹配!")qyes=self.box.addButton(self.tr("确定"), QMessageBox.YesRole)qno=self.box.addButton(self.tr("取消"), QMessageBox.NoRole)self.box.exec_()if self.box.clickedButton() == qyes: print('okokok')else: return其中,参数QMessageBox.YesRole可以为以下几种:
QMessageBox.InvalidRoleThe button is invalid.QMessageBox.AcceptRoleClicking the button causes the dialog to be accepted (e.g. OK).QMessageBox.RejectRoleClicking the button causes the dialog to be rejected (e.g. Cancel).QMessageBox.DestructiveRoleClicking the button causes a destructive change (e.g. for Discarding Changes) and closes the dialog.QMessageBox.ActionRoleClicking the button causes changes to the elements within the dialog.QMessageBox.HelpRoleThe button can be clicked to request help.QMessageBox.YesRoleThe button is a “Yes”-like button.QMessageBox.NoRoleThe button is a “No”-like button.QMessageBox.ApplyRoleThe button applies current changes.QMessageBox.ResetRoleThe button resets the dialog’s fields to default values.
阅读全文
1 0
- PyQT中让QMessageBox按钮显示中文
- Qt 中文显示 QMessageBox按钮中文显示
- Qt 中文显示 QMessageBox按钮中文显示
- Qt 中文显示 QMessageBox按钮中文显示
- QT 实现QMessageBox的按钮中文显示
- 自学QT之实现QMessageBox的按钮中文显示
- QMessageBox 中文 显示
- QT QMessageBox添加中文按钮
- Qt 5.6 QMessageBox 按钮显示为中文及 QTextEdit右键显示中文
- 在QT中,通过QMessageBox类或者其他显示中文
- QMessageBox 中的 OK 按钮改为中文“确定”
- PyQT,QMessageBox 使用介绍
- 将QMessageBox对话框中按钮的“Yes/No”转换成中文的“是/否”
- QT 中QMessageBox的用法中文按钮,设置背景,窗口LOGO
- Qt之中文显示(QMessageBox、QLine…
- QMessageBox中按钮汉化|确定,取消
- QMessageBox中定位哪个按钮被按下
- QMessageBox中按钮汉化|确定,取消
- 数据库分库分表中间件 Sharding-JDBC 源码分析 —— SQL 路由(一)分库分表配置
- Java CalendarApi
- static 详细分析
- 八数码问题有解条件&推广N×N,N×N×N
- 学习c++:(0)安装与教程
- PyQT中让QMessageBox按钮显示中文
- 数据库分库分表中间件 Sharding-JDBC 源码分析 —— SQL 路由(二)之分库分表路由
- cin.get()函数与cin.getline()函数的区别
- vb.net 发牌程序 2
- 二分法的应用
- 第三周项目3—求集合并集
- 关于struts2网页开发过程中的404或500问题
- Ubuntu 17.04(Zesty Zapus)安装QT
- 数据库分库分表中间件 Sharding-JDBC 源码分析 —— SQL 改写