如何在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))
答案 0 :(得分:0)
self.newGameTxt.SetMaxLength(200)
http://wxpython.org/Phoenix/docs/html/TextEntry.html?highlight=maxl#TextEntry.SetMaxLength