今天不写图像处理相关内容,跳一下python这个大坑,谁让人工智能带动下,python这么火呢?本文不写安装教程,网友分享了太多。每次学新内容,我总是习惯从能看得见的部分开始。
1.需要安装这些(x64套装)
python2_X64_2.7.13150.msi (注意安装完后配置电脑环境变量,path中添加:C:\Python27;cmd中输出python验证)
2.pyCharm QtSide简单配置
PySide: 调用Qt界面设计器
PyUCI:可以让.ui 转换成.py
3.一个小demo
__ini__.py :(这个文件相当与于C++项目中的main.cpp)
__author__ = 'winston-pc'
import sys
# Import Qt GUI component
from PySide.QtGui import *
# Import GUI File 导入界面在这里
from untitled1 import Ui_Dialog
# Self Function
def PrintHello():
print("Hello")
# Make main window class
class Dialog(QDialog,Ui_Dialog):
def __init__(self, parent=None):
super(Dialog,self).__init__(parent)
self.setupUi(self)
# Connect button click event to PrintHello function
self.pushButton.clicked.connect(PrintHello)
# End of main window class
# Main Function
if __name__=='__main__':
Program = QApplication(sys.argv)
Window=Dialog()
Window.show()
Program.exec_()
界面文件:(.ui设计后自动生成的)
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled1.ui'
#
# Created: Fri Jul 14 14:02:43 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(400, 300)
self.buttonBox = QtGui.QDialogButtonBox(Dialog)
self.buttonBox.setGeometry(QtCore.QRect(30, 240, 341, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.pushButton = QtGui.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(190, 120, 75, 23))
self.pushButton.setObjectName("pushButton")
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("Dialog", "PushButton", None, QtGui.QApplication.UnicodeUTF8))
囚徒困境,怎么才能突破,要另辟蹊径,还是要深挖到底。
参考文献:
1.http://blog.csdn.net/huangdecai2/article/details/44571667
2.http://www.cnblogs.com/findumars/p/6350068.html
3.http://blog.sina.com.cn/s/blog_62c832270101dca6.html