Skip to content

Commit

Permalink
Version 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ppizarror committed Feb 3, 2018
1 parent 2ca8858 commit 16778c5
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 216 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Pycharm files
.idea/
.ropeproject/

# Zip files
*.zip

# Compiled python files
*.pyc
*/__pycache__
*.pyc
5 changes: 2 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
EXAMPLE
Example file, timer clock with in-menu options.
Copyright (C) 2017 Pablo Pizarro @ppizarror
Copyright (C) 2017,2018 Pablo Pizarro @ppizarror
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -192,8 +192,7 @@ def change_color_bg(c, **kwargs):
exit()
elif event.type == KEYDOWN:
if event.key == K_ESCAPE:
if menu.is_disabled():
menu.enable()
menu.enable()

# Draw timer
time_string = str(datetime.timedelta(seconds=int(timer[0])))
Expand Down
5 changes: 2 additions & 3 deletions example2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
EXAMPLE
Game menu with 3 difficulty options.
Copyright (C) 2017 Pablo Pizarro @ppizarror
Copyright (C) 2017,2018 Pablo Pizarro @ppizarror
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -173,7 +173,6 @@ def main_background():
font=pygameMenu.fonts.FONT_BEBAS,
font_title=pygameMenu.fonts.FONT_8BIT,
title='About',
# Disable menu close (ESC button)
onclose=PYGAME_MENU_DISABLE_CLOSE,
font_color=COLOR_BLACK,
text_fontsize=20,
Expand Down Expand Up @@ -201,7 +200,7 @@ def main_background():
font_size=30,
menu_width=int(WINDOW_SIZE[0] * 0.6),
menu_height=int(WINDOW_SIZE[1] * 0.6),
onclose=PYGAME_MENU_DISABLE_CLOSE, # ESC disabled
onclose=PYGAME_MENU_DISABLE_CLOSE,
bgfun=main_background,
menu_color=MENU_BACKGROUND_COLOR,
option_shadow=False,
Expand Down
7 changes: 2 additions & 5 deletions pygameMenu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PYGAMEMENU
Pygame Menu library.
Copyright (C) 2017 Pablo Pizarro @ppizarror
Copyright (C) 2017,2018 Pablo Pizarro @ppizarror
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -15,14 +15,11 @@
GNU General Public License for more details.
"""

# noinspection PyUnresolvedReferences
from pygameMenu.menu import Menu
# noinspection PyUnresolvedReferences
from pygameMenu.textmenu import TextMenu
# noinspection PyUnresolvedReferences
import pygameMenu.fonts as fonts

# Other
__author__ = 'Pablo Pizarro R.'
__email__ = '[email protected]'
__version__ = 'v1.72 (29/01/2018)'
__version__ = 'v1.8 (03/02/2018)'
2 changes: 1 addition & 1 deletion pygameMenu/config_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CONTROLS
Default controls of Menu object.
Copyright (C) 2017 Pablo Pizarro @ppizarror
Copyright (C) 2017,2018 Pablo Pizarro @ppizarror
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
69 changes: 18 additions & 51 deletions pygameMenu/config_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CONFIG
Default Menu configurations.
Copyright (C) 2017 Pablo Pizarro @ppizarror
Copyright (C) 2017,2018 Pablo Pizarro @ppizarror
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -15,53 +15,20 @@
GNU General Public License for more details.
"""

# Alpha of menu color, 0: Opaque, 255: Transparent
MENU_ALPHA = 90

# Background color of Menu
MENU_BGCOLOR = (0, 0, 0)

# Menu centered text
MENU_CENTERED_TEXT = True

# Upper-left X-Position of objects into Menu
MENU_DRAW_X = 50

# Upper-left Y-Position of objects into Menu
MENU_DRAW_Y = 60

# Font color
MENU_FONT_COLOR = (255, 255, 255)

# Font size of entries
MENU_FONT_SIZE = 40

# Menu font size title
MENU_FONT_SIZE_TITLE = 50

# Menu height (px)
MENU_HEIGHT = 400

# Option margin (px)
MENU_OPTION_MARGIN = 15

# Indicates if a shadow is drawn on selected option
MENU_OPTION_SHADOW = True

# Indicates if a rectangle is drawn on a selected item
MENU_SELECTED_DRAW = True

# Width of selected item
MENU_SELECTED_WIDTH = 1

# Color of selected item
MENU_SELECTEDCOLOR = (180, 180, 180)

# Background color
MENU_TITLE_BG_COLOR = (170, 65, 50)

# Width of Menu (px)
MENU_WIDTH = 600

