TkEntry problem to echo TkEntry value

S

sujeet kumar

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?=20
I tried to use "echo" function of Ruby gem's highline , it worked for
console input using "data =3D ask("Question ") { |q| q.echo =3D "*"}".
But i don't know how to use the same for TkEntry.

Is there any other approach? How to do this?

regards
sujeet
 
M

Markus Weihs

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
 
H

Hidetoshi NAGAI

From: sujeet kumar <[email protected]>
Subject: TkEntry problem to echo TkEntry value
Date: Thu, 23 Jun 2005 01:13:31 +0900
Message-ID: said:
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
--------------------------------------------------------------
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top