Skip to content

Instantly share code, notes, and snippets.

@vighneshbirodkar
Last active December 19, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vighneshbirodkar/5940548 to your computer and use it in GitHub Desktop.
Save vighneshbirodkar/5940548 to your computer and use it in GitHub Desktop.
Qt code
img = Image('abc.png')
img.show() # should open a new qt window to show the image
#this call should not block, and should reutrn immediately to allow the user to do further image processing
#additional image processing
img.toGray()
img.whatever()
@Exalt-
Copy link

Exalt- commented Jul 6, 2013

!/usr/bin/env python

from PyQt4 import QtGui,QtCore
import sys

class Gui(t):

class Thread(QtCore.QThread):

    def __init__(self):
        super(Gui.Thread, self).__init__()
        self.run()

    def run(self):
        app = QtGui.QApplication(sys.argv)
        window = Gui.Window()
        sys.exit(app.exec_())

    def __del__(self):
        self.wait()

class Window(QtGui.QWidget):

    def __init__(self):
       super(Gui.Window, self).__init__()
       self.resize(800,300)
       self.setWindowTitle("user image")
       self.vbox = QtGui.QVBoxLayout()
       self.setLayout(self.vbox)
       self.show()

    def doImageStuff(self, path):
        img = Image('abc.png')
        img.show() # should open a new qt window to show the image
        #this call should not block, and should reutrn immediately to allow the user to do further image processing
        #additional image processing
        img.toGray()
        img.whatever()

def __init__(self):
    thread = self.Thread()

if name == 'main':
gui = Gui() # something like this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment