Convert some code snippets for the docs.

This commit is contained in:
Robin Dunn
2016-08-13 17:33:33 -07:00
parent 5b831d5498
commit 25d687d8a3
10 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
class MyClass(public BaseClass): # something inheriting from wx.EvtHandler
...
def TryAfter(self, event):
if (BaseClass.TryAfter(self, event))
return True
return self.MyPostProcess(event)

View File

@@ -0,0 +1,10 @@
class MyClass(BaseClass): # something inheriting from wx.EvtHandler
...
def TryBefore(self, event):
if (self.MyPreProcess(event)):
return True
return BaseClass.TryBefore(self, event)

View File

@@ -0,0 +1,9 @@
# some code in HandleTag for "MYITEMS"...
self.Parser.PushTagHandler(self, "PARAM")
self.ParseInner(tag)
self.Parser.PopTagHandler()
# back to working on "MYITEMS"...

View File

@@ -0,0 +1,9 @@
# In Python the value returned will be a sip wrapper around a void* type,
# and it can be converted to the address being pointed to with int().
webview_ptr = self.webview.GetNativeBackend()
# Assuming you are able to get a ctypes, cffi or similar access to the
# webview library, you can use that pointer value to give it access to the
# WebView backend to operate upon.
theWebViewLib.doSomething(int(webview_ptr))

View File

@@ -0,0 +1,10 @@
# connect to the media event
self.Bind(wx.media.EVT_MEDIA_STOP, self.OnMediaStop, self.mediactrl)
# ...
def OnMediaStop(self, evt):
if self.userWantsToSeek:
self.mediactrl.SetPosition(someOtherPosition)
evt.Veto()

View File

@@ -0,0 +1,9 @@
dc = wx.MetafileDC()
if dc.IsOk():
self.DoDrawing(dc)
metafile = dc.Close()
if metafile:
success = metafile.SetClipboard(dc.MaxX() + 10, dc.MaxY() + 10)

View File

@@ -182,6 +182,8 @@ def replaceCppItems(line):
item = 'string'
elif 'wxCoord' == item:
item = 'int'
elif 'time_t' == item:
item = 'int'
elif item == 'char':
item = 'int'
elif item == 'double':