wxpython从入门到精通
Posted 别说话,吻我!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wxpython从入门到精通相关的知识,希望对你有一定的参考价值。
#1、这里只写了python GUI 交互页面的代码,页面调用的方法另外写的
#2、使用都比较简单,直接看注释就能看明白的,不明白的可以留言,一起学习
# -*- coding: utf-8 -*-
import wx
import wx.xrc
from realName import public
from dFraud import delFraud
from quxiaojiekuan import quxiaojiekuan
from loan import loan
class MyFrame1 (wx.Frame):
def __init__( self, parent ):
self.fraud=delFraud() #类初始化
self.realname=public() #类初始化
self.quxiaojiekuan=quxiaojiekuan() #类初始化
self.loan=loan()
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 990,516 ), style = wx.DEFAULT_FRAME_STYLE^(wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX) )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
gbSizer1 = wx.GridBagSizer( 0, 0 )
gbSizer1.SetFlexibleDirection( wx.BOTH )
gbSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
#下面是控件
self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText1.Wrap( -1 )
gbSizer1.Add( self.m_staticText1, wx.GBPosition( 6, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl1 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl1, wx.GBPosition( 6, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"类型", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText2.Wrap( -1 )
gbSizer1.Add( self.m_staticText2, wx.GBPosition( 6, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
m_choice4Choices = [ u" 加密 ", u" 解密 " ]
self.m_choice4 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice4Choices, 0 )
self.m_choice4.SetSelection( 0 )
gbSizer1.Add( self.m_choice4, wx.GBPosition( 6, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText19 = wx.StaticText( self, wx.ID_ANY, u"加解密后", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText19.Wrap( -1 )
gbSizer1.Add( self.m_staticText19, wx.GBPosition( 6, 4 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl27 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 150,-1 ), 0 )
gbSizer1.Add( self.m_textCtrl27, wx.GBPosition( 6, 5 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button1 = wx.Button( self, wx.ID_ANY, u"加密/解密", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button1, wx.GBPosition( 6, 6 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText9.Wrap( -1 )
gbSizer1.Add( self.m_staticText9, wx.GBPosition( 0, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl17 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl17, wx.GBPosition( 0, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText10 = wx.StaticText( self, wx.ID_ANY, u"查询结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText10.Wrap( -1 )
gbSizer1.Add( self.m_staticText10, wx.GBPosition( 0, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl18 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl18, wx.GBPosition( 0, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button18 = wx.Button( self, wx.ID_ANY, u"手机号可用?", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button18, wx.GBPosition( 0, 4 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText11 = wx.StaticText( self, wx.ID_ANY, u"身份证", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText11.Wrap( -1 )
gbSizer1.Add( self.m_staticText11, wx.GBPosition( 1, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl19 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl19, wx.GBPosition( 1, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText12 = wx.StaticText( self, wx.ID_ANY, u"查询结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText12.Wrap( -1 )
gbSizer1.Add( self.m_staticText12, wx.GBPosition( 1, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl20 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl20, wx.GBPosition( 1, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button19 = wx.Button( self, wx.ID_ANY, u"身份证可用?", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button19, wx.GBPosition( 1, 4 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText192 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText192.Wrap( -1 )
gbSizer1.Add( self.m_staticText192, wx.GBPosition( 2, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl191 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl191, wx.GBPosition( 2, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText201 = wx.StaticText( self, wx.ID_ANY, u"注册结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText201.Wrap( -1 )
gbSizer1.Add( self.m_staticText201, wx.GBPosition( 2, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl201 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl201, wx.GBPosition( 2, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button81 = wx.Button( self, wx.ID_ANY, u"一键注册", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button81, wx.GBPosition( 2, 4 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText171 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText171.Wrap( -1 )
gbSizer1.Add( self.m_staticText171, wx.GBPosition( 3, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl171 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl171, wx.GBPosition( 3, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText191 = wx.StaticText( self, wx.ID_ANY, u"查询结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText191.Wrap( -1 )
gbSizer1.Add( self.m_staticText191, wx.GBPosition( 3, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl181 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl181, wx.GBPosition( 3, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button8 = wx.Button( self, wx.ID_ANY, u"获取user_id", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button8, wx.GBPosition( 3, 4 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText13 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText13.Wrap( -1 )
gbSizer1.Add( self.m_staticText13, wx.GBPosition( 7, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl21 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl21, wx.GBPosition( 7, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText14 = wx.StaticText( self, wx.ID_ANY, u"密码", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText14.Wrap( -1 )
gbSizer1.Add( self.m_staticText14, wx.GBPosition( 7, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl22 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl22, wx.GBPosition( 7, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText20 = wx.StaticText( self, wx.ID_ANY, u"执行结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText20.Wrap( -1 )
gbSizer1.Add( self.m_staticText20, wx.GBPosition( 7, 4 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl28 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 150,-1 ), 0 )
gbSizer1.Add( self.m_textCtrl28, wx.GBPosition( 7, 5 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button21 = wx.Button( self, wx.ID_ANY, u"删除反欺诈", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button21, wx.GBPosition( 7, 6 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText16 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText16.Wrap( -1 )
gbSizer1.Add( self.m_staticText16, wx.GBPosition( 8, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl24 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl24, wx.GBPosition( 8, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText17 = wx.StaticText( self, wx.ID_ANY, u"姓名", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText17.Wrap( -1 )
gbSizer1.Add( self.m_staticText17, wx.GBPosition( 8, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl25 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl25, wx.GBPosition( 8, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText18 = wx.StaticText( self, wx.ID_ANY, u"身份证号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText18.Wrap( -1 )
gbSizer1.Add( self.m_staticText18, wx.GBPosition( 8, 4 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )
self.m_textCtrl26 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 150,-1 ), 0 )
gbSizer1.Add( self.m_textCtrl26, wx.GBPosition( 8, 5 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button22 = wx.Button( self, wx.ID_ANY, u"实名认证", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button22, wx.GBPosition( 8, 9 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button40 = wx.Button( self, wx.ID_ANY, u"发布借款", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button40, wx.GBPosition( 12, 9 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText47 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText47.Wrap( -1 )
gbSizer1.Add( self.m_staticText47, wx.GBPosition( 11, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl47 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl47, wx.GBPosition( 11, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText48 = wx.StaticText( self, wx.ID_ANY, u" 密码", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText48.Wrap( -1 )
gbSizer1.Add( self.m_staticText48, wx.GBPosition( 11, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl48 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl48, wx.GBPosition( 11, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText49 = wx.StaticText( self, wx.ID_ANY, u" 借款类型", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText49.Wrap( -1 )
gbSizer1.Add( self.m_staticText49, wx.GBPosition( 11, 4 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
m_choice1Choices = [ u"社保贷", u"信用卡贷", u"小易贷" ]
self.m_choice1 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 150,-1 ), m_choice1Choices, 0 )
self.m_choice1.SetSelection( 0 )
gbSizer1.Add( self.m_choice1, wx.GBPosition( 11, 5 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText51 = wx.StaticText( self, wx.ID_ANY, u" 借款期限", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText51.Wrap( -1 )
gbSizer1.Add( self.m_staticText51, wx.GBPosition( 11, 6 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
m_choice2Choices = [ u"1",u"3", u"6", u"12" ]
self.m_choice2 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 150,-1 ), m_choice2Choices, 0 )
self.m_choice2.SetSelection( 0 )
gbSizer1.Add( self.m_choice2, wx.GBPosition( 11, 7 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText79 = wx.StaticText( self, wx.ID_ANY, u"金额", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText79.Wrap( -1 )
gbSizer1.Add( self.m_staticText79, wx.GBPosition( 12, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl74 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl74, wx.GBPosition( 12, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText80 = wx.StaticText( self, wx.ID_ANY, u"红包类型", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText80.Wrap( -1 )
gbSizer1.Add( self.m_staticText80, wx.GBPosition( 12, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
m_choice6Choices = [ u"不使用红包", u"借款返现红包", u"借款利率折扣卡" ]
self.m_choice6 = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice6Choices, 0 )
self.m_choice6.SetSelection( 0 )
gbSizer1.Add( self.m_choice6, wx.GBPosition( 12, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, u" 借款红包ID", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText81.Wrap( -1 )
gbSizer1.Add( self.m_staticText81, wx.GBPosition( 12, 4 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl76 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 150,-1 ), 0 )
gbSizer1.Add( self.m_textCtrl76, wx.GBPosition( 12, 5 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText113 = wx.StaticText( self, wx.ID_ANY, u" 执行结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText113.Wrap( -1 )
gbSizer1.Add( self.m_staticText113, wx.GBPosition( 12, 6 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_textCtrl104 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 150,-1 ), 0 )
gbSizer1.Add( self.m_textCtrl104, wx.GBPosition( 12, 7 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText21 = wx.StaticText( self, wx.ID_ANY, u"实名认证结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText21.Wrap( -1 )
gbSizer1.Add( self.m_staticText21, wx.GBPosition( 8, 6 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl30 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 150,-1 ), 0 )
gbSizer1.Add( self.m_textCtrl30, wx.GBPosition( 8, 7 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText15 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText15.Wrap( -1 )
gbSizer1.Add( self.m_staticText15, wx.GBPosition( 4, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl15 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl15, wx.GBPosition( 4, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText161 = wx.StaticText( self, wx.ID_ANY, u"执行结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText161.Wrap( -1 )
gbSizer1.Add( self.m_staticText161, wx.GBPosition( 4, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl16 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl16, wx.GBPosition( 4, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button6 = wx.Button( self, wx.ID_ANY, u"保/营/卡状态", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button6, wx.GBPosition( 4, 4 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText211 = wx.StaticText( self, wx.ID_ANY, u"手机号", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText211.Wrap( -1 )
gbSizer1.Add( self.m_staticText211, wx.GBPosition( 5, 0 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl211 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl211, wx.GBPosition( 5, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText22 = wx.StaticText( self, wx.ID_ANY, u" 密码", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText22.Wrap( -1 )
gbSizer1.Add( self.m_staticText22, wx.GBPosition( 5, 2 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl221 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_textCtrl221, wx.GBPosition( 5, 3 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_staticText23 = wx.StaticText( self, wx.ID_ANY, u" 执行结果", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText23.Wrap( -1 )
gbSizer1.Add( self.m_staticText23, wx.GBPosition( 5, 4 ), wx.GBSpan( 1, 1 ), wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.m_textCtrl23 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 150,-1 ), 0 )
gbSizer1.Add( self.m_textCtrl23, wx.GBPosition( 5, 5 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button9 = wx.Button( self, wx.ID_ANY, u"取消借款", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer1.Add( self.m_button9, wx.GBPosition( 5, 6 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.SetSizer( gbSizer1 )
self.Layout()
self.Centre( wx.BOTH )
#给按钮绑定事件处理器
self.Bind(event=wx.EVT_BUTTON,handler=self.button1,source=self.m_button1) #加解密按钮绑定 handler绑定方法 source绑定按钮
self.Bind(event=wx.EVT_BUTTON,handler=self.button18,source=self.m_button18) #手机号是否注册
self.Bind(event=wx.EVT_BUTTON,handler=self.button19,source=self.m_button19) #身份证是否注册
self.Bind(event=wx.EVT_BUTTON,handler=self.getUserId,source=self.m_button8) #获取userId
self.Bind(event=wx.EVT_BUTTON,handler=self.button21,source=self.m_button21) #删除反欺诈
self.Bind(event=wx.EVT_BUTTON,handler=self.button22,source=self.m_button22) #实名认证
self.Bind(event=wx.EVT_BUTTON,handler=self.button6,source=self.m_button6) #插入/更新运营商,社保信息
self.Bind(event=wx.EVT_BUTTON,handler=self.button9,source=self.m_button9) #取消借款
self.Bind(event=wx.EVT_BUTTON,handler=self.button81,source=self.m_button81) #一键注册
self.Bind(event=wx.EVT_BUTTON,handler=self.button40,source=self.m_button40) #发布借款
#加解密
def button1(self,event):
try:
mobileNo = self.m_textCtrl1.GetValue() #获取文本框,获取手机号
typeNo = self.m_choice4.GetCurrentSelection() #拿到加解密类型
typeno=typeNo
print(‘加密类型:‘,typeno,type(typeno))
if mobileNo==‘‘:
self.m_textCtrl27.SetValue(u‘手机号/类型不能为空‘) #赋值
elif mobileNo !=‘‘:
if typeno ==0:
typeNum =1 #加密
self.m_textCtrl27.Clear() #清空结果展示框
showData =self.fraud.encrypt(phone=mobileNo,typeNum=typeNum)
self.m_textCtrl27.SetValue(value=showData) #赋值结果展示框
return 0
else:
typeNum =2 #解密
self.m_textCtrl27.Clear() #清空结果展示框
showData =self.fraud.encrypt(phone=mobileNo,typeNum=typeNum)
self.m_textCtrl27.SetValue(value=showData) #赋值结果展示框
return 0
except Exception as e:
print("button1执行失败原因:",e)
#手机号查询是否注册
def button18(self,event):
try:
mobileNo=self.m_textCtrl17.GetValue()
#判断输入是否是11位数字
if mobileNo.isdigit()==True and len(mobileNo)==11:
if mobileNo==‘‘:
self.m_textCtrl18.Clear()
self.m_textCtrl17.SetValue(u‘手机号不能为空‘)
else:
resultNo=self.fraud.getMobileNo(mobile=mobileNo)
if resultNo !=0:
self.m_textCtrl18.Clear()
self.m_textCtrl18.SetValue(u‘手机号已注册‘)
elif resultNo==0:
self.m_textCtrl18.Clear()
self.m_textCtrl18.SetValue(u‘手机号可用‘)
return 0
else:
self.m_textCtrl18.Clear()
self.m_textCtrl18.SetValue(u‘请输入11位手机号‘)
#self.m_textCtrl18.Clear()
except Exception as e:
print("button18执行失败原因:",e)
#身份证是否注册
def button19(self,event):
try:
cardNo=self.m_textCtrl19.GetValue()
if cardNo == ‘‘:
self.m_textCtrl20.Clear()
self.m_textCtrl20.SetValue(u‘身份号不能为空‘)
else:
cardNo17=cardNo[0:17]
cardNo18=cardNo[-1]
#判断身份证1--17位是数字,最后一位必须是大写X
if len(cardNo)==18 and cardNo17.isdigit()==True and cardNo18.isdigit()==True or cardNo18==‘X‘:
resultNo=self.fraud.getIdCard(card=cardNo)
if resultNo !=0:
self.m_textCtrl20.Clear()
self.m_textCtrl20.SetValue(u‘身份证已注册‘)
else:
self.m_textCtrl20.Clear()
self.m_textCtrl20.SetValue(u‘身份证可用‘)
else:
self.m_textCtrl20.Clear()
self.m_textCtrl19.SetValue(u‘身份证输入有误‘)
except Exception as e:
print("button19失败原因:",e)
#手机号获取userId
def getUserId(self,event):
try:
mobile=self.m_textCtrl171.GetValue()
if mobile==‘‘:
self.m_textCtrl181.SetValue(u‘手机号不能为空‘)
elif mobile.isdigit()==True and len(mobile)==11:
userId=self.fraud.getUserId(mobile=mobile)
self.m_textCtrl181.SetValue(userId)
else:
self.m_textCtrl181.SetValue(u‘手机号输入有误‘)
return 0
except Exception as e :
print("getUserId执行失败原因:",e)
#删除反欺诈
def button21(self,event):
try:
mobile=self.m_textCtrl21.GetValue()
passwd=self.m_textCtrl22.GetValue()
if mobile == ‘‘ or passwd==‘‘:
self.m_textCtrl28.Clear()
self.m_textCtrl28.SetValue(u‘手机号/密码不能为空‘)
elif len(mobile)==11 and mobile.isdigit()==True and passwd.isalnum()==True:
resultNo=self.fraud.delFraud(mobileNo=mobile,passwd=passwd)
if resultNo==0:
self.m_textCtrl28.Clear()
self.m_textCtrl28.SetValue(u‘删除反欺诈数据成功‘)
else:
self.m_textCtrl28.Clear()
self.m_textCtrl28.SetValue(u‘哇靠,执行报错了‘)
else:
self.m_textCtrl28.Clear()
self.m_textCtrl28.SetValue(u‘手机号或密码输入有误‘)
except Exception as e:
print("button21失败原因:",e)
#实名认证
def button22(self,event):
try:
mobile=self.m_textCtrl24.GetValue()
uname=self.m_textCtrl25.GetValue()
card=self.m_textCtrl26.GetValue()
if mobile ==‘‘ or uname ==‘‘or card ==‘‘:
self.m_textCtrl30.SetValue(u‘手机号/姓名/身份证不能为空‘)
else:
card17=card[0:17]
card18=card[-1]
if len(mobile)==11 and len(card)==18 and card17.isdigit()==True and card18.isdigit()==True or card18==‘X‘:
resultData=self.realname.userData(mobile=mobile,cardNo=card,realName=uname)
if resultData==0:
self.m_textCtrl30.SetValue(u‘实名认证成功‘)
else:
self.m_textCtrl30.SetValue(u‘哇靠,执行报错了‘)
else:
self.m_textCtrl30.SetValue(u‘手机号/身份证输入有误‘)
except Exception as e:
print("button22执行失败原因:",e)
#运营商状态
def button6(self,event):
try:
mobile=self.m_textCtrl15.GetValue()
if mobile ==‘‘:
self.m_textCtrl16.SetValue(u‘手机号不能为空‘)
elif len(mobile)==11 and mobile.isdigit()==True:
resultData=self.realname.updateOperators(mobile=mobile)
if resultData == 0:
self.m_textCtrl16.SetValue(u‘执行成功‘)
else:
self.m_textCtrl16.SetValue(u‘哇靠,执行出错了‘)
else:
self.m_textCtrl16.SetValue(u‘手机号输入有误‘)
except Exception as e:
print("button6执行失败原因:",e)
#循环取消借款
def button9(self,event):
try:
mobile=self.m_textCtrl211.GetValue()
pwd=self.m_textCtrl221.GetValue()
if mobile ==‘‘:
self.m_textCtrl211.SetValue(u‘手机号不能为空‘)
if pwd ==‘‘:
self.m_textCtrl221.SetValue(u‘密码不能为空‘)
elif len(mobile)==11 and mobile.isdigit()==True and pwd !=‘‘:
resultData=self.quxiaojiekuan.xunhuan(mobile=mobile,pwd=pwd)
if resultData == 0:
self.m_textCtrl23.SetValue(u‘取消借款成功‘)
else:
self.m_textCtrl23.SetValue(u‘哇靠,执行出错了‘)
except Exception as e:
print("button9执行失败原因:",e)
#一键注册
def button81(self,event):
try:
mobile=self.m_textCtrl191.GetValue()
if mobile ==‘‘:
self.m_textCtrl191.SetValue(u‘手机号不能为空‘)
elif len(mobile)==11 and mobile.isdigit()==True:
resultData=self.realname.register(MobileNo=mobile)
if resultData == 0:
self.m_textCtrl201.SetValue(u‘初始密码:test123‘)
else:
self.m_textCtrl201.SetValue(u‘哇靠,执行出错了‘)
except Exception as e:
print("button81执行失败")
#发布借款
def button40(self,event):
try:
mobile=self.m_textCtrl47.GetValue() #手机号
passwd=self.m_textCtrl48.GetValue() #密码
loanType=self.m_choice1.GetCurrentSelection() #借款类型
deadline=self.m_choice2.GetCurrentSelection() #借款期限
loanAmount=self.m_textCtrl74.GetValue() #借款金额
prizeType=self.m_choice6.GetCurrentSelection() #红包类型 11借款返现红包 12借款利率折扣卡‘,
prizeId=self.m_textCtrl76.GetValue() #红包id
if mobile ==‘‘:
self.m_textCtrl47.SetValue(u‘手机号不能为空‘)
if passwd ==‘‘:
self.m_textCtrl48.SetValue(u‘密码不能为空‘)
if loanAmount ==‘‘:
self.m_textCtrl74.SetValue(u‘借款金额不能为空‘)
if mobile !=‘‘ and passwd !=‘‘ and loanAmount !=‘‘:
if prizeType == 0:
newPrizeType=‘‘
if prizeType !=0:
if prizeType ==1:
newPrizeType=11
elif prizeType ==2:
newPrizeType=12
elif prizeId.isdigit() ==False:
self.m_textCtrl76.SetValue(u‘红包id输入不合法‘)
print(‘借款红包类型:‘,newPrizeType)
if deadline == 0:
newDeadline=1
elif deadline == 1:
newDeadline=3
elif deadline == 2:
newDeadline=6
elif deadline == 3:
newDeadline=12
print(‘页面获取的借款期限:‘,newDeadline,‘借款金额:‘,loanAmount)
resultData=self.loan.jiekuan(mobileNo=mobile,passwd=passwd,loanType=loanType,deadline=newDeadline,loanAmount=loanAmount,prizeType=newPrizeType,prizeId=prizeId)
print(‘看这里来:‘,‘借款期限:‘,newDeadline,‘借款金额:‘,loanAmount)
if resultData ==0:
self.m_textCtrl104.SetValue(u‘社保贷借款成功‘)
elif resultData ==1:
self.m_textCtrl104.SetValue(u‘信用卡贷借款成功‘)
elif resultData ==2:
self.m_textCtrl104.SetValue(u‘小易贷借款成功‘)
else:
print(loanType)
self.m_textCtrl104.SetValue(u‘输入有误‘)
else:
pass
except Exception as e:
print("button40执行失败")
if __name__ == "__main__":
app=wx.App(False)
Mywin=MyFrame1(None)
Mywin.Center()
Mywin.Show()
app.MainLoop()
以上是关于wxpython从入门到精通的主要内容,如果未能解决你的问题,请参考以下文章