当我将 Text 附加到 . 下面是我写的代码。我英语不是很好。谢谢你的帮助。
导入 wx
类TextFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, 'Text Entry Example',
size=(300, 250))
panel = wx.Panel(self, -1)
richLabel = wx.StaticText(panel, -1, "Rich Text")
richText = wx.TextCtrl(panel, -1,
"If supported by the native control, this is reversed, and this is a different font.",
size=(200, 100), style=wx.TE_MULTILINE|wx.TE_RICH2)
richText.Bind(wx.EVT_RIGHT_DOWN, self.OnTextCtrl1LeftDown)
richText.SetInsertionPoint(0)
#? how can I bind mouse event like leftdown on Text below
#? how can I bind mouse event like leftdown on Text below
richText.SetStyle(44, 52, wx.TextAttr("white", "black"))
points = richText.GetFont().GetPointSize()
print points,type(points)
f = wx.Font(points + 10, wx.ROMAN, wx.ITALIC, wx.BOLD, True)
richText.SetStyle(68, 82, wx.TextAttr("blue", wx.NullColour, f))
sizer = wx.FlexGridSizer(cols=2, hgap=6, vgap=6)
sizer.AddMany([richLabel, richText])
panel.SetSizer(sizer)
def OnTextCtrl1LeftDown(self,event):
print "clientwx,leftdown"