def doPuush(self): if self.takeSS: # wait for overlay to disapare # there should be a better way to do this... time.sleep(0.5) if self.area[0] != 0 and self.area[1] != 0: x = int(min(self.origin[0], self.origin[0] + self.area[0])) y = int(min(self.origin[1], self.origin[1] + self.area[1])) w = int(abs(self.area[0])) + 10 h = int(abs(self.area[1])) + 10 puush.screenshot(x, y, w, h)
def doPuush(self): if self.takeSS: # wait for overlay to disapare # there should be a better way to do this... time.sleep(0.5) if self.area[0] != 0 and self.area[1] != 0: x = int(min(self.origin[0], self.origin[0] + self.area[0])) y = int(min(self.origin[1], self.origin[1] + self.area[1])) w = int(abs(self.area[0]))+10 h = int(abs(self.area[1]))+10 puush.screenshot(x, y, w, h)
def doPuush(self): if self.takeSS: # Wait for overlay to disappear # There should be a better way to do this... sleep(0.5) if self.area[0] != 0 and self.area[1] != 0: x = int(min(self.origin[0], self.origin[0] + self.area[0])) y = int(min(self.origin[1], self.origin[1] + self.area[1])) w = int(abs(self.area[0])) h = int(abs(self.area[1])) screenshot(x, y, w, h)
#!/usr/bin/env python from gtk.gdk import screen_width, screen_height from puush import screenshot screenshot(0, 0, screen_width(), screen_height())
if root.supports_net_wm_hint("_NET_ACTIVE_WINDOW") and root.supports_net_wm_hint("_NET_WM_WINDOW_TYPE"): active = root.get_active_window() # You definately do not want to take a screenshot of the whole desktop, see entry 23.36 for that # Returns something like ('ATOM', 32, ['_NET_WM_WINDOW_TYPE_DESKTOP']) if active.property_get("_NET_WM_WINDOW_TYPE")[-1][0] == '_NET_WM_WINDOW_TYPE_DESKTOP' : print False # Calculate the size of the wm decorations relativex, relativey, winw, winh, d = active.get_geometry() w = winw + (relativex*2) h = winh + (relativey+relativex) # Calculate the position of where the wm decorations start (not the window itself) screenposx, screenposy = active.get_root_origin() else: print False puush.screenshot(screenposx, screenposy, w, h) # send # urllib2.Request('') # curl --form "media=@es760a1_plot.png" http://f27f2121f28c700b:[email protected]/api/tb;echo;echo;
#!/usr/bin/env python import gtk.gdk import puush # Calculate the size of the whole screen screenw = gtk.gdk.screen_width() screenh = gtk.gdk.screen_height() puush.screenshot(0, 0, screenw, screenh)
from gtk.gdk import screen_get_default from puush import screenshot if __name__ == '__main__': # Get the root and active window root = screen_get_default() if root.supports_net_wm_hint('_NET_ACTIVE_WINDOW') and root.supports_net_wm_hint('_NET_WM_WINDOW_TYPE'): # You definitely do not want to take a screen-shot of the whole desktop, see entry 23.36 for that # Returns something like ('ATOM', 32, ['_NET_WM_WINDOW_TYPE_DESKTOP']) active = root.get_active_window() if active.property_get('_NET_WM_WINDOW_TYPE')[-1][0] == '_NET_WM_WINDOW_TYPE_DESKTOP': exit(-1) # Calculate the size of the WM decorations relative_x, relative_y, win_w, win_h, d = active.get_geometry() width = win_w + (relative_x - 10) height = win_h + (relative_y - 10) # Calculate the position of where the WM decorations start (not the window itself) screenpos_x, screenpos_y = active.get_root_origin() else: exit(-1) screenshot(screenpos_x, screenpos_y, width, height)