Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 20th, 2004, 10:57 PM
Noah_C Noah_C is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 34 Noah_C User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 31 sec
Reputation Power: 5
Screen Shot Question

I'm looking for some help getting python to take a screenshot. I searched online for something, but couldn't find anything. I checked the PIL as well. I basically want python to do the following:

1. Notice movement on the screen
2. take a screen shot
3. Pass it on to a few if/else statements
4. Click on the screen a particular button.

1,2, and 4 I am unsure how to impliment, but using the PIL I can figure out 3.

Reply With Quote
  #2  
Old November 21st, 2004, 12:13 PM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Quote:
Originally Posted by Noah_C
I'm looking for some help getting python to take a screenshot. I searched online for something, but couldn't find anything. I checked the PIL as well. I basically want python to do the following:

1. Notice movement on the screen
2. take a screen shot
3. Pass it on to a few if/else statements
4. Click on the screen a particular button.

1,2, and 4 I am unsure how to impliment, but using the PIL I can figure out 3.


I think the better way of doing this is not by taking screenshots (since those often don't include the cursor and presumably you want to watch for cursor movement), but rather hooking into whatever window system the user is using. Whether it be the Win32 system or the X Window System or Aqua (or whatever the Mac OS windowing system is).
__________________
Debian - because life's too short for worrying.
Best. (Python.) IRC bot. ever.

Reply With Quote
  #3  
Old November 21st, 2004, 01:04 PM
Noah_C Noah_C is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 34 Noah_C User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 31 sec
Reputation Power: 5
Well, I basically want to be able to play perfect blackjack in windows. So I basically would have it do the following steps.


1. Take screen shot
2. know that from (x,y) to (x,y) by (x,y) to (x,y) is card1, and then do that for all cards displayed.
3. Pass that information on to some programming logic
4. Respond by clicking a button in the program

Is the win32 route still the right route to take ?

Thank you for your suggestion.

Reply With Quote
  #4  
Old November 21st, 2004, 03:23 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Quote:
Originally Posted by Strike
I think the better way of doing this is not by taking screenshots (since those often don't include the cursor and presumably you want to watch for cursor movement), but rather hooking into whatever window system the user is using. Whether it be the Win32 system or the X Window System or Aqua (or whatever the Mac OS windowing system is).


Yup, Mac OS X's Native Window System is called Aqua. But there's also a Mac port/application called X11 which is used to run X Window programs inside Mac OS X . Tend to be a little crappy looking though.

http://www.apple.com/macosx/features/x11/
http://www.apple.com/macosx/features/quartzextreme/
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #5  
Old November 23rd, 2004, 06:51 PM
Noah_C Noah_C is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 34 Noah_C User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 31 sec
Reputation Power: 5
I found what I'm looking for.... PIL Handbook

the Imagegrab.grab is what is needed, but I'm not sure how to use it. why won't the following code work ?

Code:
import sys
import ImageGrab
ImageGrab.grab(x0, y0, x1, y1) = im
im.show()

Reply With Quote
  #6  
Old November 24th, 2004, 04:36 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
Doesn't this require image recognition?
How will your program know what cards are dealt, are face up, in the pile etc?

hmmm ... You image grab assignment is a*** about face.

grim
__________________
*** Experimental Python Markup CGI V2 ***

Last edited by Grim Archon : November 24th, 2004 at 04:48 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Screen Shot Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT