text_ctrl.py

来自「wxPython的基本示例程序」· Python 代码 · 共 26 行

PY
26
字号
import wxclass TextFrame(wx.Frame):    def __init__(self):        wx.Frame.__init__(self, None, -1, 'Text Entry Example',                 size=(300, 100))        panel = wx.Panel(self, -1)         basicLabel = wx.StaticText(panel, -1, "Basic Control:")        basicText = wx.TextCtrl(panel, -1, "I've entered some text!",                 size=(175, -1))        basicText.SetInsertionPoint(0)        pwdLabel = wx.StaticText(panel, -1, "Password:")        pwdText = wx.TextCtrl(panel, -1, "password", size=(175, -1),                 style=wx.TE_PASSWORD)        sizer = wx.FlexGridSizer(cols=2, hgap=6, vgap=6)        sizer.AddMany([basicLabel, basicText, pwdLabel, pwdText])        panel.SetSizer(sizer)if __name__ == '__main__':    app = wx.PySimpleApp()    frame = TextFrame()    frame.Show()    app.MainLoop()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?