<p class="MsoNormal">Hi everybody,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I am writing an application where the user should be able to
draw (with the mouse) a rectangle on a playing video window (for now it is an
ximagesink).</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I try the following but I see nothing drawing on the screen…</p>
<p class="MsoNormal">### CONFIGURE PIPELINE TO CATCH SYNC MESSAGES</p>
<p class="MsoPlainText" style="margin-left: 0.5in;">bus = self.Pipeline.get_bus()</p>
<p class="MsoPlainText" style="margin-left: 0.5in;">bus.add_signal_watch()</p>
<p class="MsoPlainText" style="margin-left: 0.5in;">bus.enable_sync_message_emission()</p>
<p class="MsoPlainText" style="margin-left: 0.5in;">bus.connect('message',
self.on_message)</p>
<p class="MsoPlainText" style="margin-left: 0.5in;">bus.connect('sync-message::element',
self.on_sync_message)</p>
<p class="MsoNormal" style="text-indent: 0.5in;"> </p>
<p class="MsoNormal" style="text-indent: 0.5in;"> </p>
<p class="MsoNormal" style="text-indent: 0.5in;">#############</p>
<p class="MsoNormal" style="text-indent: 0.5in;">## Tell ximagesink to draw into the
draw area that I give it, not in it's own …</p>
<p class="MsoPlainText"> def on_sync_message(self, bus, message):</p>
<p class="MsoPlainText"> if message.structure is None:</p>
<p class="MsoPlainText">
return</p>
<p class="MsoPlainText"> message_name =
message.structure.get_name()</p>
<p class="MsoPlainText"> if message_name ==
"prepare-xwindow-id":</p>
<p class="MsoPlainText">
imagesink = message.src</p>
<p class="MsoPlainText">
imagesink.set_property("force-aspect-ratio", True)</p>
<p class="MsoPlainText">
imagesink.set_xwindow_id(self.DrawingArea.window.xid)</p>
<p class="MsoNormal" style="text-indent: 0.5in;"> </p>
<p class="MsoNormal" style="text-indent: 0.5in;">#############</p>
<p class="MsoNormal" style="text-indent: 0.5in;">## Now, on the expose event of the
drawing area, paint the rectangle according to user input (mouse)</p>
<p class="MsoNormal" style="text-indent: 0.5in;">#############</p>
<p class="MsoPlainText"> def
on_DrawingAreaCamera_expose_event(self,widget,event):</p>
<p class="MsoPlainText"> #if
self.area_selection_now is True:</p>
<p class="MsoPlainText"> context =
widget.window.cairo_create()</p>
<p class="MsoPlainText">
#widget.window.draw(context)</p>
<p class="MsoPlainText">
context.rectangle(self.area_selection)</p>
<p class="MsoPlainText">
context.set_source_rgb(1,0,0)</p>
<p class="MsoPlainText">
context.stroke()</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">What is the right way to interact with ximagesink, so I can
also draw things on it's drawable??</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Regards</p>