that's enough

classic Classic list List threaded Threaded
49 messages Options
123
Reply | Threaded
Open this post in threaded view
|

that's enough

Jack Uretsky
Hi-
  The following worked very well:
>>> import Image
>>> d = Image.open("a_1.jpg")
>>> d.show()
>>>

  Now, how do I turn
  it off before showing another image
  I'm on an Intel Mac, OS X Snow Leopard.
  Regards,
  Jack U.
"Trust me.  I have a lot of experience at this."
  General Custer's unremembered message to his men,
  just before leading them into the Little Big Horn Valley



_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

pontissimo
My understanding is that show() is mainly for debugging and tests, and that it doesn't offer very much control or efficiency. That's not to say that what you're after can't be done, maybe someone else can help you with that, I just don't know.

Personally I'd suggest using WXPython, which can do what you're after fairly easily.

Here's one very simple way to display an image in WX:

import wx

class PictureWindow(wx.Frame):
..def __init__(self, parent, id):

....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos = (50, 50), style = wx.DEFAULT_FRAME_STYLE)
....panel = wx.Panel(self, -1)
....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap()
....self.mainPic = wx.StaticBitmap(panel, -1, bmp)
....self.Show()

app = wx.App(redirect=0)
PictureWindow(None, -1)
app.MainLoop()





On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky <[hidden email]> wrote:
Hi-
       The following worked very well:
import Image
d = Image.open("a_1.jpg")
d.show()


       Now, how do I turn
 it off before showing another image
       I'm on an Intel Mac, OS X Snow Leopard.
                       Regards,
                               Jack U.
"Trust me.  I have a lot of experience at this."
               General Custer's unremembered message to his men,
               just before leading them into the Little Big Horn Valley



_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Jack Uretsky
Thanks.  Do you have a recommendation for which veersion of wxpython I
should download for Mac OS X Snow Leopard (10.6)?
  Regards,
  Jack

"Trust me.  I have a lot of experience at this."
  General Custer's unremembered message to his men,
  just before leading them into the Little Big Horn Valley




On Mon, 12 Jul 2010, Alec Bennett wrote:

> My understanding is that show() is mainly for debugging and tests, and that
> it doesn't offer very much control or efficiency. That's not to say that
> what you're after can't be done, maybe someone else can help you with that,
> I just don't know.
>
> Personally I'd suggest using WXPython, which can do what you're after fairly
> easily.
>
> Here's one very simple way to display an image in WX:
>
> import wx
>
> class PictureWindow(wx.Frame):
> ..def __init__(self, parent, id):
>
> ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos
> = (50, 50), style = wx.DEFAULT_FRAME_STYLE)
> ....panel = wx.Panel(self, -1)
> ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap()
> ....self.mainPic = wx.StaticBitmap(panel, -1, bmp)
> ....self.Show()
>
> app = wx.App(redirect=0)
> PictureWindow(None, -1)
> app.MainLoop()
>
>
>
>
>
> On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky <[hidden email]> wrote:
>
>> Hi-
>>        The following worked very well:
>>
>>>  import Image
>>>>> d = Image.open("a_1.jpg")
>>>>> d.show()
>>>>>
>>>>>
>>        Now, how do I turn
>>  it off before showing another image
>>        I'm on an Intel Mac, OS X Snow Leopard.
>>                        Regards,
>>                                Jack U.
>> "Trust me.  I have a lot of experience at this."
>>                General Custer's unremembered message to his men,
>>                just before leading them into the Little Big Horn Valley
>>
>>
>>
>> _______________________________________________
>> Image-SIG maillist  -  [hidden email]
>> http://mail.python.org/mailman/listinfo/image-sig
>>
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Chris Barker
Jack Uretsky wrote:
> Thanks.  Do you have a recommendation for which veersion of wxpython I
> should download for Mac OS X Snow Leopard (10.6)?
>             Regards,
>                 Jack

Use the OS-X installer for the latest version found at the wxpython site.

