[Código-PyQT4] View Source - JaAViEr

Iniciado por JaAViEr, Julio 01, 2011, 04:53:50 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Julio 01, 2011, 04:53:50 AM Ultima modificación: Marzo 23, 2015, 12:03:21 PM por Expermicid
Este código es muy básico por consola, también en QT4
pero en QT4 le da un toque más bonito que en consola :P
Código: python

# -*- coding: utf-8 -*-
import sys, urllib2
from PyQt4 import QtCore, QtGui

class view_source(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self,parent)
        self.resize(466, 407)
        self.vercode = QtGui.QPushButton("View Source",self)
        self.vercode.setGeometry(200, 380, 105, 24)
        self.http_host = QtGui.QLineEdit(self)
        self.http_host.setGeometry(90, 10, 371, 25)
        self.http_host.setEchoMode(QtGui.QLineEdit.Normal)
        self.url = QtGui.QLabel("Host / URL",self)
        self.url.setGeometry(20, 17, 71, 16)
        self.viewcode = QtGui.QLabel("View Source",self)
        self.viewcode.setGeometry(10, 35, 121, 16)
        self.code = QtGui.QPlainTextEdit(self)
        self.code.setGeometry(0, 50, 461, 331)
        self.code.setFrameShadow(QtGui.QFrame.Raised)
        self.setWindowTitle("View Source - JaAViEr")
        self.connect(self.vercode,QtCore.SIGNAL("clicked()"),self.vista_code)
    def vista_code(self):
      pagina=urllib2.urlopen(str(self.http_host.text()))
      self.code.setPlainText(pagina.read())
aplicacion=QtGui.QApplication(sys.argv)
view=view_source()
view.show()
aplicacion.exec_()
Screen:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
esta muy bien,yo hice uno en php,que esta online

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
En PHP sería tambien sencillo con file_get_contents(); :D
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login