From: oyster on
I am porting www.rmchart.com to python, now the code is almost
finished, and I have supplied some examples.py which write to
picturefiles directly, but the example to draw the chart on GUI stops
me.

that is the vb declaration
nResult (LONG) = RMC_CreateChartOnDC(
ByVal nParentDC (LONG),
ByVal nCtrlId (LONG),
ByVal nX (LONG),
ByVal nY (LONG),
ByVal nWidth (LONG),
ByVal nHeight (LONG),
)
nParentDC (LONG) is Device context, on which the chart shall be painted

If I pass DC=ctypes.windll.user32.GetDC(0) to it, the chart is shown
on the windows, but I don't know how to get the DC in wxPython. It
seems that self.GetHandle() does not help.

Can anyone help me?

thanx

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: "Chris Mellon" on
On Nov 23, 2007 5:34 AM, oyster <lepto.python(a)gmail.com> wrote:
> I am porting www.rmchart.com to python, now the code is almost
> finished, and I have supplied some examples.py which write to
> picturefiles directly, but the example to draw the chart on GUI stops
> me.
>
> that is the vb declaration
> nResult (LONG) = RMC_CreateChartOnDC(
> ByVal nParentDC (LONG),
> ByVal nCtrlId (LONG),
> ByVal nX (LONG),
> ByVal nY (LONG),
> ByVal nWidth (LONG),
> ByVal nHeight (LONG),
> )
> nParentDC (LONG) is Device context, on which the chart shall be painted
>
> If I pass DC=ctypes.windll.user32.GetDC(0) to it, the chart is shown
> on the windows, but I don't know how to get the DC in wxPython. It
> seems that self.GetHandle() does not help.
>

You can get the HDC (the native windows DC handle) from a wxDC by
calling GetHDC() on the dc.

sample pseudo code might be:

def OnPaint(self, evt):
dc = wx.PaintDC(self)
hdc = dc.GetHDC()
RMC_CreateChartOnDC(hdc)

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org