I *think* it will work with either the Apple-supplied python or the
python.org one, but it's possible that that is broken on 10.6 -- I heard
a lot of issues on 10.6 (I'm running 10.5, so no no details).

I'd install python 2.6 from python.org, and use the wxpython installer
for that. That combination is the safest.

This might be useful, too:

http://wiki.wxpython.org/RecipesImagesAndGraphics

Note that wxPython has some basic image stuff built in, so depending on
what you need to do, you may not even need PIL. (but you may -- PIL is
far more full featured)

Oh, and I've enclosed a slightly more complex example.

-Chris





> "Trust me.  I have a lot of experience at this."
>         General Custer's unremembered message to his men,
>         just before leading them into the Little Big Horn Valley
>
>
>
>
> On Mon, 12 Jul 2010, Alec Bennett wrote:
>
>> My understanding is that show() is mainly for debugging and tests, and
>> that
>> it doesn't offer very much control or efficiency. That's not to say that
>> what you're after can't be done, maybe someone else can help you with
>> that,
>> I just don't know.
>>
>> Personally I'd suggest using WXPython, which can do what you're after
>> fairly
>> easily.
>>
>> Here's one very simple way to display an image in WX:
>>
>> import wx
>>
>> class PictureWindow(wx.Frame):
>> ..def __init__(self, parent, id):
>>
>> ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200,
>> 200), pos
>> = (50, 50), style = wx.DEFAULT_FRAME_STYLE)
>> ....panel = wx.Panel(self, -1)
>> ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap()
>> ....self.mainPic = wx.StaticBitmap(panel, -1, bmp)
>> ....self.Show()
>>
>> app = wx.App(redirect=0)
>> PictureWindow(None, -1)
>> app.MainLoop()
>>
>>
>>
>>
>>
>> On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky <[hidden email]> wrote:
>>
>>> Hi-
>>>        The following worked very well:
>>>
>>>>  import Image
>>>>>> d = Image.open("a_1.jpg")
>>>>>> d.show()
>>>>>>
>>>>>>
>>>        Now, how do I turn
>>>  it off before showing another image
>>>        I'm on an Intel Mac, OS X Snow Leopard.
>>>                        Regards,
>>>                                Jack U.
>>> "Trust me.  I have a lot of experience at this."
>>>                General Custer's unremembered message to his men,
>>>                just before leading them into the Little Big Horn Valley
>>>
>>>
>>>
>>> _______________________________________________
>>> Image-SIG maillist  -  [hidden email]
>>> http://mail.python.org/mailman/listinfo/image-sig
>>>
>>
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig

StaticBitmap.py (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

pontissimo
Not to beat a dead horse, but yet another option is to use os.startfile(fname), which will launch it in your computer's default image viewer. Maybe find a program that will limit itself to a single instance, and then you won't wind up with 20 windows open if you're showing a lot of images.

But still, wxpython is a really powerful and useful tool once you get past the early part of its learning curve.




On Tue, Jul 13, 2010 at 11:35 AM, Christopher Barker <[hidden email]> wrote:
Jack Uretsky wrote:
Thanks.  Do you have a recommendation for which veersion of wxpython I should download for Mac OS X Snow Leopard (10.6)?
           Regards,
               Jack

Use the OS-X installer for the latest version found at the wxpython site.

I *think* it will work with either the Apple-supplied python or the python.org one, but it's possible that that is broken on 10.6 -- I heard a lot of issues on 10.6 (I'm running 10.5, so no no details).

I'd install python 2.6 from python.org, and use the wxpython installer for that. That combination is the safest.

This might be useful, too:

http://wiki.wxpython.org/RecipesImagesAndGraphics

Note that wxPython has some basic image stuff built in, so depending on what you need to do, you may not even need PIL. (but you may -- PIL is far more full featured)

Oh, and I've enclosed a slightly more complex example.

-Chris






"Trust me.  I have a lot of experience at this."
       General Custer's unremembered message to his men,
       just before leading them into the Little Big Horn Valley




On Mon, 12 Jul 2010, Alec Bennett wrote:

My understanding is that show() is mainly for debugging and tests, and that
it doesn't offer very much control or efficiency. That's not to say that
what you're after can't be done, maybe someone else can help you with that,
I just don't know.

Personally I'd suggest using WXPython, which can do what you're after fairly
easily.

Here's one very simple way to display an image in WX:

import wx

class PictureWindow(wx.Frame):
..def __init__(self, parent, id):

....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos
= (50, 50), style = wx.DEFAULT_FRAME_STYLE)
....panel = wx.Panel(self, -1)
....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap()
....self.mainPic = wx.StaticBitmap(panel, -1, bmp)
....self.Show()

app = wx.App(redirect=0)
PictureWindow(None, -1)
app.MainLoop()





On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky <[hidden email]> wrote:

Hi-
      The following worked very well:

 import Image
d = Image.open("a_1.jpg")
d.show()


      Now, how do I turn
 it off before showing another image
      I'm on an Intel Mac, OS X Snow Leopard.
                      Regards,
                              Jack U.
"Trust me.  I have a lot of experience at this."
              General Custer's unremembered message to his men,
              just before leading them into the Little Big Horn Valley



_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig


--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig



_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Yury V. Zaytsev
In reply to this post by Jack Uretsky
... or you can go for matplotlib and use its plot function to display
PIL images using the NumPy array interface (see my previous postings on
this list):

