Wrap the canvas inside a gtk.EventBox to make it easier
to take screenshot of the canvas area only.
This commit is contained in:
parent
108147a6b1
commit
7f731457c2
@ -35,14 +35,19 @@ class Window(gtk.Window):
|
|||||||
self._vbox.pack_start(self._hbox)
|
self._vbox.pack_start(self._hbox)
|
||||||
self._hbox.show()
|
self._hbox.show()
|
||||||
|
|
||||||
|
self._event_box = gtk.EventBox()
|
||||||
|
self._hbox.pack_start(self._event_box)
|
||||||
|
self._event_box.show()
|
||||||
|
|
||||||
self.add(self._vbox)
|
self.add(self._vbox)
|
||||||
self._vbox.show()
|
self._vbox.show()
|
||||||
|
|
||||||
def set_canvas(self, canvas):
|
def set_canvas(self, canvas):
|
||||||
if self.canvas:
|
if self.canvas:
|
||||||
self._hbox.remove(self.canvas)
|
self._event_box.remove(self.canvas)
|
||||||
|
|
||||||
self._hbox.pack_start(canvas)
|
if canvas:
|
||||||
|
self._event_box.add(canvas)
|
||||||
|
|
||||||
self.canvas = canvas
|
self.canvas = canvas
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user