Hi, Can any pro help me to check the following code? I
took it from wxpython demo and tried to edit and run
by myself. sorry this is the way I learn. everytime it
freeze my computer. The image file(*.png) is the same
directory as the code.
A little more detail: I use pythonwin2.3, wxpython
2.6, windowXP.
import wx # This module uses the new
wx namespace
···
#----------------------------------------------------------------------
msg = "Some text will appear mixed in the image's
shadow..."
class TestPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def OnPaint(self, evt):
dc = wx.PaintDC(self)
dc.SetBackground(wx.Brush("WHITE"))
dc.Clear()
dc.SetFont(wx.Font(16, wx.SWISS, wx.NORMAL,
wx.BOLD, True))
dc.DrawText("Bitmap alpha blending (on all
ports but gtk+ 1.2)",
25,25)
wx.InitAllImageHandlers()
bmp = wx.Bitmap('toucan.png')
dc.DrawBitmap(bmp, 25,100, True)
dc.SetFont(self.GetFont())
y = 75
for line in range(10):
y += dc.GetCharHeight() + 5
dc.DrawText(msg, 200, y)
dc.DrawBitmap(bmp, 250,100, True)
class MyApp(wx.App):
def OnInit(self):
frame=wx.Frame(None, -1, 'title')
TestPanel(frame)
frame.Show(1)
self.SetTopWindow(frame)
return true
app=MyApp(0)
app.MainLoop()
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com