How can I draw a rectangle on an my wx.StaticBitmap image called “bitmap_1” using a dc.Rectangle? I have co-ordinates((754, 483)) on where the rectangle must be drawn.
dc.DrawRectangle(10, 10, 200, 200)` this gives an error
Traceback (most recent call last):
File "C:\Users\Foster\Documents\Roland\ims project\newtagging2.py", line 129, in OnImageMouseOver
NameError: global name 'dc' is not defined
The error is because you haven’t defined what dc is.
You want to take a look at
wxMemoryDC.MemoryDC creates a DC that can be used to draw to bitmaps in memory (as opposed to the display)
You’ll want to draw on
bitmap_1before passing it toStaticBitmaplike this:This article should help you using DCs as well.