|
@@ -24,6 +24,9 @@ class ImageScreen:
|
24
|
24
|
self.image = Image.open(self.path)
|
25
|
25
|
print(p, self.image.width, self.image.height, self.image.is_animated, self.image.n_frames)
|
26
|
26
|
|
|
27
|
+ self.xOff = int((self.gui.width - self.image.width) / 2)
|
|
28
|
+ self.yOff = int((self.gui.height - self.image.height) / 2)
|
|
29
|
+
|
27
|
30
|
self.restart()
|
28
|
31
|
|
29
|
32
|
def restart(self):
|
|
@@ -63,9 +66,9 @@ class ImageScreen:
|
63
|
66
|
c = self.background
|
64
|
67
|
if c == None:
|
65
|
68
|
c = (p[v * 3 + 0], p[v * 3 + 1], p[v * 3 + 2])
|
66
|
|
- self.gui.set_pixel(x, y, c)
|
|
69
|
+ self.gui.set_pixel(x + self.xOff, y + self.yOff, c)
|
67
|
70
|
else:
|
68
|
|
- self.gui.set_pixel(x, y, v)
|
|
71
|
+ self.gui.set_pixel(x + self.xOff, y + self.yOff, v)
|
69
|
72
|
|
70
|
73
|
if __name__ == "__main__":
|
71
|
74
|
import util
|
|
@@ -78,7 +81,7 @@ if __name__ == "__main__":
|
78
|
81
|
imageDir = os.path.join(scriptDir, "images")
|
79
|
82
|
for f in os.listdir(os.fsencode(imageDir)):
|
80
|
83
|
filename = os.fsdecode(f)
|
81
|
|
- m.add(ImageScreen(t, os.path.join(imageDir, filename)))
|
|
84
|
+ m.add(ImageScreen(t, filename))
|
82
|
85
|
|
83
|
86
|
m.restart()
|
84
|
87
|
t.debug_loop(m.draw)
|