Esempio n. 1
0
    def on_mouse_press(self, x, y, button, modifiers):
        if not self._is_loaded or not self._options or len(self._options) == 0:
            return
        """
        A mouse press is going to create a manager with the options.
        """
        # if it's already opened, we just close it.
        if self._pulldown_menu is not None:
            self._delete_pulldown_menu()
            return

        # the function we pass to the manager.
        def on_escape(_):
            self._delete_pulldown_menu()

        width, height = self._manager.window.get_size()
        x = self.x
        y = -(height - self.y - 1) + self.height

        # we set the manager
        self._pulldown_menu = Manager(Frame(Scrollable(VerticalContainer(
            list(self._options.values())),
                                                       height=self.max_height),
                                            path=['dropdown', 'pulldown']),
                                      window=self._manager.window,
                                      batch=self._manager.batch,
                                      group=self._manager.root_group.parent,
                                      theme=self._manager.theme,
                                      is_movable=False,
                                      anchor=ANCHOR_TOP_LEFT,
                                      offset=(x, y))
Esempio n. 2
0
    def __init__(self, window, batch, space, level, height, width):
        self.space = space
        self.level = level
        status_text = pyglet.text.decode_attributed('''
Time: 0 sec \n
Points: 0 points \n
FPS: 00.00 FPS
''')
        self.status_doc = Document(status_text, height=height, width=width)
        status_frame = Frame(self.status_doc)
        inv_text = pyglet.text.decode_html("<h4>Inventory</h4>")
        inventory_header = Document(inv_text, width=width)
        self.inventory_container = VerticalContainer([])

        container = VerticalContainer(
            [inventory_header, self.inventory_container])
        self.inventory_frame = Frame(container)
        container = VerticalContainer([status_frame, self.inventory_frame])
        self.manager = Manager(container,
                               window=window,
                               batch=batch,
                               group=RenderingOrder.hud,
                               anchor=ANCHOR_TOP_RIGHT,
                               theme=theme,
                               is_movable=False)
        self.window = window
        self.window.push_handlers(on_draw=self.on_draw)
        self.tick = 0
Esempio n. 3
0
 def __init__(self, window, batch, space, level, height, width):
     self.space = space
     self.level = level
     self.height = height
     self.width = width
     progress_text = "Progress: ..."
     self.progress_doc = Document(progress_text, width=width / 2)
     objective_doc = Document(level.objective, width=width / 2)
     left_frame = Frame(VerticalContainer(
         [objective_doc, None, self.progress_doc]),
                        is_expandable=True)
     self.left_container = VerticalContainer([left_frame])
     victory_formula = level.victory_condition[0]
     info_frame = self.create_info_frame(victory_formula)
     self.info_container = VerticalContainer([info_frame])
     container = HorizontalContainer(
         [self.left_container, self.info_container])
     self.manager = Manager(container,
                            window=window,
                            batch=batch,
                            group=RenderingOrder.hud,
                            anchor=ANCHOR_BOTTOM_LEFT,
                            theme=theme,
                            is_movable=False)
     self.window = window
     self.window.push_handlers(on_draw=self.on_draw)
     self.tick = 0
     self.init_effects(space, level)
Esempio n. 4
0
    def load_elem(self, elem):
        Manager(elem.viewer(),
                window=self,
                batch=self.batch,
                **elem.manager_settings())

        self.all_elements[elem.__class__.__name__] = elem
Esempio n. 5
0
def create_folding_description(window, batch, heading, description, chapters=list()):
    """
        window - window
        batch - batch
        heading - heading of the widget
        description - description for the widget
        chapters - list of tuples (heading,text)
    """
    description_doc = pyglet.text.decode_attributed(description)

    layout = list()
    layout.append(SectionHeader(heading))
    layout.append(Document(description_doc, width=300))

    for chapter in chapters:
        heading, text = chapter
        text_doc = pyglet.text.decode_attributed(text)
        layout.append(FoldingSection(heading,
                      Document(text_doc, width=300),
                      is_open=False))

    content = Frame(Scrollable(VerticalContainer(layout, align=HALIGN_LEFT),height=400))

    Manager(content, window=window, batch=batch, group=RenderingOrder.gui,
           anchor=ANCHOR_BOTTOM_RIGHT, theme=theme, is_movable=False)
 def setUp(self):
     TestPygletGUI.setUp(self)
     self.input = TextInput(text="test")
     self.manager = Manager(self.input,
                            window=self.window,
                            batch=self.batch,
                            theme=self.theme)
Esempio n. 7
0
    def setUp(self):
        super(TestHorizontalContainer, self).setUp()

        self.container = HorizontalContainer([Viewer(width=50, height=50),
                                           Viewer(width=50, height=50)])

        self.manager = Manager(self.container, window=self.window, batch=self.batch, theme=self.theme)
Esempio n. 8
0
    def init_menu_state(self):
        self.batch = pyglet.graphics.Batch()

        label = pyglet.text.Label('AsTeRoIdS',
                                  font_name='Times New Roman',
                                  font_size=36,
                                  x=window.width // 2,
                                  y=3 * window.height // 4,
                                  anchor_x='center',
                                  anchor_y='center',
                                  batch=self.batch,
                                  group=self.foreground)

        def callback1(is_pressed):
            self.init_game_state()
            self.state = 'PLAYING'

        button1 = Button('Start Game', on_press=callback1)

        def callback2(is_pressed):
            exit()

        button2 = Button('Quit', on_press=callback2)
        Manager(VerticalContainer([button1, button2]),
                window=window,
                theme=theme,
                batch=self.batch)

        self.asteroids = self.gen_asteroids(num_ast)
    def manager(self):

        self.managerList += [
            Manager(HorizontalContainer(
                [OneTimeButton(label="Continuar",
                               on_release=self.nextWindow)]),
                    window=self,
                    batch=self.batch,
                    theme=getTheme(),
                    anchor=ANCHOR_BOTTOM_RIGHT,
                    offset=(-80, 5),
                    is_movable=False)
        ]

        self.managerList += [
            Manager(VerticalContainer([
                Checkbox(label="El CPU Inicia        ",
                         on_press=self.setCPUStarts,
                         is_pressed=self.CPUStarts),
                Checkbox(label="El CPU es blancas",
                         on_press=self.setCPUPlayWhite,
                         is_pressed=self.CPUPlayWhite),
                Label(""),
                Label("Enroque de negras"),
                Checkbox(label="Lado de la Reina ",
                         on_press=self.setBlackQueenCastling,
                         is_pressed=self.blackQueenCastling),
                Checkbox(label="Lado del Rey       ",
                         on_press=self.setBlackKingCastling,
                         is_pressed=self.blackKingCastling),
                Label(""),
                Label("Enroque de blancas"),
                Checkbox(label="Lado de la Reina ",
                         on_press=self.setWhiteQueenCastling,
                         is_pressed=self.whiteQueenCastling),
                Checkbox(label="Lado del Rey       ",
                         on_press=self.setWhiteKingCastling,
                         is_pressed=self.whiteKingCastling)
            ]),
                    window=self,
                    batch=self.batch,
                    theme=getTheme(),
                    anchor=ANCHOR_RIGHT,
                    offset=(-50, -95),
                    is_movable=False)
        ]
Esempio n. 10
0
 def initManager(self):
     self.mode = MODE_CONNECTING
     self.guiBatch = pyglet.graphics.Batch()
     self.statusText = Label("Connecting", color=(255, 255, 255, 255))
     self.downloadText = Label("", color=(255, 255, 255, 255))
     self.manager = Manager(VerticalContainer(
         [self.statusText, self.downloadText]),
                            window=self.screen,
                            batch=self.guiBatch,
                            theme=theme)
Esempio n. 11
0
 def manager(self):
     Manager(Label(""), window=self, batch=self.batch, theme=getTheme())
     Manager(Frame(self.document),
             window=self,
             batch=self.batch,
             theme=getTheme(),
             anchor=ANCHOR_TOP_RIGHT,
             offset=(-10, -75),
             is_movable=False)
     Manager(HorizontalContainer([
         OneTimeButton(label="Guardar", on_release=self.saveGame),
         OneTimeButton(label="Volver", on_release=self.onclose)
     ]),
             window=self,
             batch=self.batch,
             theme=getTheme(),
             anchor=ANCHOR_BOTTOM_RIGHT,
             offset=(-50, 15),
             is_movable=False)
     self.document.set_text("")
Esempio n. 12
0
    def initNameMene(self):
        def sendMeneName(event):
            self.menename = self.nameInput.get_text()
            if len(self.menename) > 0:
                self.saveBtn.disabled = True

        self.naming = True
        label = Label("Name Your Mene",
                      color=g.postColor,
                      font_size=18,
                      bold=True)
        #meneTheme = Theme({g.spriteName: {
        #                "image": {
        #                    "source": g.spriteName+'_front.png'
        #                },
        #                "gui_color": [255,255,255,255]
        #            }
        #        },resources_path=g.dataPath+'/menes/'
        #)
        #picture = Graphic(g.spriteName,alternative=meneTheme)
        picture = Graphic(
            texture=g.gameEngine.resManager.meneSprites[g.spriteName]['front'])
        self.nameInput = TextInput(text="",
                                   padding=2,
                                   length=12,
                                   max_length=12,
                                   width=200,
                                   font_size=16)
        self.saveBtn = HighlightedButton(label="Save",
                                         on_release=sendMeneName,
                                         width=100,
                                         height=40,
                                         font_size=16)
        frame = Frame(VerticalContainer(content=[
            label, picture,
            HorizontalContainer([self.nameInput, self.saveBtn])
        ]),
                      path='frame_npc_talk')
        self.meneMan = Manager(frame,
                               window=self.screen,
                               batch=g.guiBatch,
                               theme=g.theme,
                               offset=(0, 0),
                               is_movable=False)
Esempio n. 13
0
    def on_mouse_press(self, x, y, button, modifiers):
        """
        A mouse press is going to create a manager with the options.
        """
        # if it's already opened, we just close it.
        if self._pulldown_menu is not None:
            self._delete_pulldown_menu()
            return

        # the function we pass to the manager.
        def on_escape(_):
            self._delete_pulldown_menu()

        # Compute the anchor point and location for the manager
        width, height = self._manager.window.get_size()
        if self.align == VALIGN_TOP:
            # Dropdown is at the top, pulldown appears below it
            anchor = ANCHOR_TOP_LEFT
            x = self.x
            y = -(height - self.y - 1)
        else:
            # Dropdown is at the bottom, pulldown appears above it
            anchor = ANCHOR_BOTTOM_LEFT
            x = self.x
            y = self.y + self.height + 1

        # we set the manager
        self._pulldown_menu = Manager(Frame(Scrollable(VerticalContainer(
            list(self._options.values())),
                                                       height=self.max_height,
                                                       fs=len(self._options)),
                                            path=['dropdown', 'pulldown']),
                                      window=self._manager.window,
                                      batch=self._manager.batch,
                                      group=self._manager.root_group.parent,
                                      theme=self._manager.theme,
                                      is_movable=False,
                                      anchor=anchor,
                                      offset=(x, y))
Esempio n. 14
0
    def setUp(self):
        TestPygletGUI.setUp(self)

        self.widgets = []
        for i in range(2):
            self.widgets.append(Viewer(width=100, height=50))
        for i in range(2):
            self.widgets.append(Viewer(width=20, height=50))

        self.container = VerticalContainer([
            HorizontalContainer([self.widgets[0], self.widgets[1]], padding=0),
            HorizontalContainer([
                Spacer(), self.widgets[2],
                Spacer(), self.widgets[3],
                Spacer()
            ],
                                padding=0)
        ],
                                           padding=0)

        self.manager = Manager(self.container,
                               window=self.window,
                               batch=self.batch,
                               theme=self.theme)
