本文整理汇总了Python中frame.Frame.mode方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.mode方法的具体用法?Python Frame.mode怎么用?Python Frame.mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类frame.Frame
的用法示例。
在下文中一共展示了Frame.mode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Argon
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import mode [as 别名]
argon = Argon(600, 800)
#from mode import Mode, SelectionMode
default = renderer.get_default_style(argon).inherit(
color = whiteish,
)
language = __import__('strike')
EditMode = language.EditMode
layouter = language.init(argon, default, theme)
toolbar_height = argon.default_font.height*2
frame = Frame((0, 0, argon.width, argon.height-toolbar_height), document, layouter)
frame.mode = EditMode(frame, mutable.normalize(document, False))
def set_mode(new_mode):
if frame.mode is not None:
frame.mode.free()
frame.mode = new_mode
box7 = argon.load.patch9('box7.png')
frame.style.update(
background_color = theme.background,
caret_color = rgba(255, 255, 255, 255),
selection_background = box7,
selection_color_inner = rgba(0, 0, 255, 128),
selection_color_outer = rgba(32, 32, 255, 128),
selection_color_bad = rgba(255, 255, 0, 192),
)
示例2: Selection
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import mode [as 别名]
return Selection(mutor, *ext)
else:
return mutor
def get_str(mutor):
if isinstance(mutor, Selection):
info, ctx = mutor.mutator.struct.proxy.unroll()
index = mutor.mutator.index
return repr((ctx, index, (mutor.head, mutor.tail)))
else:
info, ctx = mutor.struct.unroll()
return repr((ctx, mutor.index, None))
from schema import language
frame.mode = None
def set_mode(mode):
if frame.mode is not None:
frame.mode.free()
frame.mode = mode
ctx, index, ext = walk_head(macron.spec, 1)
intron = locate_intron(frame.contents, roll(macron.spec, ctx), index)
intron.controller.enter_descend(intron)
@argon.listen
def on_frame(time):
width, height = argon.resolution
hw = width / 2
hh = height / 2