Hi
I want to take some data( given by user from) from TkEntry . But I
also want data to be not seen by other. So i want whatever he types in
TkEntry, some echo character like " * " prints instead of original
letters. And program can use that data.
What should I do?
I tried to use "echo" function of Ruby gem's highline , it worked for
console input using "data = ask("Question ") { |q| q.echo = "*"}".
But i don't know how to use the same for TkEntry.
Is there any other approach? How to do this?
regards
sujeet
Hi!
Entries have the option "show":
require 'tk'
root = TkRoot.new
e = TkEntry.new(root) {
show '*'
pack
}
TkButton.new(root) {
text 'Ok'
command proc{p e.get()}
pack
}
Tk.mainloop()
Is this what you want?
Regards, Markus
Message-ID: <734fb92405062209137e4bc0e7@mail.gmail.com>
I want to take some data( given by user from) from TkEntry . But I
also want data to be not seen by other. So i want whatever he types in
TkEntry, some echo character like " * " prints instead of original
letters. And program can use that data.
Please read man pages of Tcl/Tk. 
For example, the manual of "entry" describes
···
From: sujeet kumar <sujeetkr@gmail.com>
Subject: TkEntry problem to echo TkEntry value
Date: Thu, 23 Jun 2005 01:13:31 +0900
--------------------------------------------------------------
Command-Line Name:-show
Database Name: show
Database Class: Show
If this option is specified, then the true contents
of the entry are not displayed in the window.
Instead, each character in the entry's value will
be displayed as the first character in the value of
this option, such as ``*''. This is useful, for
example, if the entry is to be used to enter a
password. If characters in the entry are selected
and copied elsewhere, the information copied will
be what is displayed, not the true contents of the
entry.
--------------------------------------------------------------
If you want to use this option on Ruby/Tk,
you have to use "show" option which is a name removed the
head '-' of "Command-Line Name".
For example,
e = TkEntry.new(f, :show=>'x') or e = TkEntry.new(f, 'show'=>'x')
e.show('*')
e[:show] = '-' or e['show'] = '-'
e.configure(:show=>'o') or e.configure('show'=>'o')
and so on.
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)