Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. JavaScript
  4. Python Pygame Newbie Code Help

Python Pygame Newbie Code Help

Scheduled Pinned Locked Moved JavaScript
pythonhelpannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    johtnkucz
    wrote on last edited by
    #1

    Hi, I execute the following code and just get a blank (black) window. The window caption shows but I have not yet gotten the images to load. Please help. (I tried using other images than the ones utilized too). the .py and the images are in the same directory.

    background_image_filename='checkmark.jpg'
    mouse_image_filename='digestive_bw.png'
    import pygame, sys
    from pygame.locals import*
    from sys import exit

    pygame.init()

    screen=pygame.display.set_mode((800,800),0,32)
    #pygame.display.set_caption("Hello, Howdy, Mate, and Hi there Aus world!")

    background=pygame.image.load(background_image_filename).convert()
    mouse_cursor=pygame.image.load(mouse_image_filename).convert_alpha()

    while True:
    for event in pygame.event.get():
    if event.type==QUIT:
    pygame.quit()
    sys.exit()

    screen.blit(background,(0,0))

    x,y=pygame.mouse.get_pos()
    x-=mouse_cursor.get_width() /2
    y=-mouse_cursor.get_height() /2
    screen.blit(mouse_cursor,(x,y))

    pygame.display.update()

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups