当前位置:网站首页>在abaqus中使用PyQt设计GUI
在abaqus中使用PyQt设计GUI
2022-07-28 15:23:00 【CaeCoder】
环境说明
- 操作系统 :Window10
- Abaqus版本:Abaqus2017,其python版本为64位python2.7.3
- PyQt版本:PyQt4
安装PyQt
- 下载对应版本的PyQt4安装程序,关注微信公众号
CAE软件二次开发Lab,发送pyqt获取下载地址。
- 运行PyQt4安装exe,选择安装目录为Abaqus2017安装目录下win_64\tools\SMApy\python2.7,如下所示。
安装完成后,在abaqus的python目录下新增PyQt4文件夹,如下:
在Abaqus中运行PyQt4设计的GUI
- 编写PyQt4代码。
将如下代码保存为pyqt4_test.py文件。
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtGui,QtCore
class Center(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setWindowTitle('center')
self.resize(250, 150)
# 重新设置大小
quit=QtGui.QPushButton('Close',self)
quit.setGeometry(10,10,60,35)
self.connect(quit,QtCore.SIGNAL('clicked()'),QtGui.qApp,QtCore.SLOT('quit()'))
self.center()
def center(self):
screen = QtGui.QDesktopWidget().screenGeometry()
# 获取屏幕分辨率
size = self.geometry()
# 获取组件大小
self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
def main():
app=0
app = QtGui.QApplication([])
qb = Center()
qb.show()
app.exec_()
if __name__ == "__main__":
main()
- 打开Abaqus CAE,菜单File -> Run Script选择pyqt4_test.py,运行效果如下。

PyQt4说明
只所以选择pyqt4而不是pyqt5是因为当前abaqus的python版本都是python2.x,而pyqt5大多只支持python3.x。
网上查找PyQt5只有针对Python3的安装包而没有针对Python2.7的,所以暂时选择PyQt4。关于在abaqus上安装PyQt5的方法,以后有时间再尝试。
扫描下方二维码关注我的微信公众号 - CAE软件二次开发Lab,查看更多精彩文章!

边栏推荐
- High precision absolute angle sensor application high speed angle monitoring
- 资本「断供」两年,我只能把公司卖了
- 百度编辑器ueditor,编辑内容过多时,工具栏不可见,不方便编辑或上传问题
- I'll show you a little chat! Summary of single merchant function modules
- Summary of for loop in JS
- Deeply understand the fusing configuration of istio traffic management
- LwIP development | socket | TCP | client
- 不懂就问,快速成为容器服务进阶玩家!
- Rosen's QT journey 102 listmodel
- Writing of factorial
猜你喜欢

2021 Yahong pen test question 2

KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书

High speed counter to rs485modbus RTU module ibf150

12V pulse speed measurement to 24V level signal conversion transmitter

仅需三步 轻松实现远程办公

2021 亚鸿笔试题2

KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书

Basic structure and operation principle of solar street lamp

SCI scientific paper writing Growth Camp (full version)

Why do most people who learn programming go to Shenzhen and Beijing?
随机推荐
Advantages of optical rain gauge over tipping bucket rain gauge
JS queue
JS stack
I came across Digital Phoenix coordinate Xuhui Meiluo city in Shanghai
一大早支付宝来短信说你中“奖”了?处理服务器挖矿病毒 - kthreaddi
leetcode 题目
mysql 查看事件状态语句和修改办法
Baidu editor ueeditor, when editing too much content, the toolbar is not visible, which is not convenient for editing or uploading problems
Qt学习第一天
头条文章_signature
CoDeSys realizes bubble sorting
PHP计算坐标距离
深入理解Istio流量管理的熔断配置
c语言编程当中两个!!的作用
Summary of for loop in JS
Rosen's QT journey 102 listmodel
Roson的Qt之旅#102 ListModel
Common problems and precautions of remote serial port server (adapter) uart/i2c/1-wire/spi PS304
学会使用MySQL的Explain执行计划,SQL性能调优从此不再困难
R language ggplot2 visually draws line plots, and uses gghighlight package to highlight the lines that meet the combination judgment conditions in the line graphs (satisfies both condition a and b)