[Tutor] Python Image Library

Michael C mysecretrobotfactory at gmail.com
Thu May 18 13:13:29 EDT 2017


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 <tutor at python.org>
wrote:

> 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 want the image under your programs control you
> need to build a GUI, even if a very basic one and display
> the image in a window. A very simplistic Tkinter app will
> do for simply splatting an image on screen then closing
> it later. But it all depends what else you need the app to
> do how complex it gets after that.
>
> Here is some untested Tkinter code to display an image
> for 2 seconds:
>
> import tkinter as tk
>
> top = tk.Tk()
> tk.Label(top, image='1.bmp').pack()
> top.after(2000, top.quit)
>
> top.mainloop()
>
> If not that, something quite like it...
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list