Re: [Tutor] Python Image Library

2017-05-19 Thread Alan Gauld via Tutor
On 19/05/17 15:15, Peter Otten wrote: > call the destroy() rather than the quit() method. Nice! > > However, as your code gets away without calling destroy() I'm still > puzzled... withdraw hides the window then quit ends the mainloop so the procedure falls through to the end and everything

Re: [Tutor] Python Image Library

2017-05-19 Thread Peter Otten
Alan Gauld via Tutor wrote: > On 18/05/17 18:06, Alan Gauld via Tutor wrote: > >> Here is some untested Tkinter code to display an image >> for 2 seconds: > > I tried this last night and it turned out to be harder > than I expected. Eventually I got to bed at 3am! But here > is something that

Re: [Tutor] Python Image Library

2017-05-19 Thread Alan Gauld via Tutor
On 19/05/17 10:29, Alan Gauld via Tutor wrote: > is something that seems to work for jpegs. I hope bmp files > will too, I didn't have any to test... I converted a few jpg to bmp. It does work but it turns out Pillow is quite fussy about the BMP format. I had to turn off colour space header info

Re: [Tutor] Python Image Library

2017-05-19 Thread Alan Gauld via Tutor
On 18/05/17 18:06, Alan Gauld via Tutor wrote: > Here is some untested Tkinter code to display an image > for 2 seconds: I tried this last night and it turned out to be harder than I expected. Eventually I got to bed at 3am! But here is something that seems to work for jpegs. I hope bmp files

Re: [Tutor] Python Image Library

2017-05-18 Thread Michael C
I'll use it when I get to it! Thanks! For now, I use this, as suggested by eryk sun: os.startfile('1.bmp') it doesn't pop the window. Thanks Alan! On Thu, May 18, 2017 at 10:06 AM, Alan Gauld via Tutor wrote: > On 18/05/17 16:43, Michael C wrote: > > os.startfile('1.bmp')

Re: [Tutor] Python Image Library

2017-05-18 Thread Alan Gauld via Tutor
On 18/05/17 16:43, Michael C wrote: > os.startfile('1.bmp') > > works like a charm! > > Now I need to figure out how to close this window once I finish with it! Sadly that is manual. Unless you care to write code to search for the process and use the Windows API to kill it off. If you really

Re: [Tutor] Python Image Library

2017-05-18 Thread Michael C
os.startfile('1.bmp') works like a charm! Now I need to figure out how to close this window once I finish with it! On Thu, May 18, 2017 at 8:14 AM, Michael C wrote: > Oh I have been using Pillow 4.0 the whole time alright, sorry I forgot to > mention it. > > On

Re: [Tutor] Python Image Library

2017-05-18 Thread Michael C
Did you go into the source code of PIL/Pillow? Awesome!!! On Wed, May 17, 2017 at 7:52 PM, eryk sun wrote: > On Thu, May 18, 2017 at 1:58 AM, Michael C > wrote: > > when I run this, while it's called test.pyw, this pops up > > > > from PIL

Re: [Tutor] Python Image Library

2017-05-18 Thread Michael C
Oh I have been using Pillow 4.0 the whole time alright, sorry I forgot to mention it. On Thu, May 18, 2017 at 1:55 AM, Alan Gauld via Tutor wrote: > On 18/05/17 02:58, Michael C wrote: > > when I run this, while it's called test.pyw, this pops up > > > > from PIL import Image

Re: [Tutor] Python Image Library

2017-05-18 Thread Alan Gauld via Tutor
On 18/05/17 02:58, Michael C wrote: > when I run this, while it's called test.pyw, this pops up > > from PIL import Image > > im = Image.open('1.bmp') > im.show() One suggestion is to use Pillow instead of PIL. So far as I know PIL is frozen and all new development is on Pillow. It is

Re: [Tutor] Python Image Library

2017-05-18 Thread Michael C
when I run this, while it's called test.pyw, this pops up from PIL import Image im = Image.open('1.bmp') im.show() [image: Inline image 1] On Wed, May 17, 2017 at 6:51 PM, eryk sun wrote: > On Wed, May 17, 2017 at 10:33 PM, Michael C >

