专栏首页python3python程序界面

python程序界面

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

# Form implementation generated from reading ui file 'Main.ui'
#
# Created: Thu Jan 29 16:25:31 2015
#      by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui
import sys,time

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_Dialog(QtGui.QDialog):
    def __init__(self):
        super(Ui_Dialog, self).__init__()
       
        self.setupUi(self)
        self.retranslateUi(self)
        self.flag0=True
        self.flag1=True
        timer=QtCore.QTimer(self)  
        QtCore.QObject.connect(timer,QtCore.SIGNAL("timeout()"),self.ScanCodeChange)
        timer.start(8000)  
        
        bannertimer=QtCore.QTimer(self)  
        QtCore.QObject.connect(bannertimer,QtCore.SIGNAL("timeout()"),self.BannerChange)
        bannertimer.start(5000)         
        
    #This is the scanCodePic changed operation.
    def ScanCodeChange(self):       
        if self.flag0==True:
            self.label_2.setPixmap(QtGui.QPixmap(_fromUtf8("D:/ADPic/scan01.jpg")))
            self.flag0=False
        else:
            self.label_2.setPixmap(QtGui.QPixmap(_fromUtf8("D:/ADPic/scan02.jpg")))
            self.flag0=True
            
    #This is the BannerPic changed operation.
    def BannerChange(self):       
        if self.flag1==True:
            self.label.setPixmap(QtGui.QPixmap(_fromUtf8("D:/ADPic/bank01.jpg")))
            self.flag1=False
        else:
            self.label.setPixmap(QtGui.QPixmap(_fromUtf8("D:/ADPic/bank02.jpg")))
            self.flag1=True     
            
    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(1000, 1000)
        Dialog.setAutoFillBackground(True)
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(0, 0, 1500, 600))
        self.label.setText(_fromUtf8(""))
        self.label.setPixmap(QtGui.QPixmap(_fromUtf8("D:/ADPic/bank01.jpg")))
        self.label.setScaledContents(True)
        self.label.setObjectName(_fromUtf8("label"))
        self.textBrowser = QtGui.QTextBrowser(Dialog)
        self.textBrowser.setGeometry(QtCore.QRect(0, 600, 600,500))
        self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
        #self.widget = QtGui.QWidget(Dialog)
        #self.widget.setGeometry(QtCore.QRect(399, 389, 371, 191))
        #self.widget.setObjectName(_fromUtf8("widget"))
        self.label_2 = QtGui.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(600, 600, 850, 300))
        self.label_2.setText(_fromUtf8(""))
        self.label_2.setPixmap(QtGui.QPixmap(_fromUtf8("D:/ADPic/scan01.jpg")))
        self.label_2.setScaledContents(True)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        
    def retranslateUi(self, Dialog):
        self.textBrowser.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:18pt; font-weight:600;\">说明:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:18pt; font-weight:600;\">1.请按回车键输入手机接收到的验证码。</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:18pt; font-weight:600;\">2.输入时请您仔细核实,按回车键进行输入,按ESC键进行退出。</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:18pt; font-weight:600;\">3.输入完成后按回车键进行奖品领取。</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", None))
      
    def keyPressEvent(self, event):      
        if event.key() == QtCore.Qt.Key_Return:
            dialog=CheckUi_dialog()
            dialog.show()
            dialog.setModal(False)
           
            dialog.exec_()
            #print 'showcheckdialog'
        else:
            #when the normal screen works it need to display(to avoid esc)!
            QtGui.QDialog.keyPressEvent(self, event)            
            
            
