- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在 3Dsmax 2015 上做一些简单的 PySide。
这是我的错误:
python.ExecuteFile "C:\Program Files\Autodesk\3ds Max 2015\scripts\Python\demoUniTest.py"
-- Runtime error: Line 32 <module>()
<type 'exceptions.RuntimeError'> A QApplication instance already exists.
这是我的代码:
import sys
from PySide.QtCore import *
from PySide.QtGui import *
from math import *
class Form(QDialog):
def __init__(self,parent=None):
super(Form,self).__init__(parent)
self.browser = QTextBrowser()
self.lineedit = QLineEdit("Type an expression and press Enter")
self.lineedit.selectAll()
layout = QVBoxLayout()
layout.addWidget(self.browser)
layout.addWidget(self.lineedit)
self.setLayout(layout)
self.lineedit.setFocus()
self.connect(self.lineedit, SIGNAL("returnPressed()"),self.updateUi)
self.setWindowTitle("Calculate")
def updateUi(self):
try:
text = self.lineedit.text()
self.browser.append("%s = <b>%s</b>" % (text,eval(text)))
except:
self.browser.append("<font color=red>%s is invalid</font>" %text)
app = QApplication(sys.argv)
form = Form()
form.show()
app.exec_()
当我在 Pycharm 上使用这段代码时,我没有收到任何错误。只有当我在 3Dsmax 2015 Listener 上使用它时才会出现
最佳答案
帮助文件中的直接引用 ( Using PySide ):
Normally one creates a PySide application object in a script using QtGui.QApplication(). However, in 3ds Max, there is already a PySide application running, so you get a handle for that object like this:
QtGui.QApplication.instance()
关于python - QApplication 实例已经存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27150852/
我想念任何Qt如果我替换 QApplication::exec() 的功能使用标准的 Windows 消息循环实现?这应该澄清我的意思: 运行事件处理的常用“Qt”方式: int main(int a
何时在 Windows 上调用虚函数 QApplication::saveState 和 QApplication::commitData?它们是否被调用,或者 session 管理只是 UNIX 的
有两个qApplications A & B,它们可以在各自的主窗口中分别执行。 我想实现以下目标: 1) //Open Application B. //Inside App B's code
我正在尝试运行一个简单的 hello world 示例,并且已经需要一些时间来弄清楚要使用的内容现在我验证了包含路径,QApplication 实际上应该在那里,但它抛出了上述错误。为了清楚起见,我的
当我首先运行 python-pyside2 项目服务器时,它运行良好。 而且该站点也运行良好,但是如果我按 F5 btn 在浏览器中刷新。 站点显示错误页面 Runtime at/ import sy
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
我正在将 Qt 桌面应用程序移植到 Linux(Ubuntu 19.10、64 位桌面、Qt 5.12.5、gcc 版本 9.2.1),并且在 QApplication 完成后发现一些意外的线程仍然处
这里引用 Qt 文档: For any GUI application using Qt, there is precisely one QApplication object 很明显。但我不知道为什
这里引用 Qt 文档: For any GUI application using Qt, there is precisely one QApplication object 很明显。但我不知道为什
我正在尝试将修改后的 qt 程序作为库运行。我需要它而不是阻止主执行。 所以我想做的是运行 QApplication 并开始执行主应用程序。我该如何实现? 我的第一个想法是在一个单独的线程中运行它。
我需要在单击按钮时重新启动我的应用程序,但我遇到了一些问题。我尝试了两种方法: 已尝试 this suggestion它确实重新启动了应用程序,但是我得到了每个小部件的 Gtk_IS_INVISIBL
我试图在不同的线程中创建 QApplication,但发现了 2 个主要问题: 1- 我无法与 GUI 交互 2- 一些警告: 警告:QApplication 不是在 main() 线程中创建的。 Q
是否可以在退出前一个实例后创建和使用新的 QApplication 实例? 最佳答案 是的,您可以在销毁前一个实例后创建一个新的 QApplication。我在 Windows 中使用 PyQt4 验
我是 PyQt4(和 QT)的新手,我遇到了一个问题, 我已经对 QApplication 进行了子类化(以具有对应用程序真正全局的全局数据和函数): class App(QApplication):
我正在 3Dsmax 2015 上做一些简单的 PySide。 这是我的错误: python.ExecuteFile "C:\Program Files\Autodesk\3ds Max 2015\s
我有一个带有单个对话框窗口的 Qt 应用程序。主要看起来像这样: QApplication a(argc, argv); MyObject * myMobject = new QObject(&a);
我有一个带有通知区域图标的应用程序,因此主窗口可能会忽略关闭事件。我正在尝试在应用程序退出时保存首选项和历史记录。我还想在应用程序运行时处理注销。虽然该应用程序是跨平台的,但它在 GNU/Linux
QApplication::QApplication ( int & argc, char ** argv ) Initializes the window system and constructs
我应该在哪里使用 except 块来记录 QApplication 的异常? 这似乎不起作用: app = QtGui.QApplication(sys.argv) MainWindow = Main
在基本的 C++ Qt Widgets 应用程序中,在堆栈上创建一个 QApplication 或直接在 main 函数中对其进行堆分配是可行的,但是在堆上调用一个函数-分配一个 QApplicati
我是一名优秀的程序员,十分优秀!