1. Install Python
2. Install QT Designer or Qt creator
3. Open QT Designer to draw the graphical interface you want
Like this
Save the file and save it in the form of a UI suffix
4. Download and install Pyside
Direct Easy_install or PIP installation may be saved when I install, prompting for MSVC version issue
After viewing many foreign forums, you can choose to download the corresponding Python version of the WHL installation package from the Pyside website, and after the successful download, go to the corresponding directory path, direct pip install *.WHL * for the package name
Installation Successful
5. Convert the previously saved UI suffix file to a py file
Pyside-uic *.ui-o *.py
The conversion is done to see a python code for the QT interface design
#-*-Coding:utf-8-*-
# Form implementation generated from reading UI file ' Test.ui '
#
# Created:mon APR 10 17:35:04 2017
# By:pyside-uic 0.2.15 running on Pyside 1.2.4
#
# warning! All changes made in this file would be lost!
From pyside import Qtcore, Qtgui
Class Ui_frame (object):
def setupui (self, Frame):
Frame.setobjectname ("Frame")
Frame.resize (683, 596)
Frame.setframeshape (QtGui.QFrame.StyledPanel)
Frame.setframeshadow (QtGui.QFrame.Raised)
Self.pushbutton = Qtgui.qpushbutton (Frame)
Self.pushButton.setGeometry (Qtcore.qrect (270, 350, 75, 23))
Self.pushButton.setObjectName ("Pushbutton")
Self.widget = Qtgui.qwidget (Frame)
Self.widget.setGeometry (Qtcore.qrect (40, 390, 541, 171))
Self.widget.setObjectName ("widget")
Self.frame = Qtgui.qframe (frame)
Self.frame.setGeometry (Qtcore.qrect (30, 40, 621, 291))
Self.frame.setFrameShape (QtGui.QFrame.StyledPanel)
Self.frame.setFrameShadow (QtGui.QFrame.Raised)
Self.frame.setObjectName ("Frame")
Self.lineedit = Qtgui.qlineedit (self.frame)
Self.lineEdit.setGeometry (Qtcore.qrect (20, 30, 31, 21))
Self.lineEdit.setObjectName ("LineEdit")
Self.lineedit_2 = Qtgui.qlineedit (self.frame)
Self.lineEdit_2.setGeometry (Qtcore.qrect (120, 30, 301, 21))
Self.lineEdit_2.setObjectName ("Lineedit_2")
Self.commandlinkbutton = Qtgui.qcommandlinkbutton (self.frame)
Self.commandLinkButton.setGeometry (Qtcore.qrect (520, 20, 91, 41))
Self.commandLinkButton.setObjectName ("Commandlinkbutton")
Self.pushbutton_2 = Qtgui.qpushbutton (self.frame)
Self.pushButton_2.setGeometry (Qtcore.qrect (430, 210, 75, 23))
Self.pushButton_2.setObjectName ("Pushbutton_2")
Self.lineedit_3 = Qtgui.qlineedit (self.frame)
Self.lineEdit_3.setGeometry (Qtcore.qrect (10, 70, 113, 20))
Self.lineEdit_3.setObjectName ("Lineedit_3")
Self.lineedit_4 = Qtgui.qlineedit (self.frame)
Self.lineEdit_4.setGeometry (Qtcore.qrect (10, 100, 113, 20))
Self.lineEdit_4.setObjectName ("Lineedit_4")
Self.lineedit_5 = Qtgui.qlineedit (self.frame)
Self.lineEdit_5.setGeometry (Qtcore.qrect (10, 130, 113, 20))
Self.lineEdit_5.setObjectName ("Lineedit_5")
Self.lineedit_6 = Qtgui.qlineedit (self.frame)
Self.lineEdit_6.setGeometry (Qtcore.qrect (10, 160, 113, 20))
Self.lineEdit_6.setObjectName ("Lineedit_6")
self.lineedit_7 = Qtgui.qlineedit (self.frame)
Self.lineEdit_7.setGeometry (Qtcore.qrect (10, 190, 113, 20))
Self.lineEdit_7.setObjectName ("lineedit_7")
Self.lineedit_8 = Qtgui.qlineedit (self.frame)
Self.lineEdit_8.setGeometry (Qtcore.qrect (140, 70, 113, 20))
Self.lineEdit_8.setObjectName ("Lineedit_8")
Self.lineedit_9 = Qtgui.qlineedit (self.frame)
Self.lineEdit_9.setGeometry (Qtcore.qrect (140, 100, 113, 20))
Self.lineEdit_9.setObjectName ("Lineedit_9")
Self.lineedit_10 = Qtgui.qlineedit (self.frame)
Self.lineEdit_10.setGeometry (Qtcore.qrect (140, 160, 113, 20))
Self.lineEdit_10.setObjectName ("Lineedit_10")
Self.lineedit_11 = Qtgui.qlineedit (self.frame)
Self.lineEdit_11.setGeometry (Qtcore.qrect (140, 130, 113, 20))
Self.lineEdit_11.setObjectName ("Lineedit_11")
Self.lineedit_12 = Qtgui.qlineedit (self.frame)
Self.lineEdit_12.setGeometry (Qtcore.qrect (140, 190, 113, 20))
Self.lineEdit_12.setObjectName ("Lineedit_12")
self.label_2 = Qtgui.qlabel (self.frame)
Self.label_2.setGeometry (Qtcore.qrect (20, 10, 54, 12))
Self.label_2.setObjectName ("label_2")
Self.combobox = Qtgui.qcombobox (self.frame)
Self.comboBox.setGeometry (Qtcore.qrect (60, 30, 51, 22))
Self.comboBox.setObjectName ("ComboBox")
Self.comboBox.addItem ("")
Self.comboBox.addItem ("")
Self.comboBox.addItem ("")
Self.comboBox.addItem ("")
Self.combobox_2 = Qtgui.qcombobox (self.frame)
Self.comboBox_2.setGeometry (Qtcore.qrect (450, 30, 51, 22))
Self.comboBox_2.setObjectName ("Combobox_2")
Self.comboBox_2.addItem ("")
Self.comboBox_2.addItem ("")
Self.label = Qtgui.qlabel (Frame)
Self.label.setGeometry (Qtcore.qrect (40, 10, 54, 12))
Self.label.setObjectName ("label")
Self.retranslateui (Frame)
QtCore.QMetaObject.connectSlotsByName (Frame)
def retranslateui (self, Frame):
Frame.setwindowtitle (QtGui.QApplication.translate ("frame", "frame", None, QtGui.QApplication.UnicodeUTF8))
Self.pushButton.setText (QtGui.QApplication.translate ("Frame", "Start", None, QtGui.QApplication.UnicodeUTF8))
Self.lineEdit.setText (QtGui.QApplication.translate ("Frame", "URL", None, QtGui.QApplication.UnicodeUTF8))
Self.lineEdit_2.setText (QtGui.QApplication.translate ("Frame", "http://www.baidu.com", None, QTGUI.QAPPLICATION.UNICODEUTF8))
Self.commandLinkButton.setText (QtGui.QApplication.translate ("Frame", "Check", None, QTGUI.QAPPLICATION.UNICODEUTF8))
Self.pushButton_2.setText (QtGui.QApplication.translate ("Frame", "Select File", None, QtGui.QApplication.UnicodeUTF8))
Self.label_2.setText (QtGui.QApplication.translate ("Frame", "parameter", None, QtGui.QApplication.UnicodeUTF8))
Self.comboBox.setItemText (0, QtGui.QApplication.translate ("Frame", "get", None, QtGui.QApplication.UnicodeUTF8))
Self.comboBox.setItemText (1, QtGui.QApplication.translate ("Frame", "post", None, QtGui.QApplication.UnicodeUTF8))
Self.comboBox.setItemText (2, QtGui.QApplication.translate ("Frame", "Head", None, QtGui.QApplication.UnicodeUTF8))
Self.comboBox.setItemText (3, QtGui.QApplication.translate ("Frame", "delete", None, QtGui.QApplication.UnicodeUTF8) )
Self.comboBox_2.setItemText (0, QtGui.QApplication.translate ("Frame", "true", None, QtGui.QApplication.UnicodeUTF8) )
Self.comboBox_2.setItemText (1, QtGui.QApplication.translate ("Frame", "false", None, QtGui.QApplication.UnicodeUTF8 ))
Self.label.setText (QtGui.QApplication.translate ("Frame", "Interface Debug", None, QtGui.QApplication.UnicodeUTF8))
6, write the program to add functionality to the above code
#-*-Coding:utf-8-*-
Import Sys,socket,requests,urllib,urllib2
Import Re,json
From Urlparse import Urlparse
# Import Qt GUI Component
From Pyside.qtgui Import *
# Import GUI File
From HTTP import ui_frame
Class Frame (Qframe,ui_frame):
def __init__ (Self,parent=none):
Super (Frame,self). __init__ (parent)
Self.setupui (self)
Self.pushButton.clicked.connect (self.cc)
Self.commandLinkButton.clicked.connect (Self.check)
Self.pushButton_3.clicked.connect (Self.clear)
Self.pushButton_2.clicked.connect (SELF.CLEARARGV)
def cc (self):
Url=self.lineedit_2.text ()
Method_txt=self.combobox.currenttext ()
Varify_txt=self.combobox_2.currenttext ()
If varify_txt== ' true ':
Varify=true
Else
Varify=false
If method_txt== ' get ':
Method=requests.get
Elif method_txt== ' post ':
Method=requests.post
Elif method_txt== ' head ':
Method=requests.head
Else
Method=requests.delete
Argv1=self.lineedit_3.text ()
Argv2=self.lineedit_8.text ()
Argv3 = Self.lineEdit_4.text ()
ARGV4 = Self.lineEdit_9.text ()
ARGV5 = Self.lineEdit_5.text ()
ARGV6 = Self.lineEdit_10.text ()
ARGV7 = Self.lineEdit_6.text ()
ARGV8 = Self.lineEdit_11.text ()
ARGV9 = Self.lineEdit_7.text ()
ARGV10 = Self.lineEdit_12.text ()
payload={
Argv1:argv2,
ARGV3:ARGV4,
ARGV5:ARGV6,
ARGV7:ARGV8,
ARGV9:ARGV10,
}
Try
R=method (url,data=payload,verify=varify)
Except
Print "Something Wrong"
T=str (r.text) + ' \ n ' + str (r.headers)
Self.lineEdit_13.setText (t)
Print Url,method_txt,r.text,payload,varify
def check (self):
A = Self.lineEdit_2.text ()
Tophostpostfix = (
'. com ', '. La ', '. Io ', '. Co ', '. Info ', '. Net ', '. org ', '. Me ', '. mobi ',
'. us ', '. Biz ', '. xxx ', '. Ca ', '. co.jp ', '. com.cn ', '. net.cn ',
'. org.cn ', '. mx ', '. tv ', '. ws ', '. Ag ', '. Com.ag ', '. Net.ag ',
'. Org.ag ', '. am ', '. Asia ', '. at ', '. is ', '. com.br ', '. net.br ',
'. Bz ', '. com.bz ', '. net.bz ', '. CC ', '. com.co ', '. net.co ',
'. nom.co ', '. de ', '. Es ', '. com.es ', '. nom.es ', '. org.es ',
'. EU ', '. FM ', '. Fr ', '. GS ', '. In ', '. co.in ', '. firm.in ', '. Gen.in ',
'. Ind.in ', '. net.in ', '. org.in ', '. it ', '. Jobs ', '. JP ', '. Ms ',
'. Com.mx ', '. nl ', '. Nu ', '. co.nz ', '. net.nz ', '. org.nz ',
'. Se ', '. TC ', '. tk ', '. tw ', '. com.tw ', '. idv.tw ', '. org.tw ',
'. HK ', '. co.uk ', '. me.uk ', '. org.uk ', '. VG ', '. com.hk ')
REGX = R ' [^\.] + (' + ' | '). Join ([H.replace ('. ', R ' \. ') for h in Tophostpostfix]) + ') $ '
Pattern = Re.compile (regx, re. IGNORECASE)
Print "--" * 40
Parts = Urlparse (a)
Host = Parts.netloc
m = Pattern.search (host)
res = M.group () if M else host
Print "Unkown" if not res else res
Ip=socket.gethostbyname (host)
Self.lineEdit_13.setText (IP)
Print IP
def clear (self):
Self.lineEdit_13.clear ()
def clearargv (self):
Self.lineEdit_3.clear ()
Self.lineEdit_4.clear ()
Self.lineEdit_5.clear ()
Self.lineEdit_6.clear ()
Self.lineEdit_7.clear ()
Self.lineEdit_8.clear ()
Self.lineEdit_9.clear ()
Self.lineEdit_10.clear ()
Self.lineEdit_11.clear ()
Self.lineEdit_12.clear ()
If __name__== ' __main__ ':
program = Qapplication (SYS.ARGV)
Window=frame ()
Window.show ()
PROGRAM.EXEC_ ()
7. Package the above program into EXE
Using Pyinstaller
Copy the 6th step code file to the Pyinstaller directory
Execute Python pyinstaller.py-d-W *.py
--d the meaning of the build directory, generate EXE and some dependent files
-W No console
PYTHON+QT Designer to do graphical interface EXE program