生成聊天界面

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()

 

转载于:https://www.cnblogs.com/1304379017dwh/p/9192768.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值