pygame basic question

Ian Kelly ian.g.kelly at gmail.com
Tue Sep 8 10:12:39 EDT 2015


On Tue, Sep 8, 2015 at 8:01 AM, Dave Farrance <df at see.replyto.invalid> wrote:
> "ast" <nomail at invalid.com> wrote:
>
>>DISPLAYSURF = pygame.display.set_mode((400, 300))
>>pygame.display.set_caption('Hello World!')
>>
>>The first line opens a 400x300 pygame window.
>>The second one writes "Hello World" on top of it.
>>
>>I am just wondering how function set_caption finds the windows
>>since the window's name DISPLAYSURF  is not passed as
>>an argument
>
> https://www.pygame.org/docs/ref/display.html
>
> As it says, there is only *one* display surface, and any non-displayed
> surface must be blitted (copied) onto the display surface for
> visibility.  So all "pygame.display" methods refer to that one display
> surface.  Non displayed surfaces, on the other hand, do need to be
> instantiated with "pygame.Surface"

Also, note that the display surface DISPLAYSURF is not the window.
It's just a Surface object that pygame uses to paint the contents of
the window. AFAIK pygame maintains the actual window data structures
internally and does not expose them to the API.



More information about the Python-list mailing list