From 1b79473633242db1c180e07d7165a5bd837eb62e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 15 Jun 2016 12:42:48 +0200 Subject: [PATCH 1/1] Allow to find files in pyinstaller --- helpers/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helpers/__init__.py b/helpers/__init__.py index c42b378..7dbffdd 100644 --- a/helpers/__init__.py +++ b/helpers/__init__.py @@ -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) -- 2.41.0