FAQ
Hi


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


It would have understood something like:


DISPLAYSURF.set_caption('Hello World!')
or
pygame.display.set_caption(DISPLAYSURF, 'Hello World!')


thx

Search Discussions

  • Laura Creighton at Sep 8, 2015 at 10:14 am
    Try the pygame mailing list for that one.
    http://www.pygame.org/wiki/info?action=view&idH90


    Laura
  • Mark Lawrence at Sep 8, 2015 at 11:03 am

    On 08/09/2015 11:14, Laura Creighton wrote:
    Try the pygame mailing list for that one.
    http://www.pygame.org/wiki/info?action=view&idH90

    Laura

    Or https://www.reddit.com/r/pygame


    --
    My fellow Pythonistas, ask not what our language can do for you, ask
    what you can do for our language.


    Mark Lawrence
  • Dave Farrance at Sep 8, 2015 at 2:01 pm
    "ast" 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"
  • Ian Kelly at Sep 8, 2015 at 2:12 pm

    On Tue, Sep 8, 2015 at 8:01 AM, Dave Farrance wrote:
    "ast" 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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 8, '15 at 9:33a
activeSep 8, '15 at 2:12p
posts5
users5
websitepython.org

People

Translate

site design / logo © 2019 Grokbase