本文整理汇总了Python中widgets.Control.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Control.__init__方法的具体用法?Python Control.__init__怎么用?Python Control.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类widgets.Control
的用法示例。
在下文中一共展示了Control.__init__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self, title, content=None, is_open=True, align=HALIGN_CENTER):
Control.__init__(self)
if align == HALIGN_LEFT:
left_expand = False
right_expand = True
elif align == HALIGN_CENTER:
left_expand = True
right_expand = True
else: # HALIGN_RIGHT
left_expand = True
right_expand = False
self.is_open = is_open
self.folding_content = content
self.book = Graphic(self._get_image_path())
self.header = HorizontalLayout([
Graphic(path=["section", "left"], is_expandable=left_expand),
Frame(HorizontalLayout([
self.book,
Label(title, path=["section"]),
]), path=["section", "center"],
use_bg_group=True),
Graphic(path=["section", "right"], is_expandable=right_expand),
], align=VALIGN_BOTTOM, padding=0)
layout = [self.header]
if self.is_open:
layout.append(content)
VerticalLayout.__init__(self, content=layout, align=align)
示例2: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self, value=0.0, min_value=0.0, max_value=1.0, steps=None,
width=100, id=None, on_set=None, disabled=False):
"""
Creates a new slider.
@param min_value Minimum value
@param max_value Maximum value
@param steps None if this slider should cover the range from 0.0 to
1.0 smoothly, otherwise we will divide the range
up into steps. For instance, 2 steps would give the
possible values 0, 0.5, and 1.0 (then multiplied by scale)
@param width Minimum width of the tracking area. Note that this
is the interior length of the slider, not the overall
size.
@param id ID for identifying this slider.
@param on_set Callback function for when the value of this slider
changes.
@param diasbled True if the slider should be disabled
"""
Control.__init__(self, id=id, disabled=disabled)
self.min_value = min_value
self.max_value = max_value
self.steps = steps
self.min_width = width
self.on_set = on_set
self.bar = None
self.knob = None
self.markers = []
self.pos = max(
min(float(value - min_value) / (max_value - min_value), 1.0),
0.0)
self.offset = (0, 0)
self.step_offset = (0, 0)
self.padding = (0, 0, 0, 0)
self.is_dragging = False
示例3: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self, text="", is_checked=False, id=None,
align=HALIGN_RIGHT, padding=4, on_click=None,
disabled=False):
"""
Creates a new checkbox. The provided text will be used to caption the
checkbox.
@param text Label for the checkbox
@param is_checked True if we should start checked
@param id ID for value
@param align HALIGN_RIGHT if label should be right of checkbox,
HALIGN_LEFT if label should be left of checkbox
@param padding Space between checkbox and label
@param on_click Callback for the checkbox
@param disabled True if the checkbox should be disabled
"""
assert align in [HALIGN_LEFT, HALIGN_RIGHT]
Control.__init__(self, id=id, disabled=disabled)
self.text = text
self.is_checked = is_checked
self.align = align
self.padding = padding
self.on_click = on_click
self.label = None
self.checkbox = None
self.highlight = None
示例4: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self, width):
"""
Creates a new scrollbar.
@param width Width of the area for which we are a scrollbar
"""
Control.__init__(self, width=width, height=0)
self.__init2__(width)
示例5: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self, text="", anchor=ANCHOR_CENTER, menu=None,
disabled=False):
Control.__init__(self, disabled=disabled)
self.text = text
self.anchor = anchor
self.menu = menu
self.label = None
self.background = None
self.highlight = None
self.is_selected = False
示例6: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self):
"""
Creates a new event manager for a dialog.
@param content The Widget which we wrap
"""
Control.__init__(self)
self.controls = []
self.control_areas = {}
self.control_map = {}
self.hover = None
self.focus = None
self.wheel_hint = None
self.wheel_target = None
示例7: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self, id=None, text="", length=20, max_length=None, padding=0,
on_input=None, disabled=False):
Control.__init__(self, id=id, disabled=disabled)
self.text = text
self.length = length
self.max_length = max_length
self.padding = padding
self.on_input = on_input
self.document = pyglet.text.document.UnformattedDocument(text)
self.document_style_set = False
self.text_layout = None
self.label = None
self.caret = None
self.field = None
self.highlight = None
示例8: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self, text="", id=None, on_click=None, disabled=False):
"""
Creates a new Button. The provided text will be used to caption the
button.
@param text Label for the button
@param on_click Callback for the button
@param disabled True if the button should be disabled
"""
Control.__init__(self, id=id, disabled=disabled)
self.text = text
self.on_click = on_click
self.label = None
self.button = None
self.highlight = None
self.is_pressed = False
示例9: __init__
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import __init__ [as 别名]
def __init__(self, document, width=1000, height=5000,
is_fixed_size=False, always_show_scrollbar=False):
"""
Creates a new Document.
"""
Control.__init__(self, width, height)
self.max_height = height
self.content_width = width
if isinstance(document, basestring):
self.document = pyglet.text.document.UnformattedDocument(document)
else:
self.document = document
self.content = None
self.content_width = width
self.scrollbar = None
self.set_document_style = False
self.is_fixed_size = is_fixed_size
self.always_show_scrollbar = always_show_scrollbar
self.needs_layout = False