當前位置: 首頁>>代碼示例>>Python>>正文


Python clickable.Clickable類代碼示例

本文整理匯總了Python中thorpy.elements.clickable.Clickable的典型用法代碼示例。如果您正苦於以下問題:Python Clickable類的具體用法?Python Clickable怎麽用?Python Clickable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Clickable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _get_name_element

 def _get_name_element(self, name):
     painter = functions.obtain_valid_painter(painterstyle.DEF_PAINTER,
                                              size=style.SIZE)
     el = Clickable(name)
     el.set_painter(painter)
     el.finish()
     return el
開發者ID:YannThorimbert,項目名稱:ThorPy-1.0,代碼行數:7,代碼來源:boxlauncher.py

示例2: finish

    def finish(self):
        Clickable.finish(self)
##        self.e_color.stick_to(self, "right", "right")
##        self.e_color.move((-2,0))
        store(self, mode="h")
        self.fit_children()
        self._set_launcher()
開發者ID:YannThorimbert,項目名稱:Thorpy-1.5.2a,代碼行數:7,代碼來源:colorsetterlauncher.py

示例3: __init__

 def __init__(self,
              params,
              text="",
              title=None,
              click_cancel=False,
              text_ok="Ok",
              text_cancel="Cancel",
              paramsetter_elements=None):
     """params can either be a varset or a paramsetter.
     title can either be a string or an element."""
     if isinstance(params, ParamSetter):
         self.paramsetter = params
     else:
         self.paramsetter = ParamSetter(params, elements=paramsetter_elements)
         self.paramsetter.finish()
     self.click_cancel = click_cancel
     self.max_chars = float("inf")
     self.cut_text = ".."
     self.launcher = None
     e_title = _get_title(title)
     if e_title:
         elements = [e_title, self.paramsetter]
     else:
         elements = [self.paramsetter]
     box = launchmod.make_ok_cancel_box(elements, text_ok, text_cancel)
     self.launched = box
     Clickable.__init__(self, text)
開發者ID:YannThorimbert,項目名稱:Thorpy-1.5.2a,代碼行數:27,代碼來源:paramsetterlauncher.py

示例4: solo_blit

 def solo_blit(self):
     Clickable.solo_blit(self)
     if self._checked:
         clip = self.get_clip()
         r = self._check_img.get_rect()
         r.center = clip.center
         self.surface.blit(self._check_img, r)
開發者ID:YannThorimbert,項目名稱:ThorPy-1.4.2,代碼行數:7,代碼來源:checker.py

示例5: make_image_button

def make_image_button(img_normal, img_pressed=None, img_hover=None,
                        alpha=255, colorkey=None, text=""):
    e = Clickable(text)
    painter = ButtonImage(img_normal, img_pressed, img_hover, alpha, colorkey)
    e.set_painter(painter)
    e.finish()
    return e
開發者ID:YannThorimbert,項目名稱:Thorpy-1.5.2a,代碼行數:7,代碼來源:_wrappers.py

示例6: _force_unpress

    def _force_unpress(self):
        self._count = 0
        Clickable._unpress(self)
##        self._unhover_noblit()
        ev_untog = Event(constants.THORPY_EVENT,
                        id=constants.EVENT_UNTOGGLE, el=self)
        post(ev_untog)
        self.toggled = False
開發者ID:YannThorimbert,項目名稱:Thorpy-1.5.2a,代碼行數:8,代碼來源:togglable.py

示例7: _press

 def _press(self):
     Clickable._press(self)
     self._count += 1
     if not self.toggled:
         ev_tog = Event(constants.THORPY_EVENT, id=constants.EVENT_TOGGLE,
                         el=self)
         post(ev_tog)
         self.toggled = True
開發者ID:YannThorimbert,項目名稱:Thorpy-1.5.2a,代碼行數:8,代碼來源:togglable.py

示例8: _reaction_press

 def _reaction_press(self, pygame_event):
     Clickable._reaction_press(self, pygame_event)
     if self.current_state_key == constants.STATE_PRESSED:
         self.enter()
     elif self._activated:
         if not self.quit_on_click:
             self._value = self._inserted
         self.exit()
開發者ID:YannThorimbert,項目名稱:ThorPy-1.4.1,代碼行數:8,代碼來源:inserter.py

示例9: __init__

 def __init__(self):
     Clickable.__init__(self)
     reac_rightclick = Reaction(parameters.BUTTON_UNPRESS_EVENT,
                                self._reaction_rightpress,
                                {"button": parameters.RIGHT_CLICK_BUTTON},
                                name=constants.REAC_RIGHT_CLICK)
     self.add_reaction(reac_rightclick)
     self.normal_params.polite_set("painter size", (16, 16))
     self.press_params.polite_set("painter size", (16, 16))
