[Twisted-Python] Twisted and Urwid
Cary Hull
cary.hull at gmail.com
Sun Dec 28 02:13:52 MST 2008
Did you look at this?
http://excess.org/article/2008/09/urwid-gets-twisted-support/
Otherwise it looks like the error you are seeing there is due to not
setting up a palette.
-Cary
On Sat, Dec 27, 2008 at 10:08 AM, Christian Scharkus
<mail.sensenmann at googlemail.com> wrote:
> Hi folks.
>
> I've got a new question. After recongnising that the python bindings for
> curses are not fully capable of displaying the unicode-chars I decided to
> drop curses and shifted to urwid. Now I've got some basic questions in the
> matter of urwid and twisted. As you may know I'm using a mvc-pattern and I
> have not discovered a way to combine _and_ start urwid with twisted yet.
> Maybe someone who already worked with urwid can give me a small hint.
>
> Code:
>
> http://codepad.org/0Hlvmp1b
>
> class Input:
> def __init__(self,term):
>
> self.term = term
> self.size = self.term.get_cols_rows()
>
> self.input = urwid.Edit()
>
> self.filler = urwid.Filler(self.input)
>
> self.canvas = self.filler.render( self.size, focus=True )
>
> self.term.draw_screen(self.size,self.canvas)
>
> reactor.addReader(self)
>
> def fileno(self):
>
> return 0
>
> def logPrefix(self):
> return 'CursesClient'
>
>
> def doRead(self):
> keys = self.term.get_input_nonblocking()
>
> for key in keys:
> if key == 'window resize':
>
> self.size = self.term.get_cols_rows()
>
> elif key == 'enter':
> text = self.input.get_edit_text()
>
> controller.sendMsg('dev',text)
>
> self.input.set_edit_text('')
>
> else:
> self.filler.keypress(self.size, key)
>
>
> term = urwid.raw_display.Screen()
>
> term.run_wrapper(lambda: Input(term))
>
>
>
>
> Traceback (most recent call last):
> File "./keckz.py", line 44, in <module>
>
> f.startKeckz(f.host, f.view)
>
> File "./keckz.py", line 38, in startKeckz
>
> controllerKeckz.Kekzcontroller(View).startConnection(host,23002)
>
> File "/home/arch/keckz/trunk/controllerKeckz.py", line 13, in __init__
>
> self.view = interface(self)
>
> File "/home/arch/keckz/trunk/urwid_cli.py", line 21, in __init__
>
> self.term.run_wrapper(lambda: Input(self.term))
>
> File "/usr/lib/python2.6/site-packages/urwid/raw_display.py", line 212, in
> run_wrapper
>
> return fn()
> File "/home/arch/keckz/trunk/urwid_cli.py", line 21, in <lambda>
>
> self.term.run_wrapper(lambda: Input(self.term))
>
> File "/home/arch/keckz/trunk/urwid_cli.py", line 55, in __init__
>
> self.term.draw_screen(self.size,self.canvas)
>
> File "/usr/lib/python2.6/site-packages/urwid/raw_display.py", line 579, in
> draw_screen
>
> assert self.palette.has_key(a), `a`
>
> AssertionError: None
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
--
01100011 01100001 01110010 01111001
More information about the Twisted-Python
mailing list