python程序打完后怎么保存_如何保存要在之后使用的值应用程序执行()在python中退出?...
我想保存/存儲在中創建的鼠標事件值應用程序執行()因為它在運行。我想使用下面的代碼,我從一個帖子,我現在有困難找到(將更新與該代碼來自的帖子鏈接,一旦我找到它。)import sys
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import numpy as np
class DrawImage(QMainWindow):
def __init__(self,fName, parent=None):
## Default values
self.x = 0
self.y = 0
super(QMainWindow, self).__init__(parent)
self.setWindowTitle('Select Window')
self.local_image = QImage(fName)
self.local_grview = QGraphicsView()
self.setCentralWidget( self.local_grview )
self.local_scene = QGraphicsScene()
self.image_format = self.local_image.format()
#self.pixMapItem = self.local_scene.addPixmap( QPixmap(self.local_image) )
self.pixMapItem = QGraphicsPixmapItem(QPixmap(self.local_image), None, self.local_scene)
self.local_grview.setScene( self.local_scene )
self.pixMapItem.mousePressEvent = self.pixelSelect
def pixelSelect( self, event ):
# print(event.pos().x(), event.pos().y())
self.x = event.pos().x()
self.y = event.pos().y()
print(self.x, self.y)
def main():
# Initialize
fName = "N2-600-PSI-V1-40-30ms-1.tiff"
app = QtGui.QApplication(sys.argv)
form = DrawImage(fName)
form.show()
app.exec_()
x,y = app.exec_()
print(x,y)
return
if __name__ == '__main__':
main()
我的第一次嘗試是創建兩個全局變量,然后在pixelSelect函數中使用它們來保存事件.pos().x()和()y
不過,這是有效的。。。最終我想傳遞的不僅僅是一組坐標應用程序執行()循環…(進程??它是一只奇怪的野獸)
我試著從這個數組中傳入幾個不同的方法應用程序執行()以保存更多值。到目前為止,我得到的最好的結果是使用全局數組并嘗試在DrawImage類中執行for循環。在
任何建議都很好:)
祝你玩得開心!在
總結
以上是生活随笔為你收集整理的python程序打完后怎么保存_如何保存要在之后使用的值应用程序执行()在python中退出?...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python 字典程序_Python 字
- 下一篇: c语言和java和汇编语言_C语言和汇编