Advertisement
Guest User

PySide QPixmap.fromImage memory leak test

a guest
Mar 18th, 2011
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. import sys
  2. from PySide import QtCore
  3. from PySide import QtGui
  4.  
  5. class View(QtGui.QMainWindow):
  6.     def __init__(self):
  7.         super(View, self).__init__()
  8.         self.setFixedSize( QtCore.QSize(720, 480) )
  9.         self.lbl = QtGui.QLabel(self)
  10.         self.lbl.setGeometry(0, 0, 720, 480)
  11.  
  12.         self.timer = QtCore.QTimer(self)
  13.         self.timer.timeout.connect(self.onTimeout)
  14.         self.timer.start(100)
  15.  
  16.     def onTimeout(self):
  17.         pxmp = QtGui.QPixmap.fromImage(QtGui.QImage('tiger.png'))
  18.         self.lbl.setPixmap(pxmp)
  19.  
  20. class TestApp:
  21.     def __init__(self):
  22.         self.qApp = QtGui.QApplication(['Test App'])
  23.         self.view = View()
  24.         self.view.show()
  25.  
  26.     def run(self):
  27.         sys.exit( self.qApp.exec_() )
  28.  
  29. if __name__=='__main__':
  30.     app = TestApp()
  31.     app.run()
  32. ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement