OK I noticed that by pumping the event queue, with pygame.event.get() , I 
actually manage to see the blue squares being drawn, but only when this command 
is written. If I flip again, I'd have to pump the event queue once again.

--- On Tue, 7/8/08, Brian Fisher <[EMAIL PROTECTED]> wrote:
From: Brian Fisher <[EMAIL PROTECTED]>
Subject: Re: [pygame] immediate mode not working?
To: pygame-users@seul.org
Date: Tuesday, July 8, 2008, 4:46 PM

Blit works just fine for me - it's not a fill vs. blit thing - the problem you 
just experienced is something else - it's possible events need to get processed 
again? try calling pygame.event.get() when things don't seem to work (if you 
are not pumping the event loop, btw, you are not using pygame in a supported 
fashion, and the results are unpredictable)


anyways, I did the sequence of stuff below, and it all worked exactly as 
expected for me (demonstrating blits can work fine)

C:\Documents and Settings\Owner>c:\python25\python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on 
win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> pygame.init()
(6, 0)
>>> screen=pygame.display.set_mode((400,300))

>>> pygame.event.get()
[<Event(1-ActiveEvent {'state': 1, 'gain': 0})>, <Event(1-ActiveEvent {'state': 
2, 'gain': 0})>, <Event(17-VideoExpose {...
>>> blueSquare = pygame.surface.Surface((50,50))

>>> blueSquare.fill((0,0,255))
<rect(0, 0, 50, 50)>
>>> screen.blit(blueSquare, (30,30))
<rect(30, 30, 50, 50)>
>>> pygame.display.flip()
>>> screen.blit(blueSquare, (100,100))

<rect(100, 100, 50, 50)>
>>> pygame.display.flip()
>>> screen.blit(blueSquare, (200,130))
<rect(200, 130, 50, 50)>
>>> pygame.display.flip()


On Tue, Jul 8, 2008 at 3:57 PM, Gabriel Hasbun <[EMAIL PROTECTED]> wrote:


You are right, filling the screen seems to work, but not blitting to it.

C:\Documents and Settings\Gabriel>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on

win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> pygame.init()
(6, 0)
>>> screen=pygame.display.set_mode((400,300))

>>> pygame.event.get()
[<Event(4-MouseMotion {'buttons': (0, 0, 0), 'pos': (248, 117), 'rel': (248, 117
)})>, <Event(4-MouseMotion {'buttons': (0, 0, 0), 'pos': (248, 117), 'rel': (0,

0)})>, <Event(1-ActiveEvent {'state': 2, 'gain': 0})>, <Event(17-VideoExpose {})
>, <Event(1-ActiveEvent {'state': 1, 'gain': 0})>]
>>> screen.fill((255,255,255))

<rect(0, 0, 400,
 300)>
>>> pygame.display.flip()
>>> screen.fill((255,0,0))
<rect(0, 0, 400, 300)>
>>> pygame.display.flip()
>>> screen.fill((255,240,70))
<rect(0, 0, 400, 300)>

>>> pygame.display.update()
>>> blueSquare = ((0,0,255))
>>> blueSquare = pygame.surface.Surface((50,50))
>>> blueSquare.fill((0,0,255))
<rect(0, 0, 50, 50)>                           # everything alright up until 
here.

>>> screen.blit(blueSquare, (30,30))
<rect(30, 30, 50, 50)>
>>> pygame.display.update()            # pygame window at this point is non 
>>> responsive.
>>>





--- On Tue, 7/8/08, Brian Fisher
 <[EMAIL PROTECTED]> wrote:
From: Brian Fisher <[EMAIL PROTECTED]>

Subject: Re: [pygame] immediate mode not working?
To: pygame-users@seul.org
Date: Tuesday, July 8, 2008, 3:03 PM


The problem is that you need to tell SDL to process windows messages before 
your window can be used (any event getting function should do)

try this:
---------
import pygame
pygame.init()
screen = pygame.display.set_mode((400,300))


pygame.event.get()
screen.fill((255,255,255))
pygame.display.flip()
screen.fill((0,0,0))
pygame.display.flip()
---------

it worked in a command prompt console for me


On Tue, Jul 8, 2008 at 2:09 PM, Gabriel Hasbun <[EMAIL PROTECTED]> wrote:



sure:

C:\Documents and Settings\Gabriel>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.


>>> import pygame
>>> pygame.init()
(6, 0)
>>> screen = pygame.display.set_mode((400, 300))
>>> whiteSquare = pygame.surface.Surface((50,50))
>>> whiteSquare.fill((255,0,0))


<rect(0, 0, 50, 50)>
>>> screen.blit(whiteSquare, (100,100))
<rect(100, 100, 50, 50)>
>>> pygame.display.flip()
>>>

As you can guess nothing happens on my pygame window, while using the MSDOS(the 
real) python.



--- On Tue, 7/8/08, Ian Mallett <[EMAIL PROTECTED]> wrote:


From: Ian Mallett <[EMAIL PROTECTED]>
Subject: Re: [pygame] immediate mode not working?
To: pygame-users@seul.org


Date: Tuesday, July 8, 2008, 1:16 PM

Could we see the code?
-I




      




      




      

Reply via email to