标签:color stat exti pre append %s ctime .text time()
import wx import time class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,"Milo‘s Chat",size=(520,450)) panel=wx.Panel(self) labelAll=wx.StaticText(panel,-1,"All Contents",pos=(210,5)) self.textAll=wx.TextCtrl(panel,-1, size=(480,195), pos=(10,25), style=wx.TE_MULTILINE|wx.TE_READONLY) labelIn=wx.StaticText(panel,-1,"I Say",pos=(210,225)) self.textIn=wx.TextCtrl(panel,-1, size=(480,100), pos=(10,245), style=wx.TE_MULTILINE) self.bunSent=wx.Button(panel,-1,"Sent",size=(75,25),pos=(130,365)) self.bunClear=wx.Button(panel,-1,"Clear",size=(75,25),pos=(260,365)) self.Bind(wx.EVT_BUTTON,self.OnButtonSent,self.bunSent) self.Bind(wx.EVT_BUTTON,self.OnButtonClear,self.bunClear) def OnButtonSent(self,event): userinput=self.textIn.GetValue() self.textIn.Clear() now=time.ctime() inmsg="you(%s):\n%s\n\n " %(now,userinput) #self.textAll.SetValue(userinput) self.textAll.AppendText(inmsg) def OnButtonClear(self,event): pass app=wx.App() frame=MyFrame() frame.Show() app.MainLoop()
标签:color stat exti pre append %s ctime .text time()
原文地址:https://www.cnblogs.com/1304379017dwh/p/9192768.html