A couple demo tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2a74d1415b
commit
f2a10cdc48
@ -64,18 +64,19 @@ class DragCanvas(wxScrolledWindow):
|
||||
|
||||
# Make a shape from some text
|
||||
text = "Some Text"
|
||||
bg_colour = wxColour(57, 115, 57) # matches the bg image
|
||||
font = wxFont(15, wxROMAN, wxNORMAL, wxBOLD)
|
||||
textExtent = self.GetFullTextExtent(text, font)
|
||||
bmp = wxEmptyBitmap(textExtent[0], textExtent[1])
|
||||
dc = wxMemoryDC()
|
||||
dc.SelectObject(bmp)
|
||||
dc.SetBackground(wxBrush(bg_colour, wxSOLID))
|
||||
dc.Clear()
|
||||
dc.SetTextForeground(wxRED)
|
||||
dc.SetFont(font)
|
||||
dc.DrawText(text, 0, 0)
|
||||
dc.SelectObject(wxNullBitmap)
|
||||
del dc
|
||||
mask = wxMaskColour(bmp, wxWHITE)
|
||||
mask = wxMaskColour(bmp, bg_colour)
|
||||
bmp.SetMask(mask)
|
||||
shape = DragShape(bmp)
|
||||
shape.pos = wxPoint(5, 100)
|
||||
|
@ -59,10 +59,10 @@ class TestPanel(wxPanel):
|
||||
EVT_RIGHT_UP(self, self.OnRightClick)
|
||||
EVT_MENU(self, wxID_OPEN, self.OnFileOpenDialog)
|
||||
EVT_MENU_RANGE(self, wxID_FILE1, wxID_FILE9, self.OnFileHistory)
|
||||
EVT_WINDOW_DESTROY(self, self.Cleanup)
|
||||
|
||||
|
||||
|
||||
def __del__(self):
|
||||
def Cleanup(self, *args):
|
||||
del self.filehistory
|
||||
self.menu.Destroy()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user