開發者ID:YannThorimbert,項目名稱:ThorPy-1.0,代碼行數:9,代碼來源:_shifters.py

示例10: finish

 def finish(self):
     Clickable.finish(self)
     # cursor is initialized in finish because _iwriter needs self.fusionner
     #   to initialize...
     while not self._iwriter._is_small_enough(self._inserted) and self._inserted:
         self._inserted = self._inserted[:-1]
     self._iwriter.refresh_img()
     self.cursor = _Cursor(self)
     self.add_elements(list([self.cursor]))
     self._refresh_pos()
     self.cursor.finish()
     self._name_element.user_func = self.enter
開發者ID:YannThorimbert,項目名稱:ThorPy-1.4.1,代碼行數:12,代碼來源:inserter.py

示例11: finish

 def finish(self):
     Clickable.finish(self)
     # cursor is initialized in finish because _iwriter needs self.fusionner
     #   to initialize...
     self.make_small_enough(self._inserted)
     if not self._iwriter._is_small_enough(self._inserted):
         functions.debug_msg("Inserter is too small for value", self._inserted)
         if self.auto_resize:
             self.set_size(self._iwriter.get_rect().inflate((2,2)).size)
     self._iwriter.refresh_img()
     self.cursor = _Cursor(self)
     self.add_elements(list([self.cursor]))
     self._refresh_pos()
     self.cursor.finish()
     self._name_element.user_func = self.enter
開發者ID:YannThorimbert,項目名稱:Thorpy-1.5.2a,代碼行數:15,代碼來源:inserter.py

示例12: __init__

 def __init__(self,
              browser,
              name_txt="",
              file_txt="",
              launcher_txt="",
              normal_params=None,
              file_width=None,
              show_select=True,
              click_quit=False):
     """<browser> : the browser to be launched. Can either be a Browser
                    instance or a BrowserLight instance.
     <name_txt> : the text that stands before the (optionnal) file name and
                  the button to launch browser.
     <file_txt> : the default value shown to the user.
     <launcher_txt> : the text on the launcher button.
     """
     file_width = style.FILE_WIDTH if file_width is None else file_width
     self.show_select = show_select
     if not self.show_select:
         file_txt = ""
     _Launcher.__init__(self, "", normal_params, click_quit)
     self._spawn = "center"
     self.file_width = file_width
     self._done_element = Clickable(style.OK_TXT)
     self._done_element.finish()
     self._cancel_element = Clickable(style.CANCEL_TXT)
     self._cancel_element.finish()
     g = Ghost([self._done_element, self._cancel_element])
     g.finish()
     g.fit_children()
     g.rank = float("inf")
     store(g, g.get_elements(), "h")
     # to launch : must not be in self._elements!
     self.browser = browser
     box = Box(elements=[self.browser, g],
               storer_params=None)
     box.finish()
     self.launched_element = box
     self._deny_child(self.launched_element)
     # launcher
     self.launcher_el = self.get_launcher_element(launcher_txt)
     self.launcher_el.user_func = self.launch_box
     # name
     self._name_element = self._get_name_element(name_txt)
     self._name_element.user_func = self.launch_box
     self._file_element = self._get_file_element(file_txt)
     self.add_elements([self._name_element, self.launcher_el, self._file_element])
開發者ID:YannThorimbert,項目名稱:ThorPy-1.4.2,代碼行數:47,代碼來源:browserlauncher.py

示例13: make_button

def make_button(text, func=None, params=None):
    button = Clickable(text)
    button.finish()
    button.scale_to_title()
    if func:
        button.user_func = func
    if params:
        button.user_params = params
    return button
開發者ID:YannThorimbert,項目名稱:ThorPy-1.0,代碼行數:9,代碼來源:_wrappers.py

示例14: get_launcher_element

 def get_launcher_element(self, name):
     size = (style.SIZE[0], style.Y_SMALL_SIZE)
     painter = functions.obtain_valid_painter(
         painterstyle.BROWSER_LAUNCHER_PAINTER,
         size=size)
     el = Clickable(name)
     el.set_painter(painter)
     el.set_style(style.STYLE_BROWSER_LAUNCHER)
     el.finish()
     return el
開發者ID:YannThorimbert,項目名稱:ThorPy-1.4.2,代碼行數:10,代碼來源:browserlauncher.py

示例15: _get_name_element

 def _get_name_element(self, name, namestyle):
     painter = functions.obtain_valid_painter(
         painterstyle.INSERTER_NAME_PAINTER,
         size=style.SIZE)
     el = Clickable(name)
     el.set_painter(painter)
     if namestyle:
         el.set_style(namestyle)
     el.finish()
     return el
開發者ID:YannThorimbert,項目名稱:ThorPy-1.4.1,代碼行數:10,代碼來源:inserter.py


注:本文中的thorpy.elements.clickable.Clickable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。