import Image
import numpy as np
import pylab as pyl

if __name__ == "__main__":

    img_name = 'ch43_roi.tiff'
    img = Image.open(img_name)

    a = np.asarray(img)
    p = a.copy().transpose((1, 0, 2))

    pyl.imshow(p)
    pyl.show()
 
--
Sincerely yours,
Yury V. Zaytsev

On Sun, 2010-07-11 at 18:16 -0500, Jack Uretsky wrote:

> Hi-
>   The following worked very well:
> >>> import Image
> >>> d = Image.open("a_1.jpg")
> >>> d.show()
> >>>
>
>   Now, how do I turn
>   it off before showing another image
>   I'm on an Intel Mac, OS X Snow Leopard.
>   Regards,
>   Jack U.
> "Trust me.  I have a lot of experience at this."
>   General Custer's unremembered message to his men,
>   just before leading them into the Little Big Horn Valley
>
>
>
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Stani-2
In reply to this post by pontissimo
os.startfile is only available on Windows, so it won't work on Mac OS
X or Linux:
http://docs.python.org/library/os.html#os.startfile

On Wed, Jul 14, 2010 at 8:59 AM, Alec Bennett <[hidden email]> wrote:

> Not to beat a dead horse, but yet another option is to use
> os.startfile(fname), which will launch it in your computer's default image
> viewer. Maybe find a program that will limit itself to a single instance,
> and then you won't wind up with 20 windows open if you're showing a lot of
> images.
>
> But still, wxpython is a really powerful and useful tool once you get past
> the early part of its learning curve.
>
>
>
>
> On Tue, Jul 13, 2010 at 11:35 AM, Christopher Barker <[hidden email]>
> wrote:
>>
>> Jack Uretsky wrote:
>>>
>>> Thanks.  Do you have a recommendation for which veersion of wxpython I
>>> should download for Mac OS X Snow Leopard (10.6)?
>>>            Regards,
>>>                Jack
>>
>> Use the OS-X installer for the latest version found at the wxpython site.
>>
>> I *think* it will work with either the Apple-supplied python or the
>> python.org one, but it's possible that that is broken on 10.6 -- I heard a
>> lot of issues on 10.6 (I'm running 10.5, so no no details).
>>
>> I'd install python 2.6 from python.org, and use the wxpython installer for
>> that. That combination is the safest.
>>
>> This might be useful, too:
>>
>> http://wiki.wxpython.org/RecipesImagesAndGraphics
>>
>> Note that wxPython has some basic image stuff built in, so depending on
>> what you need to do, you may not even need PIL. (but you may -- PIL is far
>> more full featured)
>>
>> Oh, and I've enclosed a slightly more complex example.
>>
>> -Chris
>>
>>
>>
>>
>>
>>> "Trust me.  I have a lot of experience at this."
>>>        General Custer's unremembered message to his men,
>>>        just before leading them into the Little Big Horn Valley
>>>
>>>
>>>
>>>
>>> On Mon, 12 Jul 2010, Alec Bennett wrote:
>>>
>>>> My understanding is that show() is mainly for debugging and tests, and
>>>> that
>>>> it doesn't offer very much control or efficiency. That's not to say that
>>>> what you're after can't be done, maybe someone else can help you with
>>>> that,
>>>> I just don't know.
>>>>
>>>> Personally I'd suggest using WXPython, which can do what you're after
>>>> fairly
>>>> easily.
>>>>
>>>> Here's one very simple way to display an image in WX:
>>>>
>>>> import wx
>>>>
>>>> class PictureWindow(wx.Frame):
>>>> ..def __init__(self, parent, id):
>>>>
>>>> ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200),
>>>> pos
>>>> = (50, 50), style = wx.DEFAULT_FRAME_STYLE)
>>>> ....panel = wx.Panel(self, -1)
>>>> ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap()
>>>> ....self.mainPic = wx.StaticBitmap(panel, -1, bmp)
>>>> ....self.Show()
>>>>
>>>> app = wx.App(redirect=0)
>>>> PictureWindow(None, -1)
>>>> app.MainLoop()
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky <[hidden email]> wrote:
>>>>
>>>>> Hi-
>>>>>       The following worked very well:
>>>>>
>>>>>>  import Image
>>>>>>>>
>>>>>>>> d = Image.open("a_1.jpg")
>>>>>>>> d.show()
>>>>>>>>
>>>>>>>>
>>>>>       Now, how do I turn
>>>>>  it off before showing another image
>>>>>       I'm on an Intel Mac, OS X Snow Leopard.
>>>>>                       Regards,
>>>>>                               Jack U.
>>>>> "Trust me.  I have a lot of experience at this."
>>>>>               General Custer's unremembered message to his men,
>>>>>               just before leading them into the Little Big Horn Valley
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Image-SIG maillist  -  [hidden email]
>>>>> http://mail.python.org/mailman/listinfo/image-sig
>>>>>
>>>>
>>> _______________________________________________
>>> Image-SIG maillist  -  [hidden email]
>>> http://mail.python.org/mailman/listinfo/image-sig
>>
>>
>> --
>> Christopher Barker, Ph.D.
>> Oceanographer
>>
>> Emergency Response Division
>> NOAA/NOS/OR&R            (206) 526-6959   voice
>> 7600 Sand Point Way NE   (206) 526-6329   fax
>> Seattle, WA  98115       (206) 526-6317   main reception
>>
>> [hidden email]
>>
>> _______________________________________________
>> Image-SIG maillist  -  [hidden email]
>> http://mail.python.org/mailman/listinfo/image-sig
>>
>
>
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig
>
>



