これは、新しいアイデアや新しいことを学ぶことができる場合です。
2つの言語に参加したいというあなたの特定の問題に対する解決策ではありません。これは、Pythonですべてを組み込むというアイデアに代わるものです。
#!/usr/bin/python
import pyglet
from time import time, sleep
class Window(pyglet.window.Window):
def __init__(self):
super(Window, self).__init__(vsync = False)
self.alive = 1
self.click = None
self.drag = False
with open('map.png', 'rb') as fh:
self.geodata_image = pyglet.image.load('map.png', file=fh)
self.geo_info = self.geodata_image.width, self.geodata_image.height
def on_draw(self):
self.render()
def on_mouse_press(self, x, y, button, modifiers):
self.click = x,y
def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
if self.click:
self.drag = True
print 'Drag offset:',(dx,dy)
def on_mouse_release(self, x, y, button, modifiers):
if not self.drag and self.click:
print 'You clicked here', self.click, 'Relese point:',(x,y)
## Do work on corindate
else:
print 'You draged from', self.click, 'to:',(x,y)
## Move or link two points, or w/e you want to do.
self.click = None
self.drag = False
def render(self):
self.clear()
## An alternative to only getting a region if you only want to show a specific part of
## the image:
# subimage = self.geodata_image.get_region(0, 0, self.geo_info[0], self.geo_info[1])
self.geodata_image.blit(0, 0, 0) # x, y, z from the bottom left corner
self.flip()
def on_close(self):
self.alive = 0
def run(self):
while self.alive:
self.render()
## self.dispatch_events() must be in the main loop
## or any loop that you want to "render" something
## Because it is what lets Pyglet continue with the next frame.
event = self.dispatch_events()
sleep(1.0/25) # 25FPS limit
win = Window()
win.run()
必要なのは、次のとおりです。
Pythonのモックアップ例えば、
。
関連:http://stackoverflow.com/questions/309158/embedding-an-application-inside-another-application – hyde
実験するコードの一部を入力してください。 – utapyngo
クロスプラットフォームのソリューションではなく、Windowsではこれが役立ちます:[SetParent function](http://msdn.microsoft.com/en-us/library/windows/desktop/ms633541%28v=vs.85%29.aspx ) – utapyngo