# Shadow color
SHADOW_COLOR = (0, 0, 0)
MENU_ALPHA = 90 # Alpha of menu color, 0: Opaque, 255: Transparent
MENU_BGCOLOR = (0, 0, 0) # Background color of Menu
MENU_CENTERED_TEXT = True # Menu centered text
MENU_DRAW_X = 50 # Upper-left X-Position of objects into Menu
MENU_DRAW_Y = 60 # Upper-left Y-Position of objects into Menu
MENU_FONT_COLOR = (255, 255, 255) # Font color
MENU_FONT_SIZE = 40 # Font size of entries
MENU_FONT_SIZE_TITLE = 50 # Menu font size title
MENU_HEIGHT = 400 # Menu height (px)
MENU_OPTION_MARGIN = 15 # Option margin (px)
MENU_OPTION_SHADOW = True # Indicates if a shadow is drawn on selected option
MENU_SELECTED_DRAW = True # Indicates if rectangle is drawn on a selected item
MENU_SELECTED_WIDTH = 1 # Width of selected item
MENU_SELECTEDCOLOR = (180, 180, 180) # Color of selected item
MENU_TITLE_BG_COLOR = (170, 65, 50) # Background color
MENU_WIDTH = 600 # Width of Menu (px)
SHADOW_COLOR = (0, 0, 0) # Shadow color
21 changes: 6 additions & 15 deletions pygameMenu/config_textmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CONFIG TEXTMENU
Default Textmenu configurations.
Copyright (C) 2017 Pablo Pizarro @ppizarror
Copyright (C) 2017,2018 Pablo Pizarro @ppizarror
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -15,17 +15,8 @@
GNU General Public License for more details.
"""

# Text size
MENU_FONT_TEXT_SIZE = 25

# Text is centered
TEXT_CENTERED = False

# X-Axis margin of text
TEXT_DRAW_X = 5

# Text font color
TEXT_FONT_COLOR = (255, 255, 255)

# Text margin (px)
TEXT_MARGIN = 10
MENU_FONT_TEXT_SIZE = 25 # Text size
TEXT_CENTERED = False # Text is centered
TEXT_DRAW_X = 5 # X-Axis margin of text
TEXT_FONT_COLOR = (255, 255, 255) # Text font color
TEXT_MARGIN = 10 # Text margin (px)
5 changes: 3 additions & 2 deletions pygameMenu/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FONTS
Menu avaiable fonts.
Copyright (C) 2017 Pablo Pizarro @ppizarror
Copyright (C) 2017,2018 Pablo Pizarro @ppizarror
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -18,7 +18,8 @@
# Get actual folder
import os

__actualpath = str(os.path.abspath(os.path.dirname(__file__))).replace('\\', '/')
__actualpath = str(os.path.abspath(
os.path.dirname(__file__))).replace('\\', '/')
__fontdir = '{0}/fonts/{1}.ttf'

# Avaiable fonts
Expand Down
31 changes: 8 additions & 23 deletions pygameMenu/locals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
LOCALS
Local constants.
Copyright (C) 2017 Pablo Pizarro @ppizarror
Copyright (C) 2017,2018 Pablo Pizarro @ppizarror
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -25,35 +25,20 @@ def __init__(self, action):
assert isinstance(action, int)
self._action = action

# noinspection PyProtectedMember
def __eq__(self, other):
if isinstance(other, PymenuAction):
return self._action == other._action
return False


# noinspection PyProtectedMember
def _eq_action(action1, action2):
return action1._action == action2._action


# Menu back
PYGAME_MENU_BACK = PymenuAction(0)

# Close menu
PYGAME_MENU_CLOSE = PymenuAction(1)

# Menu exit program
PYGAME_MENU_EXIT = PymenuAction(3)

# Menu disable closing
PYGAME_MENU_DISABLE_CLOSE = PymenuAction(10)

# Menu reset
PYGAME_MENU_RESET = PymenuAction(4)

# Type of selector
_PYGAME_TYPE_SELECTOR = PymenuAction(2)

# Text newline on TextMenu object
TEXT_NEWLINE = ''
_PYGAME_TYPE_SELECTOR = PymenuAction(2) # Type of selector
PYGAME_MENU_BACK = PymenuAction(0) # Menu back
PYGAME_MENU_CLOSE = PymenuAction(1) # Close menu
PYGAME_MENU_DISABLE_CLOSE = PymenuAction(10) # Menu disable closing
PYGAME_MENU_EXIT = PymenuAction(3) # Menu exit program
PYGAME_MENU_RESET = PymenuAction(4) # Menu reset
TEXT_NEWLINE = '' # Text newline on TextMenu object
Loading

0 comments on commit 16778c5

Please sign in to comment.