--
Phatch Photo Batch Processor - http://photobatch.stani.be
SPE Python IDE - http://pythonide.stani.be
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Jack Uretsky
In reply to this post by Yury V. Zaytsev
Hi all-
  I'n trying to find a binary veersion of matplotlib that I can
install on my OS X Snow Leopard.  I keep ending up at SourceForg, which
has no downlo0ad that I can see that is intended to be a Mac package.  I
tried downloading and installing the matplotlib-1.0.0 file, but could not
seem to be able to import from it, so it obviously was not properly
installed.  Help would be greatly appreciated.
  Regards,
  Jack

"Trust me.  I have a lot of experience at this."
  General Custer's unremembered message to his men,
  just before leading them into the Little Big Horn Valley




On Wed, 14 Jul 2010, Yury V. Zaytsev wrote:

> ... or you can go for matplotlib and use its plot function to display
> PIL images using the NumPy array interface (see my previous postings on
> this list):
>
> import Image
> import numpy as np
> import pylab as pyl
>
> if __name__ == "__main__":
>
>    img_name = 'ch43_roi.tiff'
>    img = Image.open(img_name)
>
>    a = np.asarray(img)
>    p = a.copy().transpose((1, 0, 2))
>
>    pyl.imshow(p)
>    pyl.show()
>
> --
> Sincerely yours,
> Yury V. Zaytsev
>
> On Sun, 2010-07-11 at 18:16 -0500, Jack Uretsky wrote:
>> Hi-
>>   The following worked very well:
>>>>> import Image
>>>>> d = Image.open("a_1.jpg")
>>>>> d.show()
>>>>>
>>
>>   Now, how do I turn
>>   it off before showing another image
>>   I'm on an Intel Mac, OS X Snow Leopard.
>>   Regards,
>>   Jack U.
>> "Trust me.  I have a lot of experience at this."
>>   General Custer's unremembered message to his men,
>>   just before leading them into the Little Big Horn Valley
>>
>>
>>
>> _______________________________________________
>> Image-SIG maillist  -  [hidden email]
>> http://mail.python.org/mailman/listinfo/image-sig
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Brian Blais
On Jul 18, 2010, at 21:12 , Jack Uretsky wrote:

>   I'n trying to find a binary veersion of matplotlib that I can
> install on my OS X Snow Leopard.

Hello Jack,

I see you're trying to install a lot of different python packages  
(matplotlib is a bear to install from source!).  Have you considered  
the enthought distribution (www.enthought.com)?  It has downloads for  
Mac, as well as other platforms, and has all of the science-type  
packages already there, including matplotlib, scipy, numpy, etc...

I've had great luck with that, especially when working with students  
who expect a single-file installation.


                        bb
--
Brian Blais
[hidden email]
http://web.bryant.edu/~bblais
http://bblais.blogspot.com/



_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Chris Barker
Brian Blais wrote:
>>      I'n trying to find a binary veersion of matplotlib that I can
>> install on my OS X Snow Leopard.

really a question for the matplotlib list, but:

There was recently a binary posted to the standard matplotlib page.

It is for the python.org python -- that supports the widest audience,
and can make-re-distributable binaries.

So if you've installed the pythonorg python (not the one Apple ships),
it shouold be an easy point and click install:

Look here:

http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/

for:

matplotlib-1.0.0-python.org-py2.6-macosx10.4.dmg

-Chris



> Hello Jack,
>
> I see you're trying to install a lot of different python packages
> (matplotlib is a bear to install from source!).  Have you considered the
> enthought distribution (www.enthought.com)?  It has downloads for Mac,
> as well as other platforms, and has all of the science-type packages
> already there, including matplotlib, scipy, numpy, etc...
>
> I've had great luck with that, especially when working with students who
> expect a single-file installation.
>
>
>             bb