Esempio n. 15
0
    def init_dead_state(self):
        self.score_label.delete()

        gameover_label = pyglet.text.Label('Game Over',
                                           font_name='Times New Roman',
                                           font_size=36,
                                           x=window.width // 2,
                                           y=3 * window.height // 4,
                                           anchor_x='center',
                                           anchor_y='center',
                                           batch=self.batch)

        text = 'Final Score: ' + str(self.score)
        finalscore_label = pyglet.text.Label(text,
                                             font_name='Times New Roman',
                                             font_size=18,
                                             x=window.width // 2,
                                             y=3 * window.height // 4 - 50,
                                             anchor_x='center',
                                             anchor_y='center',
                                             batch=self.batch)

        def callback1(is_pressed):
            self.init_game_state()
            self.state = 'PLAYING'

        button1 = Button('Start Game', on_press=callback1)

        def callback2(is_pressed):
            exit()

        button2 = Button('Quit', on_press=callback2)
        Manager(VerticalContainer([button1, button2]),
                window=window,
                theme=theme,
                batch=self.batch)
Esempio n. 16
0
        "frame": {
            "image": {
                "source": "panel.png",
                "frame": [8, 8, 16, 16],
                "padding": [16, 16, 8, 8]
            }
        }
    },
    resources_path='../theme/')

content = Frame(
    Scrollable(VerticalContainer([
        SectionHeader("Folding"),
        Document("Click on the section headers below to open them.",
                 width=300),
        FoldingSection("Folding 1",
                       Document("This is the first folding.", width=300)),
        FoldingSection("Folding 2",
                       Document("This is the second folding.", width=300),
                       is_open=False),
        FoldingSection("Folding 3",
                       Document("This is the third folding.", width=300),
                       is_open=False),
    ],
                                 align=HALIGN_LEFT),
               height=400))

Manager(content, window=window, batch=batch, anchor=ANCHOR_CENTER, theme=theme)

pyglet.app.run()
Esempio n. 17
0
		print(GROWTH, (float(x - bar_x) / bar_width))
		return True

def f(value):
	print(value)
	global GROWTH
	if value <= 2:
		H.zoom_mode = False
	else:
		H.zoom_mode = True
		GROWTH = 100 - value

L = Letters(text=letters)
HS = HorizontalSlider(value=12, min_value=1.0, max_value=99.9, width=150, on_set=f)

Manager(VerticalContainer([HS, L]), window=window, batch=batch, theme=theme)
Manager.set_position(L, x=SCREENSIZE-300, y=SCREENSIZE-50)
Manager.set_position(HS, x=SCREENSIZE-300, y=SCREENSIZE-100)
# @clock
def drawArray(someArray):
	vertPoints = someArray[:, :2].flatten().astype(ctypes.c_float)
	gl.glVertexPointer(2, gl.GL_FLOAT, 0, vertPoints.ctypes.data)
	gl.glDrawArrays(gl.GL_POINTS, 0, len(vertPoints) // 2)

@window.event
def on_draw():
	gl.glPointSize(H.pointsize)
	gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
	drawArray(H.field)

def update(dt):
                        "padding": [18, 18, 8, 6]
                    }
                },
                "image": {
                    "source": "button.png",
                    "frame": [6, 6, 3, 3],
                    "padding": [12, 12, 4, 2]
                }
            }
        }
    },
    resources_path='../theme/')


def f():
    print("\n hola mundo \n")


# Set up a Manager
Manager(VerticalContainer([
    Label("Try (SHIFT+)TAB and ENTER"),
    FocusButton("Button 1", on_press=f()),
    FocusButton("Button 2"),
    FocusButton("Button 3")
]),
        window=window,
        batch=batch,
        theme=theme)

pyglet.app.run()
 def setUp(self):
     self.manager = Manager(self.button, window=self.window, batch=self.batch, theme=self.theme)
