当前位置:网站首页>在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,查看更多精彩文章!

边栏推荐
- 一大早支付宝来短信说你中“奖”了?处理服务器挖矿病毒 - kthreaddi
- SDL2 简明教程(四):用 SDL_IMAGE 库导入图片
- 仅需三步 轻松实现远程办公
- Huada chip hc32f4a0 realizes RS485 communication DMA transceiver
- 动态规划 --- 数位统计DP
- LabVIEW LINX Toolkit控制Arduino设备(拓展篇—1)
- Reentrant and non reentrant
- 关于标准IO缓冲区的问题
- Installation points and precautions of split angle probe
- Automatic conversion and cast
猜你喜欢

mysql 查看事件状态语句和修改办法

关于标准IO缓冲区的问题

JS array (summary)

2-channel Di high-speed pulse counter, 1-channel encoder to Modbus TCP wired wireless module ibf161

About standard IO buffers

头条文章_signature

JS stack

Is MySQL query limit 1000,10 as fast as limit 10? If I want to page, what should I do?

Rust Getting Started Guide (crite Management)

Why do most people who learn programming go to Shenzhen and Beijing?
随机推荐
Rust Getting Started Guide (crite Management)
Basic structure and operation principle of solar street lamp
The epidemic dividend disappeared, and the "home fitness" foam dissipated
I can only sell the company after the capital has been "cut off" for two years
使用js直传oss阿里云存储文件,解决大文件上传服务器限制
CoDeSys realizes bubble sorting
Remote serial port server (adapter) UART to 1-wire application
5 亿用户,比微信还早四年……这个运营了 15 年的 APP 即将永久停服
Laser rangefinder non-contact surface crack monitor
Note: the value is rounded up to ten, hundred, thousand, ten thousand
Roson的Qt之旅#102 ListModel
PHP 图片上传
Automatic conversion and cast
IT远程运维是什么意思?远程运维软件哪个好?
mysql 查看事件状态语句和修改办法
关于标准IO缓冲区的问题
Use py to automatically generate weekly reports based on log records
Temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)
2021 Yahong pen test question 2
SDL2 简明教程(四):用 SDL_IMAGE 库导入图片