--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Jack Uretsky
In reply to this post by Brian Blais
Thanks for the tip.  It ain't cheap, so I'm checking to see if we have any
site licenses.
  Regards,
  Jack

"Trust me.  I have a lot of experience at this."
  General Custer's unremembered message to his men,
  just before leading them into the Little Big Horn Valley




On Sun, 18 Jul 2010, Brian Blais wrote:

> On Jul 18, 2010, at 21:12 , Jack Uretsky wrote:
>
>> I'n trying to find a binary veersion of matplotlib that I can
>> install on my OS X Snow Leopard.
>
> Hello Jack,
>
> I see you're trying to install a lot of different python packages (matplotlib
> is a bear to install from source!).  Have you considered the enthought
> distribution (www.enthought.com)?  It has downloads for Mac, as well as other
> platforms, and has all of the science-type packages already there, including
> matplotlib, scipy, numpy, etc...
>
> I've had great luck with that, especially when working with students who
> expect a single-file installation.
>
>
> bb
> --
> Brian Blais
> [hidden email]
> http://web.bryant.edu/~bblais
> http://bblais.blogspot.com/
>
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Jack Uretsky
In reply to this post by pontissimo
Thanks.  I'm looking into this.  But my problem was how  to end a display;
can you do this?
  Regards,
  Jack

"Trust me.  I have a lot of experience at this."
  General Custer's unremembered message to his men,
  just before leading them into the Little Big Horn Valley




On Mon, 12 Jul 2010, Alec Bennett wrote:

> My understanding is that show() is mainly for debugging and tests, and that
> it doesn't offer very much control or efficiency. That's not to say that
> what you're after can't be done, maybe someone else can help you with that,
> I just don't know.
>
> Personally I'd suggest using WXPython, which can do what you're after fairly
> easily.
>
> Here's one very simple way to display an image in WX:
>
> import wx
>
> class PictureWindow(wx.Frame):
> ..def __init__(self, parent, id):
>
> ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos
> = (50, 50), style = wx.DEFAULT_FRAME_STYLE)
> ....panel = wx.Panel(self, -1)
> ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap()
> ....self.mainPic = wx.StaticBitmap(panel, -1, bmp)
> ....self.Show()
>
> app = wx.App(redirect=0)
> PictureWindow(None, -1)
> app.MainLoop()
>
>
>
>
>
> On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky <[hidden email]> wrote:
>
>> Hi-
>>        The following worked very well:
>>
>>>  import Image
>>>>> d = Image.open("a_1.jpg")
>>>>> d.show()
>>>>>
>>>>>
>>        Now, how do I turn
>>  it off before showing another image
>>        I'm on an Intel Mac, OS X Snow Leopard.
>>                        Regards,
>>                                Jack U.
>> "Trust me.  I have a lot of experience at this."
>>                General Custer's unremembered message to his men,
>>                just before leading them into the Little Big Horn Valley
>>
>>
>>
>> _______________________________________________
>> Image-SIG maillist  -  [hidden email]
>> http://mail.python.org/mailman/listinfo/image-sig
>>
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Chris Barker
Jack Uretsky wrote:
> Thanks.  I'm looking into this.  But my problem was how  to end a
> display; can you do this?

If you are doing the wxPython option -- I"d ask on that list.

But while we're here:

What do you want to happen when you end the display? i.e. what program
flow are you looking for?

-CHB



--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Jack Uretsky
Good question.
  I have a sequence of events ocurring in real time.  To each event
I display a corresponing .jpg picture.  The number of events may be in the
hundreds.  There are eight pictures.
  Regards,
  Jack

"Trust me.  I have a lot of experience at this."
  General Custer's unremembered message to his men,
  just before leading them into the Little Big Horn Valley




On Mon, 19 Jul 2010, Christopher Barker wrote:

> Jack Uretsky wrote:
>> Thanks.  I'm looking into this.  But my problem was how  to end a display;
>> can you do this?
>
> If you are doing the wxPython option -- I"d ask on that list.
>
> But while we're here:
>
> What do you want to happen when you end the display? i.e. what program flow
> are you looking for?
>
> -CHB
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> [hidden email]
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Chris Barker
Jack Uretsky wrote:
>     I have a sequence of events ocurring in real time.  To each event I
> display a corresponing .jpg picture.  The number of events may be in the
> hundreds.  There are eight pictures.

where are these "events" coming from?

In any case, one route is to have a main wxPython application. In its
OnInit method, start up another thread that runs the code that listens
for events.

In that code, when you get an event, call:

