Hi all,
Has anyone ever successfully used customised arrowheads on lines?
I assume this has to be done using metafiles. Here is my code
fragment modified from the OGL demo program:
···
########################################################################
class MyArrow( wx.ogl.DrawnShape ) :
# this class implements an arrowhead as a semicircle
def __init__( self ) :
wx.ogl.DrawnShape.__init__( self )
self.DrawEllipticArc( wx.Rect( 0, 0, 10, 10), 0, 180 )
self.CalculateSize( )
########################################################################
class MyLineShape( wx.ogl.LineShape ) :
def __init__( self ) :
wx.ogl.LineShape.__init__( self )
self.SetPen( wx.BLACK_PEN )
self.SetBrush( wx.BLACK_BRUSH )
#self.AddArrow( wx.ogl.ARROW_ARROW )
arrow = MyArrow( )
wx.LogMessage( "arrow = " + repr( arrow ) )
arrow_mf = arrow.GetMetaFile( )
self.AddArrow( wx.ogl.ARROW_METAFILE, mf=arrow_mf )
self.MakeLineControlPoints( 2 )
########################################################################
When I run it, I get:
Traceback (most recent call last):
File "<stdin>", line 342, in OnRightClick
File "<stdin>", line 61, in __init__
File "E:\SOFTWARE\python-2.3\lib\site-packages\wxPython\oglshapes.py"
line 575, in GetMetaFile
val = oglshapesc.wxPyDrawnShape_GetMetaFile(self, *_args, **_kwargs)
File "E:\SOFTWARE\python-2.3\lib\site-packages\wxPython\oglshapes.py",
line 182, in __init__
self.this = oglshapesc.new_wxPseudoMetaFile(*_args,**_kwargs)
TypeError: new_wxPseudoMetaFile() takes exactly 0 arguments (1 given)
There appear to be some problems with the [Pseudo]MetaFile class, see:
http://lists.wxwindows.org/archive/wx-dev/msg36961.html
My code is only a guess at how to do it, so if you've done it
successfully, please post a code example.
Many thanks.
--
Pythonologist