Re: [Tutor] Python Image Library

2017-05-17 Thread eryk sun
On Thu, May 18, 2017 at 1:58 AM, Michael C wrote: > when I run this, while it's called test.pyw, this pops up > > from PIL import Image > > im = Image.open('1.bmp') > im.show() Ok, I stand corrected. It's something weird, and most likely due to Windows support

Re: [Tutor] Python Image Library

2017-05-17 Thread eryk sun
On Wed, May 17, 2017 at 10:33 PM, Michael C wrote: > On Wed, May 17, 2017 at 3:30 PM, eryk sun wrote: > >> You're probably running a .py script that's associated with py.exe or >> python.exe. These executables create a new console (i.e. an

Re: [Tutor] Python Image Library

2017-05-17 Thread Michael C
Actually, that is the whole script! I didn't get used to have the cmd.exe window pop up at all, could it be something I did? Or, is there a way to suppress that from showing up? thanks! On Wed, May 17, 2017 at 3:30 PM, eryk sun wrote: > On Wed, May 17, 2017 at 8:24 PM,

Re: [Tutor] Python Image Library

2017-05-17 Thread eryk sun
On Wed, May 17, 2017 at 8:24 PM, Michael C wrote: > from PIL import Image > > im = Image.open('pic.bmp') > im.show() > > I ran this code and it not only opened the picture in paint, which is what > I want, but it also opens a CMD.exe console window! how do I

[Tutor] Python Image Library

2017-05-17 Thread Michael C
from PIL import Image im = Image.open('pic.bmp') im.show() I ran this code and it not only opened the picture in paint, which is what I want, but it also opens a CMD.exe console window! how do I prevent that from happening? thanks! ___ Tutor

Re: [Tutor] Python Image Library

2017-05-17 Thread Michael C
in fact, when I ran this: import os os.system("mspaint 1.bmp") It also opened a cmd.exe window and the script wouldn't continue until I closed the cmd window! On Wed, May 17, 2017 at 1:24 PM, Michael C wrote: > from PIL import Image > > > im =

[Tutor] Python Image library

2007-07-18 Thread elis aeris
import time import ImageGrab # Part of PIL from ctypes import * # Load up the Win32 APIs we need to use. class RECT(Structure): _fields_ = [ ('left', c_ulong), ('top', c_ulong), ('right', c_ulong), ('bottom', c_ulong) ] # time.sleep(2) GetForegroundWindow =

Re: [Tutor] Python Image library

2007-07-18 Thread Tiger12506
You know the height and the width of the image, no? So you know that every 'width' number of pixels will start a new row. So if you wanted say the fifth row down, second pixel, how would you find it? The 1st line: 'width' number of pixels The 2nd line: 'width' number of pixels The 3rd line:

Re: [Tutor] Python Image library

2007-07-18 Thread elis aeris
ahh~ it goes horizontally first why didn't I think of that? thank you ~ On 7/19/07, Tiger12506 [EMAIL PROTECTED] wrote: You know the height and the width of the image, no? So you know that every 'width' number of pixels will start a new row. So if you wanted say the fifth row down, second

Re: [Tutor] Python Image library

2007-07-18 Thread Luke Paireepinart
Tiger12506 wrote: You know the height and the width of the image, no? So you know that every 'width' number of pixels will start a new row. So if you wanted say the fifth row down, second pixel, how would you find it? The 1st line: 'width' number of pixels The 2nd line: 'width' number of

Re: [Tutor] Python Image library

2007-07-18 Thread elis aeris
that's illustrative. On 7/19/07, Luke Paireepinart [EMAIL PROTECTED] wrote: Tiger12506 wrote: You know the height and the width of the image, no? So you know that every 'width' number of pixels will start a new row. So if you wanted say the fifth row down, second pixel, how would you find

Re: [Tutor] Python Image library

2007-07-18 Thread Tiger12506
if you start counting at the 0th row and 0th column, this will give you the 4th row and 2nd column. if you're counting from the 1st row and 1st column, this will give you the 5th row and 3rd column. That number is the index to use to get the pixel at coords (2,5) So this is actually