[Image-SIG] that's enough

Yury V. Zaytsev yury at shurup.com
Wed Jul 21 13:42:04 CEST 2010


Hi!

Yes, this sounds like a perfect use case for pygame. Just set up a
screen, then run your main loop and when a new state is calculated, blit
the corresponding JPEG to the screen.

I've already posted the code that you need to implement this setting.
 
-- 
Sincerely yours,
Yury V. Zaytsev

On Tue, 2010-07-20 at 13:21 -0500, Jack Uretsky wrote:
> Hi-
>  	Thanks very much.  My "more detailed explanation" seems to have 
> confused the issue. Here is a more detailed, more detailed explaation:
>  	The principal program calculates the state of a 3-"spin" assembly, 
> each spin can either be up or down - there are, accordingly, 8 possible 
> states.  The spins "flip" singly and randomly, as described in the Cornell 
> ArXiV 0912.4068 (gen phys).  I have prepared .jpg's showing the 8 possible 
> configurations.  When the principal program calculates a new 
> configuration, I would like to show the relevant .jpg.
>  	There are undoubtedly a plethora of ways to illustrate the process 
> I am discussing.  Did I choose one that is too difficult for a simple 
> python progam?
>  			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 Tue, 20 Jul 2010, Yury V. Zaytsev wrote:
> 
> > 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
> >



More information about the Image-SIG mailing list