How do I place a preset into the text box?

Cousin Stanley HooDunnit at didly42KahZidly.net
Fri Aug 28 07:46:31 EDT 2020


Steve wrote:

> The following program compiles but does not quite do what I would like it to
> do. Line 19 is the preset information but I do not seem to be able to get it
> into the form by code.  My purpose is to let the user make changes without
> having to re-enter the entire code.
> ....

You might consider moving the entry  get()  function
into the  Submit()  call back ....

def Submit() :

    label.configure( text = 'The new code is : ' + NewCode.get() )

    x = ( NewCode.get() )

    print( "\n  The new code entered is :  " + x )



The following  insert  function will show the OldCode
in the  entry  box ....
 
OldCode = ( "1234-abcd" )

# ....

CodeEntered = ttk.Entry( window , width = 15 , textvariable = NewCode )

CodeEntered.grid( column = 2 , row = 3 , pady = 10 )

CodeEntered.insert( 0 , OldCode )


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona



More information about the Python-list mailing list