wxPython多行文本框范例
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#作者:www.phpdesigner.org
#多行文本框
import wx
class TextFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self,None,-1,u\'多行文本框\',size = (250,150))
panel = wx.Panel(self,-1)
self.multiText = wx.TextCtrl(panel,-1,\'python is a good language\',
pos = (10,10),size = (180,80),
style = wx.TE_MULTILINE |
wx.TE_CENTER | wx.TE_PROCESS_ENTER)
self.multiText.SetBackgroundColour(\'red\')
self. multiText.SetFocus()
self.Bind(wx.EVT_TEXT_ENTER,self.onClick,self.multiText)
def onClick(self,evt):
wx.MessageBox(\'%s\'% (self.multiText.GetValue()),\'hot\')
self.multiText.Clear()
if __name__ == \'__main__\':
app = wx.PySimpleApp()
frame = TextFrame()
frame.Show()
app.MainLoop()