2

I have a raspberry pi with raspbian installed. I ssh into it using PuTTY, an ethernet cord, and my laptop.

My goal is to run a pygame script on the pi but display it on the laptop screen. I have been looking at other questions here, but this is a specific issue and only 2 other questions have come up in my search on this site, and I haven't had luck online either.

I am using this tutorial, and my code looks like this per the tutorial, except the logo section is commented out:

import pygame

def main():

    pygame.init()
    #logo = pygame.image.load("logo32x32.png")
    #pygame.display.set_icon(logo)
    pygame.display.set_caption("minimal program")

    screen = pygame.display.set_mode((240,180))

    running = True

    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False

if __name__=="__main__":
    # call the main function
    main()

When I run it on my pi, nothing happens BUT the process doesn't terminate, suggesting to me that it is running just not displaying.

Are there any suggestions for how to achieve this? Thank you.

  • If, as I suspect, this is a GUI program you need to run VNC on the Pi – Milliways Mar 31 at 5:20
  • If you want to easily do Xwindows stuff remotely look at mobaxterm.mobatek.net (which works with your existing PuTTY stuff). – Dougie Mar 31 at 10:12
2

Graphics output on the Pi is usually displayed via the X Window System (aka X11, or simply X). You can confirm this by plugging a compatible TV/monitor into the Pi's HDMI-out. If you want to view from your laptop some kind of VNC software is the easiest route. (RealVNC is installed on recent Pi images by default.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.