wx.CallAfter(some_func_to_update_image)

In some_func_to_update_image()

You, well, update the image in your wxPython code. I think I already
posted an example of how to do that.

You put the listening code in a separate thread, so it won't block the
wxPython MainLoop -- if all you are doing is displaying these images,
that may not be necessary, though you'll have to do something so that
the user can at least interact enough with the GUI enough to quit it.

wx.CallAfter() is a way to deal with the fact that wxPython is not
thread safe, so you can't make GUI calls directly from another thread.

HTH,

-Chris






--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Jack Uretsky
Hi Chris-
In answer to your question,
this is a simulation.  The "events" are program generated; I'm trying to
approximate a Poisson process, so the times between event pairs are
exponentially distributed.
  Regards,
  Jack

"Trust me.  I have a lot of experience at this."
  General Custer's unremembered message to his men,
  just before leading them into the Little Big Horn Valley




On Mon, 19 Jul 2010, Christopher Barker wrote:

> Jack Uretsky wrote:
>>     I have a sequence of events ocurring in real time.  To each event I
>> display a corresponing .jpg picture.  The number of events may be in the
>> hundreds.  There are eight pictures.
>
> where are these "events" coming from?
>
> In any case, one route is to have a main wxPython application. In its OnInit
> method, start up another thread that runs the code that listens for events.
>
> In that code, when you get an event, call:
>
> wx.CallAfter(some_func_to_update_image)
>
> In some_func_to_update_image()
>
> You, well, update the image in your wxPython code. I think I already posted
> an example of how to do that.
>
> You put the listening code in a separate thread, so it won't block the
> wxPython MainLoop -- if all you are doing is displaying these images, that
> may not be necessary, though you'll have to do something so that the user can
> at least interact enough with the GUI enough to quit it.
>
> wx.CallAfter() is a way to deal with the fact that wxPython is not thread
> safe, so you can't make GUI calls directly from another thread.
>
> HTH,
>
> -Chris
>
>
>
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> [hidden email]
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Chris Mitchell-2
Hey Jack,

Are you trying to model fluorophores?  If you want to model a Poisson
process you don't need any special packages, just take the negative
log of a uniformly distributed random variable from 0-1.
Mathematically, this would be saying: y = r*e(-rt), where y is a
uniform random variable, then take the integral and then the inverse
(how you turn a uniform distribution into any distribution you want).

Chris

On Mon, Jul 19, 2010 at 7:18 PM, Jack Uretsky <[hidden email]> wrote:

> Hi Chris-
> In answer to your question,
> this is a simulation.  The "events" are program generated; I'm trying to
> approximate a Poisson process, so the times between event pairs are
> exponentially distributed.
>                        Regards,
>                                Jack
>
> "Trust me.  I have a lot of experience at this."
>                General Custer's unremembered message to his men,
>                just before leading them into the Little Big Horn Valley
>
>
>
>
> On Mon, 19 Jul 2010, Christopher Barker wrote:
>
>> Jack Uretsky wrote:
>>>
>>>    I have a sequence of events ocurring in real time.  To each event I
>>> display a corresponing .jpg picture.  The number of events may be in the
>>> hundreds.  There are eight pictures.
>>
>> where are these "events" coming from?
>>
>> In any case, one route is to have a main wxPython application. In its
>> OnInit method, start up another thread that runs the code that listens for
>> events.
>>
>> In that code, when you get an event, call:
>>
>> wx.CallAfter(some_func_to_update_image)
>>
>> In some_func_to_update_image()
>>
>> You, well, update the image in your wxPython code. I think I already
>> posted an example of how to do that.
>>
>> You put the listening code in a separate thread, so it won't block the
>> wxPython MainLoop -- if all you are doing is displaying these images, that
>> may not be necessary, though you'll have to do something so that the user
>> can at least interact enough with the GUI enough to quit it.
>>
>> wx.CallAfter() is a way to deal with the fact that wxPython is not thread
>> safe, so you can't make GUI calls directly from another thread.
>>
>> HTH,
>>
>> -Chris
>>
>>
>>
>>
>>
>>
>> --
>> Christopher Barker, Ph.D.
>> Oceanographer
>>
>> Emergency Response Division
>> NOAA/NOS/OR&R            (206) 526-6959   voice
>> 7600 Sand Point Way NE   (206) 526-6329   fax
>> Seattle, WA  98115       (206) 526-6317   main reception
>>
>> [hidden email]
>> _______________________________________________
>> Image-SIG maillist  -  [hidden email]
>> http://mail.python.org/mailman/listinfo/image-sig
>>
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Jack Uretsky
Hi Chris-
  Thabks. That's really not the issue here.  My problem is that I
