[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] immediate mode not working?



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 <brian@xxxxxxxxxxxxxxxxxxx> wrote:
From: Brian Fisher <brian@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [pygame] immediate mode not working?
To: pygame-users@xxxxxxxx
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 <gastomaster@xxxxxxxxx> 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 <geometrian@xxxxxxxxx> wrote:
From: Ian Mallett <geometrian@xxxxxxxxx>
Subject: Re: [pygame] immediate mode not working?
To: pygame-users@xxxxxxxx
Date: Tuesday, July 8, 2008, 1:16 PM


Could we see the code?
-I