Esempio n. 1
0
def launch_rankings(garage):
    box = get_rankings_box()
##    box2 = thorpy.make_ok_box([box])
    box2 = thorpy.make_textbox("Rankings","",elements=[box])
##    box.set_size((300,300))
##    box.refresh_lift()
##    thorpy.launch(box2)
    box2.center()
##    thorpy.launch_blocking(box2,garage.e_bckgr)
    thorpy.launch_nonblocking(box2,launching=garage.e_bckgr)
Esempio n. 2
0
 def launch_em(self, cell, pos, rect):
     if not self.launched:
         self.launched = True
         self.redraw()
         self.update_em(cell)
         #
         self.em.set_visible(False)
         for e in self.em.get_descendants():
             e.set_visible(False)
         thorpy.launch_nonblocking(self.em, True)
         self.em.set_visible(True)
         for e in self.em.get_descendants():
             e.set_visible(True)
         self.em.set_center(pos)
         self.em.clamp(rect)
         self.em.blit()
         self.em.update()
def launch_nonblocking_alert(title,
                             text,
                             parent=None,
                             font_size=None,
                             font_color=None,
                             ok_text="Ok",
                             transp=False,
                             alpha_dialog=200,
                             func=None):
    if font_size is None: font_size = thorpy.style.FONT_SIZE
    if font_color is None: font_color = thorpy.style.FONT_COLOR
    box_alert = make_textbox(title, text, font_size, font_color, ok_text)
    box_alert.center()
    if transp:
        color_transp = tuple(list(thorpy.style.DEF_COLOR)[:3] + [alpha_dialog])
        box_alert.set_main_color(color_transp)
    thorpy.launch_nonblocking(box_alert)
def launch_nonblocking_choices(text,
                               choices,
                               parent=None,
                               title_fontsize=None,
                               title_fontcolor=None,
                               func=None):
    """choices are tuple (text,func)"""
    from thorpy.miscgui.launchers.launcher import post_done
    if title_fontsize is None: title_fontsize = thorpy.style.FONT_SIZE
    if title_fontcolor is None: title_fontcolor = thorpy.style.FONT_COLOR
    elements = [thorpy.make_button(t, f) for t, f in choices]
    ghost = thorpy.make_group(elements)
    e_text = thorpy.make_text(text, title_fontsize, title_fontcolor)
    box = thorpy.Box.make([e_text, ghost])
    box.center()
    from thorpy.miscgui.reaction import ConstantReaction
    for e in elements:
        reac = ConstantReaction(thorpy.constants.THORPY_EVENT, post_done, {
            "id": thorpy.constants.EVENT_UNPRESS,
            "el": e
        }, {"el": box})
        box.add_reaction(reac)
    thorpy.launch_nonblocking(box)
Esempio n. 5
0
def my_launch():
    some_element = thorpy.make_text("My text...", font_size=18)
    another_element = thorpy.make_button("Quit")
    box = thorpy.Box.make([some_element, another_element])
    thorpy.set_as_done_button(another_element,box)#could be set_as_cancel_button
    thorpy.launch_nonblocking(box) #could also use thorpy.launch_blocking...