国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python+pyqt實現12306圖片驗證效果

2020-01-04 16:39:43
字體:
來源:轉載
供稿:網友

本文實例為大家分享了python實現12306圖片驗證效果的具體代碼,供大家參考,具體內容如下

思路:在鼠標點擊位置加一個按鈕,然后再按鈕中的點擊事件中寫一個關閉事件.

#coding:utf-8 from PyQt4.QtGui import * from PyQt4.QtCore import * from push_button import * from PIL import Image  class Yanzheng(QWidget):   def __init__(self,parent=None):     super(Yanzheng,self).__init__(parent)     self.m_start_point=0 #x坐標     self.m_end_point=0 #y坐標     self.coordinate=[]     self.codeimage="./img/code.png"     self.connect(self,SIGNAL("addlable"),self.addpic)     self.main_layout=QFormLayout()     self.setLayout(self.main_layout)     self.resize(293,190)     self.pixmap=QPixmap("./img/cur.png")    def addpic(self):     print self.m_start_point,self.m_end_point     xpoint=self.m_start_point     ypoint=self.m_end_point-28     codepng2 = PushButton(self)     codepng2.loadPixmapreal('./img/cur.png')     codepng2.setGeometry(self.m_start_point,self.m_end_point,30,30)     codepng2.show()     #self.emit(SIGNAL("dellabel"),self.codepng2)     self.coordinate.append("%s,%s" %(xpoint,ypoint))     self.connect(codepng2,SIGNAL("clicked()"),lambda:self.dellabel(codepng2,xpoint,ypoint))     #self.update()   #刪除標記   def dellabel(self,q,x,y):     print x,y     self.coordinate.remove("%s,%s" %(x,y))     q.close()    def mousePressEvent(self,event):     if (event.type()==QEvent.MouseButtonPress):       self.m_start_point = event.pos().x()-12       self.m_end_point= event.pos().y()-12       self.emit(SIGNAL("addlable"))     def paintEvent(self, event):     p = QPainter(self)     p.drawPixmap(0,0,QPixmap(self.codeimage))   if __name__=='__main__':   import sys   app=QApplication(sys.argv)   inputurl=Yanzheng()   inputurl.show()   sys.exit(app.exec_()) 

效果圖:

python,pyqt,12306圖片驗證

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 巴楚县| 宁陵县| 上蔡县| 车险| 盱眙县| 新化县| 凉城县| 济阳县| 宝坻区| 灵寿县| 和平县| 会东县| 保亭| 临夏县| 玛纳斯县| 黎城县| 根河市| 嵊泗县| 广平县| 临澧县| 榆社县| 永济市| 曲松县| 高安市| 赫章县| 吴桥县| 新野县| 珠海市| 道孚县| 都兰县| 正定县| 青铜峡市| 普洱| 奎屯市| 礼泉县| 保靖县| 河池市| 海南省| 社旗县| 高密市| 肇源县|