2016-04-01 30 views
0

2.7 sürümünde wx python'daki yazı tipi ayarını değiştirmeye çalışıyorum. SetFont is not defined söyleyerek hata alıyorum. 2.7 besbelli yayınlanmaz2,7 sürümde wx python'da set fontunu kullanırken hata 2.7

import wx 
text = wx.StaticText(panel, -1, 'my text', (20, 100)) 
font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL) 
text.SetFont(font) 
+0

göster. Ben Belki wx ithalat SetFont' gelen 'denemek ithalat WX –

+0

... – Nitesh

+0

kullanıyorum –

cevap

0

Kişisel kod örneği SetFont komutunu sahip değildir gibi görünüyor. Ancak aşağıdaki minimum örnek yapacaktır: Win7 (x64), Python 2.7.10 (32 bit), wxPython 3.0.2 (metre) üzerinde test

import wx 
app = wx.App(redirect=False) 
frm = wx.Frame(None) 
obj = wx.StaticText(frm, -1, 'fubar', (20, 100)) 
font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL) 
obj.SetFont(font)  
frm.Show() 
app.MainLoop() 

. Eğer ithalat ifadeleri nasıl kullandıklarını

Minimal wxPython Font sample

+0

Ayrıca wxPython_Phoenix 3.0.3dev-something (msw), 32 bit üzerinde çalışır. – nepix32