Re: PIL implementation
arkestra wrote: > The error message is --> "Syntax error" and it highlights the last > "else" statement. You've got incorrect indentation, at least judging by what I see in my newsreader (Thunderbird), which clearly shows the else indented more than the corresponding if. Next time, please cut and paste the *actual* error message instead of retyping and paraphrasing. That will get you a faster answer and save us lots of annoying guessing. -- http://mail.python.org/mailman/listinfo/python-list
Re: PIL implementation
The error message is --> "Syntax error" and it highlights the last "else" statement. thanks for the reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: PIL implementation
The error message is --> "Syntax error" and it highlights the last "else" statement. -- http://mail.python.org/mailman/listinfo/python-list
Re: PIL implementation
circusdei wrote: > I wrote this snippet with the intention of -- capturing a section of > the screen whenever it changes. It could be implemented to log any > sort of messaging system ( by saving consecutive images eg. > 1.png...etc). > > #code > > import Image > import ImageGrab > lastchatbound = (21, 504) + (189, 516) > img1 = ImageGrab.grab(lastchatbound) > data1 = list(img1.getdata()) > img2 = ImageGrab.grab(lastchatbound) > data2 = list(img2.getdata()) > # print `data1` pictnumber = 0 > if data1 != data2: > img1.save(`picnumber` + '.png') > picnumber = picnumber + 1 > else: > print "same" > > #code -- > > it doesn't work yet and i'm not quite sure how the loops work yet ( i > just sarted python last week). any help anyone could give me would be > appreciated. > > if someone could rewrite it so it works, i could use that as an example > for the future, thanks. > > - mb > At the first glance the code looks almost ok. It is a good habit always to attach documentation of the error messages if any. What I can directly see is, that you need at least to initialize the picnumber (see above). Look in the Python documentation for the chapter with loops, read about the time module you will need to let the loop pause before taking the next screenshot and consider also, that maybe later it would be a good idea to have a way to stop the loop executing. Come back with the next revision of your code for further help if you get into trouble or wait until someone else provides you with appropriate working code. Claudio -- http://mail.python.org/mailman/listinfo/python-list
PIL implementation
I wrote this snippet with the intention of -- capturing a section of the screen whenever it changes. It could be implemented to log any sort of messaging system ( by saving consecutive images eg. 1.png...etc). #code import Image import ImageGrab lastchatbound = (21, 504) + (189, 516) img1 = ImageGrab.grab(lastchatbound) data1 = list(img1.getdata()) img2 = ImageGrab.grab(lastchatbound) data2 = list(img2.getdata()) # print `data1` if data1 != data2: img1.save(`picnumber` + '.png') picnumber = picnumber + 1 else: print "same" #code -- it doesn't work yet and i'm not quite sure how the loops work yet ( i just sarted python last week). any help anyone could give me would be appreciated. if someone could rewrite it so it works, i could use that as an example for the future, thanks. - mb -- http://mail.python.org/mailman/listinfo/python-list