ERIC+PYQT+PYTHON范例

# -*- coding: utf-8 -*-

"""
Module implementing picdownload.
"""

from PyQt4.QtGui import QDialog
from PyQt4.QtCore import pyqtSignature
import PyQt4, PyQt4.QtGui, sys , urllib2
from bs4 import BeautifulSoup

from Ui_dlghello import Ui_picdown

def Geturl(url):
        text=urllib2.urlopen(url).read()
        context = BeautifulSoup(text)
        result=context.findAll('img')
        print result

class picdownload(QDialog, Ui_picdown):
    """
    Class documentation goes here.
    """
    def __init__(self, parent = None):
        """
        Constructor
        """
        QDialog.__init__(self, parent)
        self.setupUi(self)
     
    @pyqtSignature("")
    def on_searchbnt_clicked(self):
        s='http://www.qq.com/'
        dsa=Geturl(s)
         
        # TODO: not implemented yet
        #raise NotImplementedError
if __name__ == "__main__": 
    app = PyQt4.QtGui.QApplication(sys.argv)
    dlg = picdownload() 
    dlg.show() 
    sys.exit(app.exec_())

你可能感兴趣的:(python,PyQt,Eric)