dc.SetPen(wxPen(wxBLUE, 3))
for line in self.lines:
for coords in line:
- apply(dc.DrawLine, coords)
+ dc.DrawLineXY(*coords)
dc.EndDrawing()
dc.SetPen(wxPen(wxBLUE, 3))
coords = (self.x, self.y) + event.GetPositionTuple()
self.curLine.append(coords)
- apply(dc.DrawLine, coords)
+ dc.DrawLineXY(*coords)
self.x, self.y = event.GetPositionTuple()
dc.EndDrawing()
self.dv = window
# specify the type of data we will accept
- self.data = wxCustomDataObject(wxCustomDataFormat("DoodleLines"))
+ self.df = wxCustomDataFormat("DoodleLines")
+ self.data = wxCustomDataObject(self.df)
self.SetDataObject(self.data)
def OnDrop(self, x, y):
self.log.WriteText("OnDrop: %d %d\n" % (x, y))
- return true
+ return True
def OnDragOver(self, x, y, d):
#self.log.WriteText("OnDragOver: %d, %d, %d\n" % (x, y, d))
- # Called when OnDrop returns true. We need to get the data and
+ # Called when OnDrop returns True. We need to get the data and
# do something with it.
def OnData(self, x, y, d):
self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
dc.SetPen(wxPen(wxRED, 3))
for line in self.lines:
for coords in line:
- apply(dc.DrawLine, coords)
+ dc.DrawLineXY(*coords)
dc.EndDrawing()
#----------------------------------------------------------------------
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
- self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
+ self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
# Make the controls
text1 = wxStaticText(self, -1,
)
rb1 = wxRadioButton(self, -1, "Draw", style=wxRB_GROUP)
- rb1.SetValue(true)
+ rb1.SetValue(True)
rb2 = wxRadioButton(self, -1, "Drag")
- rb2.SetValue(false)
+ rb2.SetValue(False)
text2 = wxStaticText(self, -1,
"The lower window is accepting a\n"
rbox.Add(rb2)
box.Add(text1, 0, wxALL, 10)
box.Add(rbox, 0, wxALIGN_CENTER)
- box.Add(10,90)
+ box.Add((10,90))
box.Add(text2, 0, wxALL, 10)
sizer.Add(box)
sizer.Add(dndsizer, 1, wxEXPAND)
- self.SetAutoLayout(true)
+ self.SetAutoLayout(True)
self.SetSizer(sizer)
# Events
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
- self.SetAutoLayout(true)
+ self.SetAutoLayout(True)
sizer = wxBoxSizer(wxVERTICAL)
msg = "Custom Drag-And-Drop"
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
- text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, false))
+ text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, False))
text.SetLabel(msg)
w,h = text.GetTextExtent(msg)
text.SetSize(wxSize(w,h+1))
class TestApp(wxApp):
def OnInit(self):
+ wxInitAllImageHandlers()
self.MakeFrame()
- return true
+ return True
def MakeFrame(self, event=None):
frame = wxFrame(None, -1, "Custom Drag and Drop", size=(550,400))
frame.SetMenuBar(mb)
EVT_MENU(frame, 6543, self.MakeFrame)
panel = TestPanel(frame, DummyLog())
- frame.Show(true)
+ frame.Show(True)
self.SetTopWindow(frame)
#----------------------------------------------------------------------
+overview = """<html><body>
+This demo shows Drag and Drop using a custom data type and a custom
+data object. A type called "DoodleLines" is created and a Python
+Pickle of a list is actually transfered in the drag and drop
+opperation.
+A second data object is also created containing a bitmap of the image
+and is made available to any drop target that accepts bitmaps, such as
+MS Word.
+The two data objects are combined in a wxDataObjectComposite and the
+rest is handled by the framework.
+</body></html>
+"""
-
-
-
-
-
-overview = """\
-This demo shows Drag and Drop using a custom data type and a custom data object. A type called "DoodleLines" is created and a Python Pickle of a list is actually transfered in the drag and drop opperation.
-
-A second data object is also created containing a bitmap of the image and is made available to any drop target that accepts bitmaps, such as MS Word.
-
-The two data objects are combined in a wxDataObjectComposite and the rest is handled by the framework.
-"""
-