In this example you would just have the line:
self.pword.signal_connect("activate",
self.pword_cb)
Steve George <[EMAIL PROTECTED]> writes:
> Hi,
>
> If you're specifically trying to do something with ssh there is
> gnome_ask_pass package which does what you describe.
>
> But, assuming this is a general question my attempts below. It's just
> GtkEntry with the 'set_visbility' method used. The only thing I couldn't work
> out was how to get it to respond to someone hitting the return key so you have
> to click the OK button - anyone know how to do this?
>
> #!/usr/bin/env python
> """ Forms a 'password entry window' that takes a password up to 8 chars """
> """ wide and prints it. """
> import gtk
>
> class GUI:
> """ Form the GUI and bootstrap the application """
> def __init__(self):
> self.root = gtk.GtkWindow(type=gtk.WINDOW_TOPLEVEL,
> title="Entry
> example")
> self.root.connect("destroy", gtk.mainquit)
>
> # Button box
> self.mbox = gtk.GtkVBox()
> self.root.add(self.mbox)
>
> # Message for the window
> self.pword = gtk.GtkEntry(maxlen=8)
> self.pword.set_visibility(gtk.FALSE)
> self.mbox.add(self.pword)
>
> # OK button
> self.okbut = gtk.GtkButton("OK")
> self.mbox.add(self.okbut)
> self.okbut.connect("pressed", self.pword_cb)
>
> # Show all the windows
> self.root.show_all()
> self.mainloop()
>
> """ This is the Apps mainloop """
> def mainloop(self):
> gtk.mainloop()
>
> def pword_cb(self, pwidget):
> print "The password was %s" % self.pword.get_text()
>
> if __name__ == '__main__':
> myGUI = GUI()
>
> Hope that answers it,
>
> Steve
>
>
>
> On Fri, Jun 22, 2001 at 10:03:09AM -0100, Morelli Enrico wrote:
> > Dear all,
> >
> > I should execute a command like another user from a pygtk application.
> > E.g. from a shell if I run ssh hostname, the system ask me for a password.
> > Is it possible to ask a password from an entry widget and pass it to the
> > command?
> >
> > Thanks a lot
> > --
> > \\\ //
> > (0 0)
> > ------------------------ooO-(_)-Ooo-------------------------------
> > #============================#=====================================#
> > | ENRICO MORELLI | email: [EMAIL PROTECTED] |
> > | * * * * | phone: +39 055 4574269 |
> > | University of Florence | fax : +39 055 4574253 |
> > | CERM - via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY |
> > #============================#=====================================#
> >
> >
> > _______________________________________________
> > pygtk mailing list [EMAIL PROTECTED]
> > http://www.daa.com.au/mailman/listinfo/pygtk
> _______________________________________________
> pygtk mailing list [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk