Skip to content
/ editor Public

Python API to Input text, edit text or input command, The following features are supported.

Notifications You must be signed in to change notification settings

oy3o/editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Editor and InputBox

Python API to Input text, edit text or input command, The following features are supported.

  • arrow key to move cursor
  • backpace to delete char
  • utf-8 support (such as chinese)
  • scroll by cursor and mouse
  • click to position cursor
  • eventhandler
  • char count & max length
  • token count(tiktok)
─────────────────────────────────────────────────────────
      shortcut        │       description
─────────────────────────────────────────────────────────
      Ctrl+A          │       cursor to start
      Ctrl+E          │       cursor to end 
      Ctrl+X          │       clean all content
      Ctrl+Z          │       resotre pre action
      Ctrl+C          │       copy all content to clipboard
      Ctrl+V          │       paste from your clipboard
      Esc             │       exit edit

Editor

from oy3opy.editor import InputBox, Editor
import curses
window = curses.initscr()
# default value of arguments
e = Editor(window, top = 0, bottom = 0, right = 0, left = 0, padding_y = 0, padding_x = 1, text = '', listeners = {'change':[],'move':[]}, max_length = None, outline = 1, editable = True, stop = None)
text = e.edit()
print(text)

InputBox

# same arguments with Editor
# one line without outline version
view = screen.derwin(1, screen_width, screen_height-1, 0)
inputbox = InputBox(view, outline = 0, stop = '\n')
command = inputbox.edit()

About

Python API to Input text, edit text or input command, The following features are supported.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages