-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsticker.py
64 lines (50 loc) · 1.26 KB
/
sticker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import pygame
import time
import os
#http://www.karoltomala.com/blog/?p=679
drivers = ['directfb', 'fbcon', 'svgalib']
found = False
for driver in drivers:
if not os.getenv('SDL_VIDEODRIVER'):
os.putenv('SDL_VIDEODRIVER', driver)
try:
pygame.display.init()
except pygame.error:
print 'Driver: {0} failed.'.format(driver)
continue
found = True
break
if not found:
raise Exception('No suitable video driver found!')
print os.getenv('SDL_VIDEODRIVER')
disp_no = os.getenv("DISPLAY")
if disp_no:
print "I'm running under X display = {0}".format(disp_no)
#Pygame init
pygame.display.init()
pygame.mouse.set_visible(False)
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
print "Framebuffer size: %d x %d" % (size[0], size[1])
screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
print "Sono qui"
#pygame.display.flip()
os.system("dwebp sticker.webp -o sticker.png")
img=pygame.image.load("sticker.png")
rect=img.get_rect().size
if rect[0]>64:
w=64
h1=rect[1]*w/rect[0]
if h1>128:
h=128
w=w*h/h1
else:
h=h1
print rect
print w
print h
img = pygame.transform.scale(img,(w,h))
img = pygame.transform.rotate(img,90)
screen.blit(img,(0,0))
pygame.display.update()
time.sleep(2)
pygame.quit()