如何在wxpython中设置文本框的最大字符长度?
import wx
from wx.lib.masked import NumCtrl
class MyFrame(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,id,title)
self.panelMain = wx.Panel(self, -1)
panel = self.panelMain
#creating buttons and text boxes.
self.guessTxt = wx.lib.masked.NumCtrl(self.panelMain,-1,size=(100,20),pos=(50,102))
self.newGameTxt = wx.TextCtrl(self.panelMain,-1,size=(100,20),pos=(180,73))
如这条线所示
self.newGameTxt = wx.TextCtrl(self.panelMain,-1,size=(100,20),pos=(180,73))
我正在创建文本框,但如何设置它可以包含的最大字符数?
self.newGameTxt.SetMaxLength(200)
http://wxpython.org/Phoenix/docs/html/TextEntry.html?highlight=maxl#TextEntry.SetMaxLength