客户端框架效果图如下
框架代码
import wx
import wx.xrc
class MyDialog ( wx.Dialog ):
def __init__( self, parent ):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"V4.0 框架", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_APPWORKSPACE ) )
fgSizer = wx.FlexGridSizer( 0, 2, 0, 0 )
fgSizer.SetFlexibleDirection( wx.BOTH )
fgSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
bSizer = wx.BoxSizer( wx.VERTICAL )
self.m_textCtrl = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 400,400 ), 0 )
self.m_textCtrl.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) )
self.m_textCtrl.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) )
bSizer.Add( self.m_textCtrl, 0, wx.ALL, 5 )
self.m_textCtrl2 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 400,-1 ), wx.TE_PROCESS_ENTER )
self.m_textCtrl2.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) )
bSizer.Add( self.m_textCtrl2, 0, wx.ALL, 5 )
gbSizer = wx.GridBagSizer( 0, 0 )
gbSizer.SetFlexibleDirection( wx.BOTH )
gbSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
self.m_button = wx.Button( self, wx.ID_ANY, u"发送", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer.Add( self.m_button, wx.GBPosition( 0, 0 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
self.m_button2 = wx.Button( self, wx.ID_ANY, u"清空", wx.DefaultPosition, wx.DefaultSize, 0 )
gbSizer.Add( self.m_button2, wx.GBPosition( 0, 1 ), wx.GBSpan( 1, 1 ), wx.ALL, 5 )
bSizer.Add( gbSizer, 1, wx.EXPAND, 5 )
fgSizer.Add( bSizer, 1, wx.EXPAND, 5 )
bSizer2 = wx.BoxSizer( wx.VERTICAL )
self.m_staticText = wx.StaticText( self, wx.ID_ANY, u"通知栏:", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText.Wrap( -1 )
self.m_staticText.SetFont( wx.Font( 12, 70, 90, 92, False, "宋体" ) )
bSizer2.Add( self.m_staticText, 0, wx.ALL, 5 )
self.m_textCtrl3 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,400 ), 0 )
bSizer2.Add( self.m_textCtrl3, 0, wx.ALL, 5 )
fgSizer.Add( bSizer2, 1, wx.EXPAND, 5 )
self.SetSizer( fgSizer )
self.Layout()
fgSizer.Fit( self )
self.Centre( wx.BOTH )
# Connect Events
self.m_textCtrl2.Bind( wx.EVT_TEXT_ENTER, self.fs )
self.m_button.Bind( wx.EVT_BUTTON, self.fs )
self.m_button2.Bind( wx.EVT_BUTTON, self.qk )
def __del__( self ):
pass
# Virtual event handlers, overide them in your derived class
def fs( self, event ):
print('触发发送功能')
print(self.m_textCtrl2.GetValue())
self.m_textCtrl2.Value=''
def qk( self, event ):
print('触发清空功能')
app=wx.App(False)
zjm=MyDialog(None)
zjm.Show(True)
app.MainLoop()