Esempio n. 20
0
    def initManagers(self):
        g.gameEngine.changeMusicSong(LOGINMENUSONG)
        g.gameEngine.musicManager.volume = g.MUSICVOLUME
        self.skyHeight = int(0.4592592 * g.SCREEN_HEIGHT)
        self.skyWidth = int(1.625 * g.SCREEN_WIDTH)
        self.ukkeliSprite._set_scale(self.screen.width / 1920.0)
        #self.ukkeliSprite.anchor_x=self.ukkeliSprite.width//2
        #self.ukkeliSprite.anchor_y=self.ukkeliSprite.height//2

        self.ukkeliSprite.x = 0.5 * self.screen.width
        self.ukkeliSprite2._set_scale(self.screen.width / 1920.0)
        self.ukkeliSprite2.x = 0.5 * self.screen.width
        #self.ukkeliSprite2.anchor_x=self.ukkeliSprite2.width//2
        #self.ukkeliSprite2.anchor_y=self.ukkeliSprite2.height//2
        self.logo._set_scale(self.screen.width / 1920.0)
        self.logo.x = (self.screen.width - self.l1.width *
                       (self.screen.width / 1920.0)) / 2
        self.logo.y = (self.screen.height - 350) * (1080.0 /
                                                    self.screen.height)

        self.charTick = int(
            (datetime.datetime.utcnow() -
             datetime.datetime(1970, 1, 1)).total_seconds() * 1000)

        label = Label("Username", color=g.loginFontColor, font_size=18)
        label1 = Label("Password", color=g.loginFontColor, font_size=18)
        self.logininput = TextInput(text="",
                                    padding=2,
                                    length=16,
                                    max_length=16,
                                    width=220,
                                    font_size=18)
        self.passwordinput = TextInput(text="",
                                       font=g.defaultPWFont.name,
                                       padding=0,
                                       length=21.5,
                                       width=220,
                                       font_size=18)

        self.button = HighlightedButton(label="Login",
                                        on_release=self.tryLogin,
                                        width=210,
                                        height=50,
                                        font_size=16)

        vertCont = VerticalContainer([
            label, self.logininput,
            Spacer(min_height=10), label1, self.passwordinput,
            Spacer(min_height=40), self.button
        ])

        versionInfo = Label("Version: " + GAME_VERSION,
                            color=(0, 0, 0, 255),
                            font_size=10)
        self.exitButton = HighlightedButton(label="Exit",
                                            on_release=self.exit,
                                            width=100,
                                            height=40,
                                            font_size=14)
        vertCont2 = VerticalContainer([versionInfo, self.exitButton])
        self.man1 = Manager(vertCont,
                            window=self.screen,
                            batch=g.guiBatch,
                            theme=g.theme,
                            offset=(0, -50),
                            is_movable=False)
        self.man2 = Manager(vertCont2,
                            window=self.screen,
                            batch=g.guiBatch,
                            theme=g.theme,
                            anchor=ANCHOR_BOTTOM_RIGHT,
                            offset=(-50, 50),
                            is_movable=False)
        self.man1.set_focus(self.logininput)
Esempio n. 21
0
                    "source": "slider-knob.png"
                },
                "offset": [-5, -11]
            },
            "padding": [8, 8, 8, 8],
            "step": {
                "image": {
                    "source": "slider-step.png"
                },
                "offset": [-2, -8]
            },
            "bar": {
                "image": {
                    "source": "slider-bar.png",
                    "frame": [8, 8, 8, 0],
                    "padding": [8, 8, 8, 8]
                }
            }
        }
    },
    resources_path='../theme/')

# Set up a Manager
Manager(VerticalContainer([HorizontalSlider(),
                           HorizontalSlider(steps=10)]),
        window=window,
        batch=batch,
        theme=theme)

pyglet.app.run()
Esempio n. 22
0
                },
                "offset": [0, 0]
            },
            "bar": {
                "image": {
                    "source": "vscrollbar.png",
                    "region": [0, 64, 16, 16]
                },
                "padding": [0, 0, 0, 0]
            }
        }
    },
    resources_path='../theme')

document = pyglet.text.decode_attributed('''
In {bold True}Pyglet-gui{bold False} you can use
{underline (255, 255, 255, 255)}pyglet{underline None}'s documents in a
scrollable window.

You can also {font_name "Courier New"}change fonts{font_name Lucia Grande},
{italic True}italicize your text{italic False} and use all features of Pyglet's document.
''')

