diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-06-20 23:38:10 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-06-20 23:38:10 +0200 |
commit | 956ce6fd3e47b2536f57f3359ebff26850f30aea (patch) | |
tree | f1dbabd3d625bbbc638d7ac5e9a77b4061bff9b8 /helpers/font.py | |
parent | 9de92b6dd2bd906f6a64fce7c90a6aff0dbb27a2 (diff) | |
download | MusicSampler-956ce6fd3e47b2536f57f3359ebff26850f30aea.tar.gz MusicSampler-956ce6fd3e47b2536f57f3359ebff26850f30aea.tar.zst MusicSampler-956ce6fd3e47b2536f57f3359ebff26850f30aea.zip |
Cleanup fonts
Diffstat (limited to 'helpers/font.py')
-rw-r--r-- | helpers/font.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/helpers/font.py b/helpers/font.py new file mode 100644 index 0000000..83999ef --- /dev/null +++ b/helpers/font.py | |||
@@ -0,0 +1,10 @@ | |||
1 | import os | ||
2 | import pygame | ||
3 | import sys | ||
4 | |||
5 | def font(size, font = "Ubuntu-Regular"): | ||
6 | if getattr(sys, 'frozen', False): | ||
7 | return pygame.font.Font(sys._MEIPASS + "/fonts/" + font + ".ttf", size) | ||
8 | else: | ||
9 | path = os.path.dirname(os.path.realpath(__file__)) | ||
10 | return pygame.font.Font(path + "/../fonts/" + font + ".ttf", size) | ||