当前位置: 首页>>代码示例>>Python>>正文


Python Window.rmove方法代码示例

本文整理汇总了Python中window.Window.rmove方法的典型用法代码示例。如果您正苦于以下问题:Python Window.rmove方法的具体用法?Python Window.rmove怎么用?Python Window.rmove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在window.Window的用法示例。


在下文中一共展示了Window.rmove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import rmove [as 别名]
def main(screen):

   # setup the basic syntax for text files
   text_syntax = SyntaxClass("basic")
   text_syntax.add("character", r".")
   text_syntax.add("word", r" ")
   text_syntax.add("sentance", r"\.")

   # make the main window 
   mainwin = Window(screen, FileBuffer(open("README.markdown")))
   mainwin.render()

   # the event loop
   while True: 
      event = screen.getch()
      if event == ord("q"): break 
      
      if event == ord("e"): mainwin.clear()
      if event == ord("r"): mainwin.render()
      if event == ord("f"): mainwin.addstr("X")
      if event == ord("w"): mainwin.rmove(0, -1)
      if event == ord("a"): mainwin.rmove(-1, 0)
      if event == ord("s"): mainwin.rmove(0, +1)
      if event == ord("d"): mainwin.rmove(+1, 0)
      if event == ord("x"): mainwin.here()

      
      def find(syntaxname):
         return lambda t, x, y: text_syntax.find(syntaxname, t, x, y)

      if event == ord("c"): mainwin.movef(find("character"))
      if event == ord("v"): mainwin.movef(find("word"))
开发者ID:kerspoon,项目名称:cls-edit,代码行数:34,代码来源:textedit.py


注:本文中的window.Window.rmove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。