Posts

Showing posts with the label python

lab 103 - python content assist

NAME lab 103 - python content assist NOTES Building on lab 102 I've started to write an acme client for python content-assist in python. I read the code for python's IDLE editor and pulled some pieces out of that to help with my implementation. The AutoComplete.py and CallTip.py modules are copied out of idlelib and reduced to just the functions I needed. Just as in lab 102 the acme client is implemented using pyxp to connect to the acme file system. In an acme editor window execute PyAssist. Start typing some python. After typing a dot the client will display available attributes for the module. Continue typing and it will reduce the list to those names with a matching prefix. Press the Tab key to complete a name or prefix depending on whether there is one or more names. After typing an open parenthesis the client will show the call tip for the function. The client implements an Import command so that more python modules can be added to the namespace. PyAssist ...

lab 102 - python acme client

NAME lab 102 - python acme client NOTES A recent post to 9phackers announced Pyxp , another implementation of Styx in Python. I immediately downloaded Pyxp and tried it out. I had no trouble using it so I started thinking about python clients I could write. Python is still new to me so writing a styx client was an excuse to get more practice. I started with an acme client. I translated the acmewin limbo module I use for most acme-sac clients to python. Below is a simple example opening a new acme window and doing some operations on it. from acmewin import Acmewin win = Acmewin() win.writebody("hello, world!\n\n\n") win.tagwrite("Hello") win.writebody("goodbye") win.replace("/goodbye/", "GOODBYE") win.select(",") win.show() Remember to export the namespace before trying it out. % styxlisten -A 'tcp!*!localhost' export / % textclient.py I recently saw on Hacker News a repost of Peter Norvig's spelli...