very  successfully flash a picture, but then I don't know how to get rid
of it to flash another one.
  Regards,
  Jack (MIT '45, '56)


"Trust me.  I have a lot of experience at this."
  General Custer's unremembered message to his men,
  just before leading them into the Little Big Horn Valley




On Mon, 19 Jul 2010, Chris Mitchell wrote:

> Hey Jack,
>
> Are you trying to model fluorophores?  If you want to model a Poisson
> process you don't need any special packages, just take the negative
> log of a uniformly distributed random variable from 0-1.
> Mathematically, this would be saying: y = r*e(-rt), where y is a
> uniform random variable, then take the integral and then the inverse
> (how you turn a uniform distribution into any distribution you want).
>
> Chris
>
> On Mon, Jul 19, 2010 at 7:18 PM, Jack Uretsky <[hidden email]> wrote:
>> Hi Chris-
>> In answer to your question,
>> this is a simulation.  The "events" are program generated; I'm trying to
>> approximate a Poisson process, so the times between event pairs are
>> exponentially distributed.
>>                        Regards,
>>                                Jack
>>
>> "Trust me.  I have a lot of experience at this."
>>                General Custer's unremembered message to his men,
>>                just before leading them into the Little Big Horn Valley
>>
>>
>>
>>
>> On Mon, 19 Jul 2010, Christopher Barker wrote:
>>
>>> Jack Uretsky wrote:
>>>>
>>>>    I have a sequence of events ocurring in real time.  To each event I
>>>> display a corresponing .jpg picture.  The number of events may be in the
>>>> hundreds.  There are eight pictures.
>>>
>>> where are these "events" coming from?
>>>
>>> In any case, one route is to have a main wxPython application. In its
>>> OnInit method, start up another thread that runs the code that listens for
>>> events.
>>>
>>> In that code, when you get an event, call:
>>>
>>> wx.CallAfter(some_func_to_update_image)
>>>
>>> In some_func_to_update_image()
>>>
>>> You, well, update the image in your wxPython code. I think I already
>>> posted an example of how to do that.
>>>
>>> You put the listening code in a separate thread, so it won't block the
>>> wxPython MainLoop -- if all you are doing is displaying these images, that
>>> may not be necessary, though you'll have to do something so that the user
>>> can at least interact enough with the GUI enough to quit it.
>>>
>>> wx.CallAfter() is a way to deal with the fact that wxPython is not thread
>>> safe, so you can't make GUI calls directly from another thread.
>>>
>>> HTH,
>>>
>>> -Chris
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Christopher Barker, Ph.D.
>>> Oceanographer
>>>
>>> Emergency Response Division
>>> NOAA/NOS/OR&R            (206) 526-6959   voice
>>> 7600 Sand Point Way NE   (206) 526-6329   fax
>>> Seattle, WA  98115       (206) 526-6317   main reception
>>>
>>> [hidden email]
>>> _______________________________________________
>>> Image-SIG maillist  -  [hidden email]
>>> http://mail.python.org/mailman/listinfo/image-sig
>>>
>> _______________________________________________
>> Image-SIG maillist  -  [hidden email]
>> http://mail.python.org/mailman/listinfo/image-sig
>>
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Chris Mitchell-2
Here is how I do it with wxPython.  You might need to change a few
things to get it to work for your instance since I copied/pasted part
of my image viewer program to try and make a minimal example.
Basically you need to run the simulation then call
self.imageholder.Refresh(), which will execute the code in your
OnPaint, which is linked to ReDraw

class ImageFrame(wx.Frame):
    def __init__(self, parent, image):
        wx.Frame.__init__(self, parent, title="image frame")
        self.image = image
        self.im = Image.open(image)
        self.parent = parent
        self.framenum = 0
        self.imagepanel = wx.Panel(self, -1)
        self.imageholder = wx.StaticBitmap(self.imagepanel, -1,
self.picture, (0,0))
        self.imageholder.Bind(wx.EVT_PAINT, self.OnPaint)

    def OnPaint(self, event):
        self.ReDraw(wx.BufferedPaintDC(self.imageholder))

    def ReDraw(self, dc):
        picture = wx.Image(self.image, wx.BITMAP_TYPE_TIF, self.framenum)
        picture=wx.BitmapFromImage(picture)
        dc.DrawBitmap(picture,0,0)

On Mon, Jul 19, 2010 at 10:33 PM, Jack Uretsky <[hidden email]> wrote:

