Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8205399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:13:27+00:00 2026-06-07T08:13:27+00:00

I want to load an image from webcam to display on pygame I am

  • 0

I want to load an image from webcam to display on pygame
I am using videocapture

from VideoCapture import Device
import pygame
import time
In=1
pygame.init()
w = 640
h = 480
size=(w,h)
screen = pygame.display.set_mode(size) 

while True:
    cam = Device()
    cam.saveSnapshot(str(In)+".jpg") 
    img=pygame.image.load(In)
    screen.blit(img,(0,0))
    In=int(In)+1
    In=str(In)

Why does this not work.Pygame window opens but nothing displays?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:13:29+00:00Added an answer on June 7, 2026 at 8:13 am

    You have to tell pygame to update the display.

    Add the following line in your loop after blitting the image to the screen:

    pygame.display.flip()
    

    BTW, you probably want to limit how much images you take per second. Either use time.sleep or a pygame clock.


    from VideoCapture import Device
    import pygame
    import time
    In=1
    pygame.init()
    w = 640
    h = 480
    size=(w,h)
    screen = pygame.display.set_mode(size) 
    c = pygame.time.Clock() # create a clock object for timing
    
    while True:
        cam = Device()
        filename = str(In)+".jpg" # ensure filename is correct
        cam.saveSnapshot(filename) 
        img=pygame.image.load(filename) 
        screen.blit(img,(0,0))
        pygame.display.flip() # update the display
        c.tick(3) # only three images per second
        In += 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using BitmapFactory.decodeStream to load an image from a url in Android. I want
I want to load the image URL from my NSMutableArray. Here is my Code:
I want to display images on a .net page which I load from database
I want to load an image from an array and set the view to
I have image control.I want to load image from my specific path. i have
I am using Flash Build Image control to load the image from outside using
I want to load a image to UIImageView from my app documents library. I
i want to load image from remote url and synchronicity and change it width
I want to load an image from an external folder of my system to
I'm using the Chart control from the DataVisualization library, and want to use image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.