google earth wxpython

20 views
Skip to first unread message

prairie99

unread,
Mar 27, 2009, 12:58:45 AM3/27/09
to gdal+python+GIS+geosings论坛
能不能把google earth 的主窗口放在 wxpython 的 一个分割窗口内, 并且大小 Fit. 网上有类似尝试,但没有放在分割窗口
内。

linux23...@gmail.com

unread,
Mar 27, 2009, 5:43:31 AM3/27/09
to gdal+python+GIS+geosings论坛
如果你在一个普通窗口上嵌入了,把代码贴上来,我把它搞到分割窗口里面

prairie99

unread,
Mar 27, 2009, 9:09:53 AM3/27/09
to gdal+python+GIS+geosings论坛
import win32com.client as com
import ctypes as ct
import wx
import time, string


ge = com.Dispatch("GoogleEarth.ApplicationGE")


user32 = ct.windll.user32
user32.ShowWindowAsync(ge.GetMainHwnd(), 0)
app = wx.PySimpleApp()

frame = wx.Frame(None, -1, "GE Test")
frame.Show(True)

user32.SetParent(ge.GetRenderHwnd(), frame.GetHandle())

app.MainLoop()

linux23...@gmail.com

unread,
Mar 29, 2009, 11:56:03 AM3/29/09
to gdal+python+GIS+geosings论坛
试试这个?
import win32com.client as com
import ctypes as ct
import wx
import time, string
ge = com.Dispatch("GoogleEarth.ApplicationGE")

user32 = ct.windll.user32
user32.ShowWindowAsync(ge.GetMainHwnd(), 0)
class MainPanel(wx.Panel):
def __init__(self, *args, **kwds):
wx.Panel.__init__(self, *args, **kwds)
self.spwin = wx.SplitterWindow(self, -1 , style=wx.SP_3D|
wx.SP_BORDER)

sizer_1 = wx.BoxSizer(wx.VERTICAL)

self.nb = wx.Panel(self.spwin, -1, size=(100,100))
self.nb.SetBackgroundColour("#ffffff")
self.canvas = wx.Panel(self.spwin, -1, size=(300,300))
self.canvas.SetBackgroundColour("#ffff00")

user32.SetParent(ge.GetRenderHwnd(), self.canvas.GetHandle())

self.spwin.SplitVertically(self.nb, self.canvas, 152)
sizer_1.Add(self.spwin, 1, wx.EXPAND, 0)
self.SetAutoLayout(True)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
sizer_1.SetSizeHints(self)

app = wx.PySimpleApp()

frame = wx.Frame(None, -1, "GE Test", size=(800,600))
panel = MainPanel(frame, -1)
sizermain = wx.BoxSizer(wx.VERTICAL)
sizermain.Add(panel, 1, wx.EXPAND, 0)
frame.SetAutoLayout(True)
frame.SetSizer(sizermain)
frame.Layout()
frame.Show(True)

#user32.SetParent(ge.GetRenderHwnd(), frame.GetHandle())

app.MainLoop()

prairie99

unread,
Mar 30, 2009, 9:17:25 PM3/30/09
to gdal+python+GIS+geosings论坛
妙哉!我再好好看看!

linux23...@gmail.com

unread,
Mar 30, 2009, 10:43:58 PM3/30/09
to gdal+python+GIS+geosings论坛
我还从来没有用ctypes来搞过ActiveX的嵌入……

On 3月31日, 上午9时17分, prairie99 <prairi...@gmail.com> wrote:
> 妙哉!我再好好看看!

Reply all
Reply to author
Forward
0 new messages