This is a multi-part message in MIME format.
--------------070204040903030605040605
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Gary Thornock wrote:
> There's at least one copy of the xless source at
> http://packages.debian.org/unstable/text/xless.html
> 
> I suspect there are several others floating around, too.
> 
> I don't know of any other program that does the same thing, although,
> as you say, it couldn't be too hard to write one in C++/QT. :)

Couldn't get that to compile either.  So I just hacked up a textbox 
example on the pygtk site -- 48 lines of code total.  It's attached.

--
Soren Harward
[EMAIL PROTECTED]


--------------070204040903030605040605
Content-Type: text/plain;
 name="gtkless.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="gtkless.py"

#!/usr/bin/env python

import gtk, sys

class textwindow:
    def close_application(self, widget):
        gtk.mainquit()

    def __init__(self):
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        rootbox = gtk.VBox(gtk.FALSE, 0)
        sw = gtk.ScrolledWindow()
        textview = gtk.TextView()
        button = gtk.Button("close window")

        window.connect("destroy", self.close_application)
        window.set_title("gtkless.py")
        window.set_border_width(3)
        window.set_size_request(560, 480)
        window.set_resizable(gtk.TRUE)  
        window.add(rootbox)
        rootbox.pack_start(sw, gtk.TRUE, gtk.TRUE, 0)
        rootbox.pack_start(button, gtk.FALSE, gtk.TRUE, 2)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.add(textview)
        textbuffer = textview.get_buffer()
        try:
            infile = open(sys.argv[1],"r")
        except IndexError:
            string = sys.stdin.read()
        except IOError:
            string = "no file called " + sys.argv[1] + " found"
        else:
            string = infile.read()
            infile.close()
        textbuffer.set_text(string)
        button.connect("clicked", self.close_application)
        button.set_flags(gtk.CAN_DEFAULT)
        button.grab_default()
        window.show_all()

def main():
    gtk.main()
    return 0       

if __name__ == "__main__":
    textwindow()
    main()

--------------070204040903030605040605--



____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to