> Hi Chris-
>        Thabks. That's really not the issue here.  My problem is that I very
>  successfully flash a picture, but then I don't know how to get rid of it to
> flash another one.
>                                Regards,
>                                        Jack (MIT '45, '56)
>
>
> "Trust me.  I have a lot of experience at this."
>                General Custer's unremembered message to his men,
>                just before leading them into the Little Big Horn Valley
>
>
>
>
> On Mon, 19 Jul 2010, Chris Mitchell wrote:
>
>> Hey Jack,
>>
>> Are you trying to model fluorophores?  If you want to model a Poisson
>> process you don't need any special packages, just take the negative
>> log of a uniformly distributed random variable from 0-1.
>> Mathematically, this would be saying: y = r*e(-rt), where y is a
>> uniform random variable, then take the integral and then the inverse
>> (how you turn a uniform distribution into any distribution you want).
>>
>> Chris
>>
>> On Mon, Jul 19, 2010 at 7:18 PM, Jack Uretsky <[hidden email]> wrote:
>>>
>>> Hi Chris-
>>> In answer to your question,
>>> this is a simulation.  The "events" are program generated; I'm trying to
>>> approximate a Poisson process, so the times between event pairs are
>>> exponentially distributed.
>>>                        Regards,
>>>                                Jack
>>>
>>> "Trust me.  I have a lot of experience at this."
>>>                General Custer's unremembered message to his men,
>>>                just before leading them into the Little Big Horn Valley
>>>
>>>
>>>
>>>
>>> On Mon, 19 Jul 2010, Christopher Barker wrote:
>>>
>>>> Jack Uretsky wrote:
>>>>>
>>>>>    I have a sequence of events ocurring in real time.  To each event I
>>>>> display a corresponing .jpg picture.  The number of events may be in
>>>>> the
>>>>> hundreds.  There are eight pictures.
>>>>
>>>> where are these "events" coming from?
>>>>
>>>> In any case, one route is to have a main wxPython application. In its
>>>> OnInit method, start up another thread that runs the code that listens
>>>> for
>>>> events.
>>>>
>>>> In that code, when you get an event, call:
>>>>
>>>> wx.CallAfter(some_func_to_update_image)
>>>>
>>>> In some_func_to_update_image()
>>>>
>>>> You, well, update the image in your wxPython code. I think I already
>>>> posted an example of how to do that.
>>>>
>>>> You put the listening code in a separate thread, so it won't block the
>>>> wxPython MainLoop -- if all you are doing is displaying these images,
>>>> that
>>>> may not be necessary, though you'll have to do something so that the
>>>> user
>>>> can at least interact enough with the GUI enough to quit it.
>>>>
>>>> wx.CallAfter() is a way to deal with the fact that wxPython is not
>>>> thread
>>>> safe, so you can't make GUI calls directly from another thread.
>>>>
>>>> HTH,
>>>>
>>>> -Chris
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Christopher Barker, Ph.D.
>>>> Oceanographer
>>>>
>>>> Emergency Response Division
>>>> NOAA/NOS/OR&R            (206) 526-6959   voice
>>>> 7600 Sand Point Way NE   (206) 526-6329   fax
>>>> Seattle, WA  98115       (206) 526-6317   main reception
>>>>
>>>> [hidden email]
>>>> _______________________________________________
>>>> Image-SIG maillist  -  [hidden email]
>>>> http://mail.python.org/mailman/listinfo/image-sig
>>>>
>>> _______________________________________________
>>> Image-SIG maillist  -  [hidden email]
>>> http://mail.python.org/mailman/listinfo/image-sig
>>>
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: that's enough

Yury V. Zaytsev
In reply to this post by Jack Uretsky
On Mon, 2010-07-19 at 18:18 -0500, Jack Uretsky wrote:

> In answer to your question,
> this is a simulation.  The "events" are program generated; I'm trying to
> approximate a Poisson process, so the times between event pairs are
> exponentially distributed.

Hi!

It seems to me that you are consistently trying out wrong tools for the
job. Maybe next time you should really start by explaining what you want
to achieve in the first place?

What you really need is pygame. It is a simple Python SDL wrapper, that
is absolutely great to use for simulations visualization. This is the
code you need to get what you want:

        # Center window on the screen
        os.environ["SDL_VIDEO_CENTERED"] = "1"
        pygame.init()
        pygame.display.set_mode(self.screen_size, 0)
        screen = pygame.display.get_surface()

        # CYCLE

            # Create the backgound
            background =  pygame.image.load(fullpath)
            background = background.convert()

            # Display the background
            screen.blit(background, (0, 0))
            pygame.display.flip()

I have written a 2D n-body problem simulator that I used as teaching
material for a Python course this spring, so if you want a more complete
example I can send it to you, but either way, I think it's better off
this list.
 
--
Sincerely yours,
Yury V. Zaytsev

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
123