I am writing a simple graphical application with pyGTK to take screenshots on a computer at fixed intervals. To schedule frames, I use the threading.Timer class and take snapshots. I use os.system calls for scrot.
When I press the start button, I launch the screenshot button, the GlapseMain.startScreenshots method is called. When I click the freeze button, the GlapseMain.stopScreenshots method is called.
The fact is that the GTK application works without a screenshot, although it should be. When I click the close button, it starts to take screenshots definitely.
Here is my code:
#!/usr/bin/env python
My output looks something like this:
Starting taking screenshots... Output folder: /home/david/glapse-screens Quality: 80.0 Interval: 2.0 Stopped taking screenshots. Taking screenshot: scrot -q 80.0 /home/david/glapse-screens/scr-00000000000000.jpg... Closing gLapse... Taking screenshot: scrot -q 80.0 /home/david/glapse-screens/scr-00000000000001.jpg... Taking screenshot: scrot -q 80.0 /home/david/glapse-screens/scr-00000000000002.jpg... Taking screenshot: scrot -q 80.0 /home/david/glapse-screens/scr-00000000000003.jpg... Taking screenshot: scrot -q 80.0 /home/david/glapse-screens/scr-00000000000004.jpg... Taking screenshot: scrot -q 80.0 /home/david/glapse-screens/scr-00000000000005.jpg... Taking screenshot: scrot -q 80.0 /home/david/glapse-screens/scr-00000000000006.jpg... Taking screenshot: scrot -q 80.0 /home/david/glapse-screens/scr-00000000000007.jpg...
Hope you could help me, thank you very much.
Edit:
I changed the approach and now use streams:
def startScreenshots(self, output, quality, interval): print 'Starting taking screenshots...' print 'Output folder: ' + str(output) print 'Quality: ' + str(quality) print 'Interval: ' + str(interval)
It prints a message, but does not execute the os.system command until I press the stop button.
David Saltares
source share