13
Come si imposta il carattere su un widget StaticText wxPython?wxPython StaticText Widget Font
Come si imposta il carattere su un widget StaticText wxPython?wxPython StaticText Widget Font
use object.SetFont. Per esempio (da wxpython in Action):
text = wx.StaticText(panel, -1, 'my text', (20, 100))
font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
text.SetFont(font)
wx.Font ha la seguente firma:
wx.Font(pointSize, family, style, weight, underline=False, faceName="", encoding=wx.FONTENCODING_DEFAULT)
famiglia può essere:
wx.DECORATIVE, wx.DEFAULT, wx .MODERN, wx.ROMAN, wx.SCRIPT o wx.SWISS.
stile può essere:
wx.NORMAL, wx.SLANT o wx.ITALIC.
peso può essere:
wx.NORMAL, wx.LIGHT, o wx.BOLD
Se qualcun altro è curioso, il metodo 'SetFont' proviene da [il' finestra 'class] (http://wxpython.org/docs/api/wx.Window-class.html). – bdesham
Come posso impostare il carattere per una sola sezione del testo? Dovrei usare due diversi comandi 'StaticText'? – fatuhoku
@fatuhoku Un 'wx.StaticText' può avere più righe di testo, ma non può gestire più caratteri. Per più tipi di carattere o stili è possibile utilizzare, ad esempio, un 'wx.html.HTMLWindow' – joaquin