]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/commitdiff
Allow to find files in pyinstaller
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 15 Jun 2016 10:42:48 +0000 (12:42 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 15 Jun 2016 10:42:48 +0000 (12:42 +0200)
helpers/__init__.py

index c42b378817aa26e8898b2920e0d2989048494e1e..7dbffdd1641c34f960d53512a624efec38251ffc 100644 (file)
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 from pygame import *
+import sys
 
 class Action:
     action_types = [
@@ -106,7 +107,11 @@ class Key:
     def draw(self, background_surface):
         self.surface = self.square().surface()
 
-        police = font.Font("Ubuntu-Regular.ttf", 14)
+        if getattr(sys, 'frozen', False):
+            police = font.Font(sys._MEIPASS + "/Ubuntu-Regular.ttf", 14)
+        else:
+            police = font.Font("Ubuntu-Regular.ttf", 14)
+
         text = police.render(self.key_sym, True, (0,0,0))
         self.surface.blit(text, (5,5))
         background_surface.blit(self.surface, self.position)