# Set up a Manager
Manager(Document(document, width=300, height=50),
        window=window,
        batch=batch,
        theme=theme)

pyglet.app.run()
Esempio n. 23
0
            "unchecked": {
                "image": {
                    "source": "checkbox.png"
                }
            }
        }
    },
    resources_path='../theme/')


def f(y):
    print("\nholaMundo\n" + str(y))


# Set up a Manager
Manager(VerticalContainer([
    Button(label="Persistent button", on_press=f),
    OneTimeButton(label="One time button"),
    Checkbox(label="Checkbox"),
    GroupButton(group_id='1', label="Group 1:Button 1"),
    GroupButton(group_id='1', label="Group 1:Button 2"),
    GroupButton(group_id='2', label="Group 2:Button 1"),
    GroupButton(group_id='2', label="Group 2:Button 2"),
    GroupButton(group_id='2', label="Group 2:Button 3"),
]),
        window=window,
        batch=batch,
        theme=theme)

pyglet.app.run()
Esempio n. 24
0
from setup import *

from pyglet_gui.manager import Manager
from pyglet_gui.gui import Frame, Label
from pyglet_gui.theme import Theme

theme = Theme(
    {
        "font": "Lucida Grande",
        "font_size": 12,
        "text_color": [255, 255, 255, 255],
        "gui_color": [255, 0, 0, 255],
        "frame": {
            "image": {
                "source": "panel.png",
                "frame": [8, 8, 16, 16],
                "padding": [8, 8, 0, 0]
            }
        }
    },
    resources_path='../theme/')

Manager(Frame(Label('An example of a white label with a red frame')),
        window=window,
        batch=batch,
        theme=theme)

pyglet.app.run()
Esempio n. 25
0
                       "image": {
                           "source": "button.png",
                           "frame": [6, 6, 3, 3],
                           "padding": [12, 12, 4, 2]
                       }
                   }
               },
               "checkbox": {
                   "checked": {
                       "image": {
                           "source": "checkbox-checked.png"
                       }
                   },
                   "unchecked": {
                       "image": {
                           "source": "checkbox.png"
                       }
                   }
               }
              }, resources_path='../theme/')

# Set up a Manager
Manager(VerticalContainer([Button(label="Persistent button"),
                           OneTimeButton(label="One time button"),
                           Checkbox(label="Checkbox")]),
        window=window,
        batch=batch,
        theme=theme)

pyglet.app.run()
Esempio n. 26
0
                "image": {
                    "source": "vscrollbar.png",
                    "region": [0, 16, 16, 16],
                    "frame": [0, 6, 16, 4],
                    "padding": [0, 0, 0, 0]
                },
                "offset": [0, 0]
            },
            "bar": {
                "image": {
                    "source": "vscrollbar.png",
                    "region": [0, 64, 16, 16]
                },
                "padding": [0, 0, 0, 0]
            }
        }
    },
    resources_path='../theme')

# Set up a Manager
Manager(Dropdown([
    'Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta',
    'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', 'Omicron', 'Pi', 'Rho',
    'Sigma', 'Tau', 'Upsilon', 'Phi', 'Chi', 'Psi', 'Omega'
]),
        window=window,
        batch=batch,
        theme=theme)

pyglet.app.run()
Esempio n. 27
0
with open('theme/theme.json') as j:
    theme = Theme(json.load(j), resources_path='theme/')

# Set up a Manager
manager = Manager(
    VerticalContainer(
        [
            # ...
            Label(binding=Binding(context=model, path="title")),
            # ...
            VerticalContainer([
                # ...
                Label(binding=Binding(
                    template="$message", context=model, path="message")),
                # ...
                Button("Button 1", on_press=model.set_title(".")),
                OneTimeButton("Button 2", on_release=model.click),
                Button("Button 3"),
                LabelFactory(model, "message")
            ])
        ],
        align=pyglet_gui_constants.HALIGN_RIGHT,
        padding=5),
    window=win,
    batch=batch,
    theme=theme)


def draw(key: str, value: object):
    batch.draw()
    # print("manager: draw")
