Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57120 > unrolled thread
| Started by | Pratik Mehta <pratik.mehta13390@gmail.com> |
|---|---|
| First post | 2013-10-19 15:12 -0700 |
| Last post | 2013-10-22 21:06 -0400 |
| Articles | 15 — 7 participants |
Back to article view | Back to comp.lang.python
Screenshots in Mac OS X Pratik Mehta <pratik.mehta13390@gmail.com> - 2013-10-19 15:12 -0700
Re: Screenshots in Mac OS X Chris Angelico <rosuav@gmail.com> - 2013-10-20 09:36 +1100
Re: Screenshots in Mac OS X Ned Deily <nad@acm.org> - 2013-10-19 15:42 -0700
Re: Screenshots in Mac OS X Pratik Mehta <pratik.mehta13390@gmail.com> - 2013-10-19 16:17 -0700
Re: Screenshots in Mac OS X Pratik Mehta <pratik.mehta13390@gmail.com> - 2013-10-22 13:15 -0700
Re: Screenshots in Mac OS X Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-22 21:30 +0100
Re: Screenshots in Mac OS X Pratik Mehta <pratik.mehta13390@gmail.com> - 2013-10-22 17:22 -0700
Re: Screenshots in Mac OS X Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-23 07:04 +0100
Re: Screenshots in Mac OS X Metallicow <metaliobovinus@gmail.com> - 2013-10-23 21:00 -0700
Re: Screenshots in Mac OS X John Gordon <gordon@panix.com> - 2013-10-22 21:50 +0000
Re: Screenshots in Mac OS X Pratik Mehta <pratik.mehta13390@gmail.com> - 2013-10-22 17:14 -0700
Re: Screenshots in Mac OS X Kevin Walzer <kw@codebykevin.com> - 2013-10-22 18:08 -0400
Re: Screenshots in Mac OS X Kevin Walzer <kw@codebykevin.com> - 2013-10-22 18:16 -0400
Re: Screenshots in Mac OS X Pratik Mehta <pratik.mehta13390@gmail.com> - 2013-10-22 17:19 -0700
Re: Screenshots in Mac OS X Kevin Walzer <kw@codebykevin.com> - 2013-10-22 21:06 -0400
| From | Pratik Mehta <pratik.mehta13390@gmail.com> |
|---|---|
| Date | 2013-10-19 15:12 -0700 |
| Subject | Screenshots in Mac OS X |
| Message-ID | <22861e2f-50f2-4d74-9024-53caec5570fa@googlegroups.com> |
Hi Guys, Good Morning! How are you all doing? I am in need of your help. I am stuck in a problem. I want to write my own Screenshot Taking program in Python for Mac OS X. Example : Whenever Command + Shift + 3 is pressed ==> whatever is there on the screen, should be grabbed / captured, and should be stored on my local with my own desired path, and name should automatically given as SnapshotX.. as in Snapshot1, Snapshot2, etc... The same goes with Command + Shift + 4 ==> the only difference is that, it allows you to select a particular area to be captured / grabbed. Command + Shift + 5 ==> This one is a little bit tricky which I am looking for. This shortcut doesn't exist. I want to create one of my own, where it would grab the entire webpage's screenshot which I am currently working on, and store the name as the webpage's link. Thanks in advance for your kind help and time. Thanks & Regards, Pratts
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-10-20 09:36 +1100 |
| Message-ID | <mailman.1273.1382222204.18130.python-list@python.org> |
| In reply to | #57120 |
On Sun, Oct 20, 2013 at 9:12 AM, Pratik Mehta <pratik.mehta13390@gmail.com> wrote: > Command + Shift + 5 ==> This one is a little bit tricky which I am looking for. This shortcut doesn't exist. I want to create one of my own, where it would grab the entire webpage's screenshot which I am currently working on, and store the name as the webpage's link. Sounds like a difficult thing to write from scratch. Can you find something off-the-shelf that takes a snapshot of your current window, and then maybe add some interaction with the web browser? Otherwise, you're poking around with screenshotting directly, which is very much a solved problem. Also, please read this before you reply: https://wiki.python.org/moin/GoogleGroupsPython ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Ned Deily <nad@acm.org> |
|---|---|
| Date | 2013-10-19 15:42 -0700 |
| Message-ID | <mailman.1274.1382222584.18130.python-list@python.org> |
| In reply to | #57120 |
In article <22861e2f-50f2-4d74-9024-53caec5570fa@googlegroups.com>, Pratik Mehta <pratik.mehta13390@gmail.com> wrote: > I want to write my own Screenshot Taking program in Python for Mac OS X. > > Example : Whenever Command + Shift + 3 is pressed ==> whatever is there on > the screen, should be grabbed / captured, and should be stored on my local > with my own desired path, and name should automatically given as SnapshotX.. > as in Snapshot1, Snapshot2, etc... > > The same goes with Command + Shift + 4 ==> the only difference is that, it > allows you to select a particular area to be captured / grabbed. > > Command + Shift + 5 ==> This one is a little bit tricky which I am looking > for. This shortcut doesn't exist. I want to create one of my own, where it > would grab the entire webpage's screenshot which I am currently working on, > and store the name as the webpage's link. I'm not sure how much what you want to do differs from what OS X already provides out of the box but perhaps this reference can give you some ideas: http://guides.macrumors.com/Taking_Screenshots_in_Mac_OS_X -- Ned Deily, nad@acm.org
[toc] | [prev] | [next] | [standalone]
| From | Pratik Mehta <pratik.mehta13390@gmail.com> |
|---|---|
| Date | 2013-10-19 16:17 -0700 |
| Message-ID | <c9f78d38-dd10-49cd-8a95-70e5c413a72b@googlegroups.com> |
| In reply to | #57127 |
Hey Ned, Thanks for reverting. I am looking for the similar functionality. Thanks for sharing that link. Could you pls help me out with the Python Code? Thanks. :)
[toc] | [prev] | [next] | [standalone]
| From | Pratik Mehta <pratik.mehta13390@gmail.com> |
|---|---|
| Date | 2013-10-22 13:15 -0700 |
| Message-ID | <03db6a3f-3b1c-4516-8bee-4e3a362ebcf6@googlegroups.com> |
| In reply to | #57132 |
Anyone there to help me out???
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2013-10-22 21:30 +0100 |
| Message-ID | <mailman.1380.1382473872.18130.python-list@python.org> |
| In reply to | #57309 |
On 22/10/2013 21:15, Pratik Mehta wrote: > Anyone there to help me out??? > There are plenty of people who will help you out, but if and only if you make an attempt at writing some code and then ask for assistance when you run into problems. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Pratik Mehta <pratik.mehta13390@gmail.com> |
|---|---|
| Date | 2013-10-22 17:22 -0700 |
| Message-ID | <7229d8eb-3aba-47d6-af8d-52126338945a@googlegroups.com> |
| In reply to | #57312 |
Hey Mark,
Thanks for reverting.
I had tried coding it using os.system("screencapture -s /filepath") // for selecting a particular region..
I have replied to Kevin's comment, that's exactly what I am looking for. :)
Thanks ...
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2013-10-23 07:04 +0100 |
| Message-ID | <mailman.1391.1382508270.18130.python-list@python.org> |
| In reply to | #57330 |
On 23/10/2013 01:22, Pratik Mehta wrote:
> Hey Mark,
>
> Thanks for reverting.
>
> I had tried coding it using os.system("screencapture -s /filepath") // for selecting a particular region..
>
>
> I have replied to Kevin's comment, that's exactly what I am looking for. :)
>
>
> Thanks ...
>
Assuming that you're talking to me, no problem.
Do you mean "replying" and not "reverting", as I observe that you've
used this elsewhere?
--
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Metallicow <metaliobovinus@gmail.com> |
|---|---|
| Date | 2013-10-23 21:00 -0700 |
| Message-ID | <a8c08c90-7a23-4740-bbf7-acccb0cb7103@googlegroups.com> |
| In reply to | #57338 |
Well, I'm not going to post my whole module as I get little testing on mac, but I will let you in on a little secret: Use a GUI, such as wxPython or QT or other, then create a basic fullscreen frame that is invisible and copy its DC to the clipboard. Not exactly a hack(might be edgy), but it works. Writing the gui/logic code will be up to you. here is a basic wx example f = wxFrame(None, -1) f.Show(True) f.SetTransparent(0) # Bind your hotkeys to capture the screen. Also, not sure ATM... but I recall someone wrote a cross platform screenshot implementation IIRC that replaces PIL's ImageGrab module, I think it is pyscreenshot or something similar. You might want to look into that.
[toc] | [prev] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2013-10-22 21:50 +0000 |
| Message-ID | <l46ruq$if$1@reader1.panix.com> |
| In reply to | #57309 |
In <03db6a3f-3b1c-4516-8bee-4e3a362ebcf6@googlegroups.com> Pratik Mehta <pratik.mehta13390@gmail.com> writes: > Anyone there to help me out??? Command-Shift-3 takes a screenshot of the whole screen and saves it as a file on the desktop. Command-Control-Shift-3: takes a screenshot of the whole screen and saves it to the clipboard. For other options (such as taking a screenshot of a window or a specific region on the screen), see http://guides.macrumors.com/Taking_Screenshots_in_Mac_OS_X I wonder what this has to do with Python though. -- John Gordon Imagine what it must be like for a real medical doctor to gordon@panix.com watch 'House', or a real serial killer to watch 'Dexter'.
[toc] | [prev] | [next] | [standalone]
| From | Pratik Mehta <pratik.mehta13390@gmail.com> |
|---|---|
| Date | 2013-10-22 17:14 -0700 |
| Message-ID | <c37d3f98-7cc1-4608-a140-f7d5411a8b8d@googlegroups.com> |
| In reply to | #57317 |
Hey John, I want to code my own Snapshot taking program using Python. Hence, had posted this question...
[toc] | [prev] | [next] | [standalone]
| From | Kevin Walzer <kw@codebykevin.com> |
|---|---|
| Date | 2013-10-22 18:08 -0400 |
| Message-ID | <l46t1c$a1g$1@dont-email.me> |
| In reply to | #57309 |
On 10/22/13 4:15 PM, Pratik Mehta wrote:
> Anyone there to help me out???
>
import os
os.system('screencapture', 'foo.png')
--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
[toc] | [prev] | [next] | [standalone]
| From | Kevin Walzer <kw@codebykevin.com> |
|---|---|
| Date | 2013-10-22 18:16 -0400 |
| Message-ID | <l46tgp$dnb$1@dont-email.me> |
| In reply to | #57321 |
On 10/22/13 6:08 PM, Kevin Walzer wrote:
> On 10/22/13 4:15 PM, Pratik Mehta wrote:
>> Anyone there to help me out???
>>
>
> import os
> os.system('screencapture', 'foo.png')
>
>
...and see 'man screencapture' for options.
I leave setting up a Tkinter GUI with proper key bindings as an exercise
for the reader.
--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
[toc] | [prev] | [next] | [standalone]
| From | Pratik Mehta <pratik.mehta13390@gmail.com> |
|---|---|
| Date | 2013-10-22 17:19 -0700 |
| Message-ID | <53dafc51-2e8f-46a0-9f7f-8aaf4c2d31c0@googlegroups.com> |
| In reply to | #57324 |
Hey Kevin, Thanks for reverting. I know about the "screencapture" function and the parameters available. But, how would I take the user input, as in, that is just command-line, as soon as I execute the program, it will take whatever kind of parameter is passed under screencapture. I want that, in the same program, if the user presses Shift+Command+3, whole screenshot should be taken. When, Shift + Command + 4 is pressed, a particular frame should be displayed to select the area / region. Also, I want to create my own command : Shift + Command + 5 ==> this is specially for web browser, whenever I press this key on any of the web-page, the whole web page should be grabbed along with its snapshot, and snapshot's filename should be web-page's url which I am currently on. Also, this process should be executing at the backend, so that, whenever these keys are pressed, it overrides the system's functionality and uses mine.
[toc] | [prev] | [next] | [standalone]
| From | Kevin Walzer <kw@codebykevin.com> |
|---|---|
| Date | 2013-10-22 21:06 -0400 |
| Message-ID | <l477eh$q12$1@dont-email.me> |
| In reply to | #57329 |
On 10/22/13 8:19 PM, Pratik Mehta wrote: > Hey Kevin, > > Thanks for reverting. > > I know about the "screencapture" function and the parameters available. > > But, how would I take the user input, as in, that is just command-line, as soon as I execute the program, it will take whatever kind of parameter is passed under screencapture. > > I want that, in the same program, if the user presses Shift+Command+3, whole screenshot should be taken. > > When, Shift + Command + 4 is pressed, a particular frame should be displayed to select the area / region. > > Also, I want to create my own command : Shift + Command + 5 ==> this is specially for web browser, whenever I press this key on any of the web-page, the whole web page should be grabbed along with its snapshot, and snapshot's filename should be web-page's url which I am currently on. > > Also, this process should be executing at the backend, so that, whenever these keys are pressed, it overrides the system's functionality and uses mine. > There are no simple answers to these questions. With Tkinter, it's possible to code a basic UI and bind combinations of specific keys to trigger specific callbacks, which can fire specific sequences of arguments to the screencapture CLI tool. That's the quick and dirty way. I'm not going to write this code for you. Look at TkDocs.com and effbot's site for an introduction to Tkinter. If you are not looking for a GUI app to do this, but some sort of system-level daemon, that requires a lower level of coding. You'll need to look at such system frameworks as CoreGraphics and Cocoa to find the API's you need. PyObjC (Python binding to Cocoa) can probably be helpful here. Frankly, I'm not sure Python is the best tool here, but if you go this route, you want a Python API that hews as closely to the system-level calls as possible, and PyObjC will likely be your best path here. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web