wxPanel.__init__(self, parent, -1)
self.log = log
- #self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
+ #self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(wxStaticText(self, -1,
EVT_BUTTON(self, 6051, self.OnPaste)
EVT_BUTTON(self, 6052, self.OnCopyBitmap)
- self.SetAutoLayout(true)
+ self.SetAutoLayout(True)
self.SetSizer(sizer)
def OnDrop(self, x, y):
self.log.WriteText("OnDrop: %d %d\n" % (x, y))
- return true
+ return True
def OnData(self, x, y, d):
self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
def OnDropText(self, x, y, text):
self.window.WriteText("(%d, %d)\n%s\n" % (x, y, text))
+ def OnDragOver(self, x, y, d):
+ return wxDragCopy
class FileDropPanel(wxPanel):
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))
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(wxStaticText(self, -1, " \nDrag some files here:"),
self.text2.SetDropTarget(dt)
sizer.Add(self.text2, 1, wxEXPAND)
- self.SetAutoLayout(true)
+ self.SetAutoLayout(True)
self.SetSizer(sizer)
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
- self.SetAutoLayout(true)
+ self.SetAutoLayout(True)
outsideSizer = wxBoxSizer(wxVERTICAL)
msg = "Clipboard / 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))
-overview = """\
-This demo shows some examples of data transfer through clipboard or drag and drop. In wxWindows, these two ways to transfer data (either between different applications or inside one and the same) are very similar which allows to implement both of them using almost the same code - or, in other words, if you implement drag and drop support for your application, you get clipboard support for free and vice versa.
+overview = """<html><body>\
+This demo shows some examples of data transfer through clipboard or
+drag and drop. In wxWindows, these two ways to transfer data (either
+between different applications or inside one and the same) are very
+similar which allows to implement both of them using almost the same
+code - or, in other words, if you implement drag and drop support for
+your application, you get clipboard support for free and vice versa.
+<p>
+At the heart of both clipboard and drag and drop operations lies the
+wxDataObject class. The objects of this class (or, to be precise,
+classes derived from it) represent the data which is being carried by
+the mouse during drag and drop operation or copied to or pasted from
+the clipboard. wxDataObject is a "smart" piece of data because it
+knows which formats it supports (see GetFormatCount and GetAllFormats)
+and knows how to render itself in any of them (see GetDataHere). It
+can also receive its value from the outside in a format it supports if
+it implements the SetData method. Please see the documentation of this
+class for more details.
+<p>
+Both clipboard and drag and drop operations have two sides: the source
+and target, the data provider and the data receiver. These which may
+be in the same application and even the same window when, for example,
+you drag some text from one position to another in a word
+processor. Let us describe what each of them should do.
+</body></html>
+"""
-At the heart of both clipboard and drag and drop operations lies the wxDataObject class. The objects of this class (or, to be precise, classes derived from it) represent the data which is being carried by the mouse during drag and drop operation or copied to or pasted from the clipboard. wxDataObject is a "smart" piece of data because it knows which formats it supports (see GetFormatCount and GetAllFormats) and knows how to render itself in any of them (see GetDataHere). It can also receive its value from the outside in a format it supports if it implements the SetData method. Please see the documentation of this class for more details.
-Both clipboard and drag and drop operations have two sides: the source and target, the data provider and the data receiver. These which may be in the same application and even the same window when, for example, you drag some text from one position to another in a word processor. Let us describe what each of them should do.
-"""
+
+if __name__ == '__main__':
+ import sys,os
+ import run
+ run.main(['', os.path.basename(sys.argv[0])])
+