Esempio n. 28
0
 def setUp(self):
     TestPygletGUI.setUp(self)
     self.slider = HorizontalSlider(min_value=0, max_value=10)
     self.manager = Manager(self.slider, window=self.window, batch=self.batch, theme=self.theme)
Esempio n. 29
0
                    "region": [0, 16, 16, 16],
                    "frame": [0, 6, 16, 4],
                    "padding": [0, 0, 0, 0]
                },
                "offset": [0, 0]
            },
            "bar": {
                "image": {
                    "source": "vscrollbar.png",
                    "region": [0, 64, 16, 16]
                },
                "padding": [0, 0, 0, 0]
            }
        }
    },
    resources_path='../theme/')

# Set up a Manager
Manager(
    # an horizontal layout with two vertical layouts, each one with a slider.
    Scrollable(
        height=100,
        width=200,
        content=VerticalContainer(content=[Button(str(x))
                                           for x in range(10)])),
    window=window,
    batch=batch,
    theme=theme)

pyglet.app.run()
Esempio n. 30
0
    def initCreateChar(self):
        def checkClothingOk():
            found = 0
            #print g.clothingPairs
            for clothes in g.clothingPairs:
                found = 0
                if clothes["type"] == 'exclude':
                    if 'shirt' in clothes and clothes[
                            'shirt'] == myPlayer.shirt:
                        found += 1
                    if 'hat' in clothes and clothes['hat'] == myPlayer.hat:
                        found += 1
                    if 'face' in clothes and clothes['face'] == myPlayer.face:
                        found += 1
                    if 'shoes' in clothes and clothes[
                            'shoes'] == myPlayer.shoes:
                        found += 1
                    if found >= 2:
                        return False
            return True

        def hatLeft(event):
            myPlayer.hat -= 1
            if myPlayer.hat < 0:
                myPlayer.hat = g.MAX_HAT - 1
            if not checkClothingOk():
                hatLeft(None)
            self.changing = True

        def hatRight(event):
            myPlayer.hat += 1
            if myPlayer.hat >= g.MAX_HAT:
                myPlayer.hat = 0
            if not checkClothingOk():
                hatRight(None)
            self.changing = True

        def faceLeft(event):
            myPlayer.face -= 1
            if myPlayer.face < 0:
                myPlayer.face = g.MAX_FACE - 1
            if not checkClothingOk():
                faceLeft(None)
            self.changing = True

        def faceRight(event):
            myPlayer.face += 1
            if myPlayer.face >= g.MAX_FACE:
                myPlayer.face = 0
            if not checkClothingOk():
                faceRight(None)
            self.changing = True

        def shirtLeft(event):
            myPlayer.shirt -= 1
            if myPlayer.shirt < 0:
                myPlayer.shirt = g.MAX_SHIRT - 1
            if not checkClothingOk():
                shirtLeft(None)
            self.changing = True

        def shirtRight(event):
            myPlayer.shirt += 1
            if myPlayer.shirt >= g.MAX_SHIRT:
                myPlayer.shirt = 0
            if not checkClothingOk():
                shirtRight(None)
            self.changing = True

        def shoesLeft(event):
            myPlayer.shoes -= 1
            if myPlayer.shoes < 0:
                myPlayer.shoes = g.MAX_SHOES - 1
            if not checkClothingOk():
                shoesLeft(None)
            self.changing = True

        def shoesRight(event):
            myPlayer.shoes += 1
            if myPlayer.shoes >= g.MAX_SHOES:
                myPlayer.shoes = 0
            if not checkClothingOk():
                shoesRight(None)
            self.changing = True

        def facingLeft(event):
            myPlayer.dir -= 1
            if myPlayer.dir < DIR_DOWN:
                myPlayer.dir = DIR_RIGHT
                myPlayer.tmpPlayer.spriteFacing = 8
            elif myPlayer.dir == DIR_UP:
                myPlayer.tmpPlayer.spriteFacing = 5
            elif myPlayer.dir == DIR_LEFT:
                myPlayer.tmpPlayer.spriteFacing = 3
            elif myPlayer.dir == DIR_DOWN:
                myPlayer.tmpPlayer.spriteFacing = 0

            #myPlayer.tmpPlayer.spriteFacing-=1
            #if myPlayer.tmpPlayer.spriteFacing<0:
            #    myPlayer.tmpPlayer.spriteFacing=9
        def facingRight(event):
            myPlayer.dir += 1
            if myPlayer.dir > DIR_RIGHT:
                myPlayer.dir = DIR_DOWN
                myPlayer.tmpPlayer.spriteFacing = 0
            elif myPlayer.dir == DIR_UP:
                myPlayer.tmpPlayer.spriteFacing = 5
            elif myPlayer.dir == DIR_LEFT:
                myPlayer.tmpPlayer.spriteFacing = 3
            elif myPlayer.dir == DIR_RIGHT:
                myPlayer.tmpPlayer.spriteFacing = 8

        def saveClothes(event):
            self.ready = True
            saveBtn.disabled = True

        self.changing = True
        label = Label("Create Character", color=g.postColor, font_size=18)
        name = Label(myPlayer.name, bold=True, color=g.nameColor, font_size=18)
        hatBtnLeft = HighlightedButton(label="<-",
                                       on_release=hatLeft,
                                       width=25,
                                       height=25,
                                       font_size=13)
        hatBtnRight = HighlightedButton(label="->",
                                        on_release=hatRight,
                                        width=25,
                                        height=25,
                                        font_size=13)
        hatHorz = HorizontalContainer(
            content=[hatBtnLeft,
                     Spacer(256 - TILESIZE * 2, 0), hatBtnRight])

        faceBtnLeft = HighlightedButton(label="<-",
                                        on_release=faceLeft,
                                        width=25,
                                        height=25,
                                        font_size=13)
        faceBtnRight = HighlightedButton(label="->",
                                         on_release=faceRight,
                                         width=25,
                                         height=25,
                                         font_size=13)
        faceHorz = HorizontalContainer(
            content=[faceBtnLeft,
                     Spacer(256 - TILESIZE * 2, 0), faceBtnRight])

        shirtBtnLeft = HighlightedButton(label="<-",
                                         on_release=shirtLeft,
                                         width=25,
                                         height=25,
                                         font_size=13)
        shirtBtnRight = HighlightedButton(label="->",
                                          on_release=shirtRight,
                                          width=25,
                                          height=25,
                                          font_size=13)
        shirtHorz = HorizontalContainer(content=[
            shirtBtnLeft,
            Spacer(256 - TILESIZE * 2, 0), shirtBtnRight
        ])

        shoesBtnLeft = HighlightedButton(label="<-",
                                         on_release=shoesLeft,
                                         width=25,
                                         height=25,
                                         font_size=13)
        shoesBtnRight = HighlightedButton(label="->",
                                          on_release=shoesRight,
                                          width=25,
                                          height=25,
                                          font_size=13)
        shoesHorz = HorizontalContainer(content=[
            shoesBtnLeft,
            Spacer(256 - TILESIZE * 2, 0), shoesBtnRight
        ])

        facingBtnLeft = HighlightedButton(label="<---",
                                          on_release=facingLeft,
                                          width=30,
                                          height=30,
                                          font_size=13)
        facingBtnRight = HighlightedButton(label="--->",
                                           on_release=facingRight,
                                           width=30,
                                           height=30,
                                           font_size=13)
        facingHorz = HorizontalContainer(
            content=[facingBtnLeft, facingBtnRight])

        saveBtn = HighlightedButton(label="Save",
                                    on_release=saveClothes,
                                    width=100,
                                    height=40,
                                    font_size=16)

        frame = Frame(VerticalContainer(content=[
            label,
            Spacer(256 - TILESIZE, TILESIZE / 4), name,
            Spacer(0, 8), hatHorz, faceHorz, shirtHorz, shoesHorz, facingHorz,
            Spacer(0, 8), saveBtn
        ]),
                      path='frame_npc_talk')
        self.charMan = Manager(frame,
                               window=self.screen,
                               batch=g.guiBatch,
                               theme=g.theme,
                               offset=(0, 0),
                               is_movable=False)