#coding =utf-8import wxclass statictextframe (WX. Frame): def __init__ (self): wx. frame.__init__ (self,none,-1, ' Static text example ', size= (400,300)) panel = wx. Panel (self,-1) #静态文本 static text for foreground and background colors wx. Statictext (panel,-1, "This is an example of static text", (100,10)) rev = wx. Statictext (panel,-1, ' static text with reversed colors ', (100,30)) rev. Setforegroundcolour (' white ') rev. Setbackgroundcolour (' black ') #居中的文本 center = wx. Statictext (panel,-1, ' align&Nbsp;center ', (100,50), (160,-1), WX. Align_center) #指定新字体的静态文本 str = "You can also change the font" text = wx. Statictext (Panel,-1,str, (20,100)) font = wx. Font (18,wx. Decorative,wx. Italic,wx. NORMAL) text. SetFont (font) #显示多行文本 tyle=wx. The align_right is aligned wx. Statictext (panel,-1, ' multi-line text \n can also \n be right aligned \n \n even with a blank ', (220,150), style=wx. Align_right) App = wx. Pysimpleapp () Statictextframe (). Show () app. MainlooP ()
This article is from the "Anaf" blog, make sure to keep this source http://anngle.blog.51cto.com/5542868/1657806
Wxpython Basic controls-Static text controls