Simple example of displaying an image fullscreen in Python

linux, python

Solution

You can use TKinter or PyGame to show images and draw objects over them to change them.

Example using TKinter:

from Tkinter import *
root = Tk()
canvas = Canvas(root, width =1224,height=1000)
logo=PhotoImage(file="myimage.jpg")
canvas.create_image(0, 0, image=logo) #Change 0, 0 to whichever coordinates you need
root.mainloop()

Example using PyGame:

import pygame
from pygame.locals import *
pygame.init()
WIDTH = 1280
HEIGHT = 1080
windowSurface = pygame.display.set_mode((WIDTH, HEIGHT), 0, 32)
img = pygame.image.load("myimage.jpg")
while True:
        events = pygame.event.get()
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
        windowSurface.blit(img, (0, 0)) #Replace (0, 0) with desired coordinates
        pygame.display.flip()

Problem

I'd like to display (and change/update) an image full screen on Linux using Python. What's the best way to do this?

Original source