Tcl/Tk corresponding code :
image create photo PngSearch -file files/search.png
image create photo PngCancel -file files/cancel.png
set Frame [ttk::frame .frame]
pack $Frame -side top -expand 1 -fill x
set QueryInput "Search"
set Sentry [ttk::entry .frame.sentry -textvariable QueryInput -foreground gray85]
pack $Sentry -side top -padx 10 -expand 1 -fill both -ipadx 100
set buttonLeft [label .frame.sentry.bleft -image PngCancel -background white -borderwidth 0]
pack $buttonLeft -side right -anchor w -padx 10 -pady 10 -expand 0 -fill none
set button [label .frame.sentry.b -image PngSearch -background white -borderwidth 0]
pack $button -side right -anchor w -padx 0 -pady 10 -expand 0 -fill none
#bindings
bind $buttonLeft <Button-1> {cancel}
bind $button <Button-1> {search}
#deleteting word "search" when widget gets focus
bind $Sentry <FocusIn> {
set ::QueryInput ""
$Sentry configure -foreground black
}
#resetting word "search" when widget looses focus
bind $Sentry <FocusOut> {
set ::QueryInput "Search"
$Sentry configure -foreground gray85
}
proc search {} {
puts "Performing search"
}
proc cancel {} {
puts "Deleting search entry"
set ::QueryInput ""
}
Just to see if it was easy to translate back to Tcl