Events PyQt应用程序加载完成事件
如果我的结构像这样Events PyQt应用程序加载完成事件,events,pyqt,loading,Events,Pyqt,Loading,如果我的结构像这样 from PyQt4 import QtCore, QtGui from PyQt4.QtGui import QDialog,QImage,QPixmap from PyQt4.QtCore import * from PyQt4.QtGui import * from appView import Ui_View # this is designer .ui file converted to .py via pyuic4 cmd class AppWindow(QD
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog,QImage,QPixmap
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from appView import Ui_View
# this is designer .ui file converted to .py via pyuic4 cmd
class AppWindow(QDialog, Ui_View):
def __init__(self):
QDialog.__init__(self)
# Set up the user interface from Designer.
self.setupUi(self)
self.setupEvents()
def setupEvents():
print ("setting up events")
def onResize(event):
print event
def main():
app = QtGui.QApplication(sys.argv)
myapp = AppWindow()
myapp.resizeEvent = onResize
myapp.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
问题:
AppWindow
类,以便我知道其构造函数已完成运行李>
AppWindow
类中获取应用程序大小调整事件<我可以得到
如果AppWindow
类能够
倾听和处理:什么是最好的方式?应该
理想的做法是如上所述QApplication
启动一个一次性计时器,在AppWindows
上调用正确的方法即可onResize
的代码放入AppWindows.resizeEvent
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog,QImage,QPixmap
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
class AppWindow(QDialog):
def __init__(self):
QDialog.__init__(self)
# Set up the user interface from Designer.
#self.setupUi(self)
self.setupEvents()
def setupEvents(self):
print ("setting up events")
def resizeEvent(self,event):
print event
def onQApplicationStarted(self):
print 'started'
def main():
app = QtGui.QApplication(sys.argv)
myapp = AppWindow()
myapp.show()
t = QtCore.QTimer()
t.singleShot(0,myapp.onQApplicationStarted)
sys.exit(app.exec_())
if __name__ == '__main__':
main()
答复:
QApplication
启动一个一次性计时器,在AppWindows
上调用正确的方法即可onResize
的代码放入AppWindows.resizeEvent
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog,QImage,QPixmap
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
class AppWindow(QDialog):
def __init__(self):
QDialog.__init__(self)
# Set up the user interface from Designer.
#self.setupUi(self)
self.setupEvents()
def setupEvents(self):
print ("setting up events")
def resizeEvent(self,event):
print event
def onQApplicationStarted(self):
print 'started'
def main():
app = QtGui.QApplication(sys.argv)
myapp = AppWindow()
myapp.show()
t = QtCore.QTimer()
t.singleShot(0,myapp.onQApplicationStarted)
sys.exit(app.exec_())
if __name__ == '__main__':
main()
答复:
QApplication
启动一个一次性计时器,在AppWindows
上调用正确的方法即可onResize
的代码放入AppWindows.resizeEvent
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog,QImage,QPixmap
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
class AppWindow(QDialog):
def __init__(self):
QDialog.__init__(self)
# Set up the user interface from Designer.
#self.setupUi(self)
self.setupEvents()
def setupEvents(self):
print ("setting up events")
def resizeEvent(self,event):
print event
def onQApplicationStarted(self):
print 'started'
def main():
app = QtGui.QApplication(sys.argv)
myapp = AppWindow()
myapp.show()
t = QtCore.QTimer()
t.singleShot(0,myapp.onQApplicationStarted)
sys.exit(app.exec_())
if __name__ == '__main__':
main()
答复:
QApplication
启动一个一次性计时器,在AppWindows
上调用正确的方法即可onResize
的代码放入AppWindows.resizeEvent
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog,QImage,QPixmap
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
class AppWindow(QDialog):
def __init__(self):
QDialog.__init__(self)
# Set up the user interface from Designer.
#self.setupUi(self)
self.setupEvents()
def setupEvents(self):
print ("setting up events")
def resizeEvent(self,event):
print event
def onQApplicationStarted(self):
print 'started'
def main():
app = QtGui.QApplication(sys.argv)
myapp = AppWindow()
myapp.show()
t = QtCore.QTimer()
t.singleShot(0,myapp.onQApplicationStarted)
sys.exit(app.exec_())
if __name__ == '__main__':
main()
你需要这些活动做什么?你到底想达到什么目的?您是否试图阻止窗口的大小调整?实际上,我正在学习simplecv,试图创建用于图像处理的应用程序。检测一些东西等,即应用程序检测文件夹中的10幅图像。加载时。我想阅读第一张图片并显示它,如果windows调整大小,QSENE和qview需要调整,用于缩放视图等。您需要这些事件做什么?你到底想达到什么目的?您是否试图阻止窗口的大小调整?实际上,我正在学习simplecv,试图创建用于图像处理的应用程序。检测一些东西等,即应用程序检测文件夹中的10幅图像。加载时。我想阅读第一张图片并显示它,如果windows调整大小,QSENE和qview需要调整,用于缩放视图等。您需要这些事件做什么?你到底想达到什么目的?您是否试图阻止窗口的大小调整?实际上,我正在学习simplecv,试图创建用于图像处理的应用程序。检测一些东西等,即应用程序检测文件夹中的10幅图像。加载时。我想阅读第一张图片并显示它,如果windows调整大小,QSENE和qview需要调整,用于缩放视图等。您需要这些事件做什么?你到底想达到什么目的?您是否试图阻止窗口的大小调整?实际上,我正在学习simplecv,试图创建用于图像处理的应用程序。检测一些东西等,即应用程序检测文件夹中的10幅图像。加载时。我想阅读第一张图片并显示它,如果windows调整大小,qscene和qview需要调整,缩放视图等。。