From: michael libby Date: 2002-07-10T10:56:28+09:00 Subject: Re: Ruby/Tk, TkMessage -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 09 July 2002 00:45, Dandan He wrote: > Hello, > > I need to use a Ruby/Tk widget to display some read-only information, > which can be multi-line. I need the widget to be displayed as a > certain size (say, width=100, height=50) even when it doesn't have any > text in it. I would use TkText if there is a way to make it read-only. This procedure will still allow the text to be selected, but won't allow for modifications, or even an insertion cursor. require 'tk' root = TkRoot.new() text = TkText.new(root){height 10; width 20}.pack text.insert('0.1', 'This is my message') text.state('disabled') root.mainloop Height and width I did not set to 50 and 100, since those attributes for a TkText widget are in characters rather than pixels (and at least on my screen that results in a screen-filling widget). The state attribute/method and the height/width idiosyncrasies are documented in the Tk documentation for the text command at http://www.tcl.tk. That's always the first place I look for stuff like this. I'll have to look into TkMessage before I can comment on that... it's not a widget I've ever used. HTH - -michael - -- ______Michael_C_Libby__{_x_(at)_ichimunki_(dot)_com_}______ | my Ruby website: http://www.andsoforth.com/ | |____ public key at http://www.ichimunki.com/public.key ____| -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9K5JT4ClW9KMwqnMRAiVGAJ9v80F2Z1KLBbGZIncQxxtr2fLUewCggEb+ GIf0MO4GErbB7UwZHa1FIcY= =/P/K -----END PGP SIGNATURE-----