Simple Gui for Data entry...

Meehan, Francois Francois at iecholden.com
Thu Dec 12 14:58:18 EST 2002


Hi all,

I am working on a script where I need to validate a bit of data by the user.
So, I have some values, then I need to send a window with them, have the
user to override the info if need be. 

Good or bad, I decided to use Pmw, as it seemed to be easy to use.  I used
easygui before, but could not find out how to have multiple entry fields
plus and exit button in a single window. 

I have the following code: 

import Pmw, Tkinter
testval = 'hello toi!'

root = Pmw.initialise(fontScheme = 'pmw1')

entry = Pmw.EntryField(
        label_text = 'Real entry:',
        labelpos = 'w',
        value = testval,
)
entry.pack(fill = 'x', padx = 10, pady = 10)

# Create an exit button.
exit = Tkinter.Button(text = 'Exit', command = root.destroy)
exit.pack(pady = 20)

root.mainloop()
print testval 


That displays the window with the testval value, let me changed it in the
window but never updates "testval".  I know that there is a getvalue()
method, but don't know how to invoke it properly.

Thanks in advance,



Francois Meehan




More information about the Python-list mailing list