本文整理汇总了Python中thorpy.elements.element.Element.set_style方法的典型用法代码示例。如果您正苦于以下问题:Python Element.set_style方法的具体用法?Python Element.set_style怎么用?Python Element.set_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thorpy.elements.element.Element
的用法示例。
在下文中一共展示了Element.set_style方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_file_element
# 需要导入模块: from thorpy.elements.element import Element [as 别名]
# 或者: from thorpy.elements.element.Element import set_style [as 别名]
def _get_file_element(self, name):
painter = functions.obtain_valid_painter(painterstyle.NAME_PAINTER,
size=style.SIZE)
el = Element(name)
el.set_painter(painter)
el.set_style(style.STYLE_NAME)
el.finish()
return el
示例2: add_basic_help
# 需要导入模块: from thorpy.elements.element import Element [as 别名]
# 或者: from thorpy.elements.element.Element import set_style [as 别名]
def add_basic_help(self, text, wait_time=None, jail=None):
helper = Element(text)
helper.set_style("help")
helper.finish()
helper.scale_to_title()
if wait_time is None:
wait_time=self._help_wait_time
helper.set_help_of(self, self._help_wait_time)
if jail:
helper.set_jailed(jail)
示例3: _get_value_element
# 需要导入模块: from thorpy.elements.element import Element [as 别名]
# 或者: from thorpy.elements.element.Element import set_style [as 别名]
def _get_value_element(self, valuestyle):
painter = functions.obtain_valid_painter(
painterstyle.CHECKER_VALUE_PAINTER,
size=style.CHECK_SIZE)
el = Element(str(self.get_value()))
el.set_painter(painter)
if valuestyle:
el.set_style(valuestyle)
el.finish()
return el
示例4: _get_name_element
# 需要导入模块: from thorpy.elements.element import Element [as 别名]
# 或者: from thorpy.elements.element.Element import set_style [as 别名]
def _get_name_element(self, name, namestyle):
painter = functions.obtain_valid_painter(
painterstyle.CHECKER_NAME_PAINTER,
size=style.SIZE)
el = Element(name)
el.set_painter(painter)
if namestyle:
el.set_style(namestyle)
el.finish()
return el
示例5: make_text
# 需要导入模块: from thorpy.elements.element import Element [as 别名]
# 或者: from thorpy.elements.element.Element import set_style [as 别名]
def make_text(text, font_size=style.FONT_SIZE, font_color=style.FONT_COLOR):
params = {"font_color":font_color, "font_size":font_size}
button = Element(text, normal_params=params)
if not "\n" in text:
button.set_style("text")
button.finish()
if "\n" in text:
button.scale_to_title()
button.set_main_color((0,0,0,0))
return button
示例6: ColorSetterLauncher
# 需要导入模块: from thorpy.elements.element import Element [as 别名]
# 或者: from thorpy.elements.element.Element import set_style [as 别名]
class ColorSetterLauncher(Clickable):
@staticmethod
def make(colorsetter,
text="",
show_select=True,
click_cancel=False):
cs = ColorSetterLauncher(colorsetter, text, show_select, click_cancel)
cs.finish()
return cs
def __init__(self,
colorsetter,
text="",
show_select=True,
click_cancel=False):
self.text = text
self.show_select = show_select
self.click_cancel = click_cancel
if not isinstance(colorsetter, ColorSetter):
self.colorsetter = ColorSetter.make(self.text, value=colorsetter)
else:
self.colorsetter = colorsetter
self.old_color = self.colorsetter.get_value()
self.launched = launchmod.make_ok_cancel_box([self.colorsetter], "Ok", "Cancel") #!!! text
self.launcher = None
self.e_color = get_example_element(self.colorsetter.get_color(), (20,20))
self.e_text = Element(self.text)
self.e_text.set_style("text")
self.e_text.finish()
self.unlaunch_func = None
Clickable.__init__(self, elements=[self.e_text, self.e_color])
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()
def get_value(self):
return self.colorsetter.get_value()
def set_value(self, value):
self.colorsetter.set_value(value)
self.refresh()
def refresh(self):
color = self.colorsetter.get_value()
self.e_color.get_elements()[0].set_main_color(color)
self.old_color = color
def _set_launcher(self):
launcher = launchmod.Launcher(self.launched, launching=self)
reac_enter = ConstantReaction(constants.THORPY_EVENT,
launcher.launch,
{"id": constants.EVENT_UNPRESS, "el":self})
## reac_name="reac_launch")
reac_done = ConstantReaction(constants.THORPY_EVENT,
self.unlaunch,
{"id": constants.EVENT_DONE, "el":self.launched})
## reac_name="reac_done")
reac_cancel = ConstantReaction(constants.THORPY_EVENT,
self._unlaunch_cancel,
{"id": constants.EVENT_CANCEL, "el":self.launched})
## reac_name="reac_cancel")
if self.click_cancel:
reac_click_cancel = Reaction(parameters.MOUSEBUTTONUP,
self._unlaunch_click_cancel,
params={"launcher":launcher})
## reac_name="reac_cancel")
self.launched.add_reaction(reac_click_cancel)
self.launched.add_reaction(reac_cancel)
self.add_reaction(reac_enter)
self.launched.add_reaction(reac_done)
self.launcher = launcher
def _unlaunch_cancel(self, what=CANCEL):
self.colorsetter.set_value(self.old_color)
self.launcher.unlaunch(what)
def _unlaunch_click_cancel(event, launcher):
if not launcher.launched.collide(event.pos):
self._unlaunch_cancel(CLICK_QUIT)
def default_unlaunch(self):
self.refresh()
self.launcher.unlaunch(DONE)
## self._file_element.set_text(text,
## size=(self.file_width, self.get_fus_rect().h),
## cut=True)
def unlaunch(self):
if not self.unlaunch_func:
self.default_unlaunch()
else:
self.unlaunch_func()
示例7: set_style
# 需要导入模块: from thorpy.elements.element import Element [as 别名]
# 或者: from thorpy.elements.element.Element import set_style [as 别名]
def set_style(self, new_style):
Element.set_style(self, new_style)
self.press_params.params["style"] = new_style