class CheckUi_dialog(QtGui.QDialog):
    def __init__(self):
        super(CheckUi_dialog, self).__init__() 
        self.checksetupUi(self)
        self.checkretranslateUi(self)
     
    def checksetupUi(self, dialog):
        dialog.setObjectName(_fromUtf8("dialog"))
        dialog.resize(456, 218)
        self.pushButton_2 = QtGui.QPushButton(dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(300, 150, 111, 41))
        self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
        self.pushButton = QtGui.QPushButton(dialog)
        self.pushButton.setGeometry(QtCore.QRect(60, 150, 111, 41))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.label = QtGui.QLabel(dialog)
        self.label.setGeometry(QtCore.QRect(20, 70, 101, 31))
        self.label.setObjectName(_fromUtf8("label"))
        self.textEdit = QtGui.QLineEdit(dialog)
        self.textEdit.setGeometry(QtCore.QRect(130, 70, 291, 31))
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.textEdit.setFocus()
        QtCore.QObject.connect(self.textEdit, QtCore.SIGNAL("returnPressed()"), self.text)
        self.checkretranslateUi(dialog)         
        QtCore.QMetaObject.connectSlotsByName(dialog)
        dialog.setTabOrder(self.pushButton, self.pushButton_2) 
    def text(self):  
        if not self.textEdit.text():
            QtGui.QMessageBox.about(self,(_fromUtf8("提示!")), (_fromUtf8("请输入验证码!")))
        else:
            if (int(self.textEdit.text())==5):
                #print 'codesuccess'
                QtGui.QMessageBox.about(self,(_fromUtf8("恭喜您!")), (_fromUtf8("恭喜您,您的验证码通过,请您及时领取奖品!")))
            else:
                QtGui.QMessageBox.about(self,(_fromUtf8("很抱歉!")), (_fromUtf8("很抱歉,您的验证码输入不正确,请您再次验证核实")))
                #print 'codefailed'
    def checkretranslateUi(self, dialog):
        dialog.setWindowTitle(_translate("dialog", "输入验证码", None))
        self.pushButton_2.setText(_translate("dialog", "取 消", None))
        self.pushButton.setText(_translate("dialog", "确 定", None))
        self.label.setText(_translate("dialog", "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600;\">输入验证码:</span></p></body></html>", None))

      
                   

    
if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    win = Ui_Dialog()
    #win.show()
    win.showFullScreen()
    sys.exit(app.exec_())
#import 001_rc

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 数据结构之——Python实现循环队列

    栈是先入后出,与之相反的是队列,队列是先进先出的线性结构。队列是只允许在一端进行插入操作,而在另一端进行删除操作的线性表。允许插入的一端称为队尾,允许删除的一端...

    py3study
  • Python操作Mysql数据库的实现

    1、需要使用的模块MySQLdb,下载地址为:http://sourceforge.net/projects/mysql-python/

    py3study
  • PyQt5--QLineEdit

    py3study
  • 数据结构之——Python实现循环队列

    栈是先入后出,与之相反的是队列,队列是先进先出的线性结构。队列是只允许在一端进行插入操作,而在另一端进行删除操作的线性表。允许插入的一端称为队尾,允许删除的一端...

    py3study
  • TensorFlow应用实战-17-Qlearning实现迷宫小游戏

    总共有12个状态,s1到s12.对于每一个状态会有四个动作。对于每个状态下的每个动作会有一个Q的值。

    用户1332428
  • python高级编程第二讲:类与对象深度问题与解决技巧

    将上面的代码我们进行改造,引入内存跟踪的类,并且将2个类分别实例化100000次,并打印相应的内存大小

    小海怪的互联网
  • python模块:win32com用法详解

    import win32com from win32com.client import Dispatch, constants

    菲宇
  • pygame-KidsCanCode系列jumpy-part2-加速度与摩擦力

    上一节,我们整理了一个游戏开发的新框架(即:Game类),本节将运用这个框架,实现基本的加速度及摩托力效果。

    菩提树下的杨过
  • Python Data Model

    概述 最近在看《Fluent Python》一书,书中解释了Python很多重要的设计理念和实践,下面是我在看此书的读书笔记。Python的设计思想主要体现在它...

    BrianLv
  • (二)中文文本分类--机器学习算法原理与编程实践 - 简书

    本章知识点:中文分词,向量空间模型,TF-IDF方法,文本分类算法和评价指标 使用的算法:朴素的贝叶斯算法,KNN最近邻算法 python库:jieba分词,S...

    会呼吸的Coder

扫码关注云+社区

领取腾讯云代金券