from Tkinter import *from tkMessageBox import *class EntryDemo( Frame ): def __init__( self ): Frame.__init__( self ) self.pack( expand = YES, fill = BOTH ) self.master.title( "Testing Entry Components" ) self.master.geometry( "325x100" ) self.frame1 = Frame( self ) self.frame1.pack( pady = 5 ) self.text3 = Entry( self.frame1, name = "text3" ) self.text3.insert( INSERT, "Uneditable text field" ) self.text3.config( state = DISABLED ) self.text3.bind( "<Return>", self.showContents ) self.text3.pack( side = LEFT, padx = 5 ) def showContents( self, event ): theName = event.widget.winfo_name() theContents = event.widget.get() showinfo( "Message", theName + ": " + theContents )EntryDemo().mainloop()
Name (required)
email (will not be published) (required)
Website