Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8605219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:46:20+00:00 2026-06-12T02:46:20+00:00

Possible Duplicate: Take a screenshot via a python script. [Linux] How can I achieve

  • 0

Possible Duplicate:
Take a screenshot via a python script. [Linux]

How can I achieve the capturing screen-shots and saving in a folder as achieved by the following python code in windows in linux (ubuntu)? I also want to run it at the OS start-up.

import os
import sys
import time
import Image
import ImageGrab
SaveDirectory=r'C:\Documents and Settings\gg\Desktop\office_docs'

———————————————————

for i in range(10000):

img=ImageGrab.grab()
saveas=os.path.join(SaveDirectory,'ScreenShot_'+time.strftime('%Y_%m_%d_%H_%M_%S')+'.png')
img.save(saveas)
time.sleep(10)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:46:22+00:00Added an answer on June 12, 2026 at 2:46 am

    The first thing you should do, is replace the path of SaveDirectory with a path that works on both operating systems.

    Based on How to get the home directory in Python?, you can use os.path.expanduser to replace ~ with your home directory.

    A possible solution is:

    from os.path import expanduser
    import os.path.join
    
    SaveDirectory = expanduser(os.path.join('Desktop', 'office_docs'))
    

    For the second part of the question, it depends whether you want to do it via a GUI or manually editing a config file. Here you should find the instruction for the GUI. Here you can find the instructions for the config file way.

    I should note that the python style guide suggest lowercase names with words separated by underscores for instance variables since it improves readability, but this is just a suggestion.

    I hope you find this answer useful and apologise if it does not work as I have not tested it myself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to programatically take a screenshot on Android? How to capture the
Possible Duplicate: How can I take screenshots with Perl? How can I take a
Possible Duplicate: Take the address of a one-past-the-end array element via subscript: legal by
Possible Duplicate: Is there a way to take a screenshot using Java and save
Possible Duplicate: Take the address of a one-past-the-end array element via subscript: legal by
Possible Duplicate: Can I call functions that take an array/pointer argument using a std::vector
Possible Duplicate: Take a screenshot of a webpage with javascript? I hope to export
Possible Duplicate: Is there a way I can capture my iPhone screen as a
Possible Duplicate: Splitting a string into a list in python I'd like to take
Possible Duplicate: PHP take all combinations I'm thinking of making something in PHP that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.