Hy. I need help. I'm trying to draw bitmap on panel. This is my code:
Please help.
<CODE>
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, (300, 300))
self.panel = wx.Panel(self, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE)
self.panel.Bind(wx.EVT_PAINT, self.onPaint)
#self.panel.Bind(wx.EVT_SIZE, self.onSize)
#self.onSize(None)
self.Show()
def onPaint(self, event):
#wx.StaticBitmap(self.panel, -1, wx.Bitmap(slike/hotspot.bmp", wx.BITMAP_TYPE_ANY), #(0,0), (100, 100)
dc = wx.PaintDC(self.panel)
size = self.panel.GetSize()
self._Buffer = wx.EmptyBitmap(*size)
dc.DrawBitmap(self.panel ,self._Buffer , (0,0), useMask=True)
#dc = wx.BufferedPaintDC(self.panel, self._Buffer)
app = wx.App()
MainWindow(None, -1, "Buffer")
app.MainLoop()
</CODE>
Traceback (most recent call last):
File "buffer.py", line 22, in onPaint
self._Buffer = wx.EmptyBitmap(size)
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_gdi.py", line 723, in EmptyBitmap
val = _gdi_.new_EmptyBitmap(*args, **kwargs)
TypeError: new_EmptyBitmap() takes at least 2 arguments (1 given)
root@pofuk-desktop:/home/pofuk/kartaMedimurja# python buffer.py
Traceback (most recent call last):
File "buffer.py", line 23, in onPaint
dc.DrawBitmap(self.panel ,self._Buffer , (0,0), useMask=True)
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_gdi.py", line 3298, in DrawBitmap
return _gdi_.DC_DrawBitmap(*args, **kwargs)
TypeError: in method 'DC_DrawBitmap', expected argument 2 of type 'wxBitmap const &'