I've struggled... Now I'm asking...
What's wrong with this code? Or more to the point,
how do you set the focus to an Entry widget?
Traceback (most recent call last):
File "./run_dialogue.py", line 33, in ?
app = Run_dialogue( root )
File "./run_dialogue.py", line 23, in __init__
self.cmd.focus()
AttributeError: 'NoneType' object has no attribute
'focus'
class Run_dialogue:
def __init__( self, master ):
img_path = path.dirname(sys.argv[0])
img_path = path.abspath(img_path)
#master.initial_focus.focus_set()
master.geometry( "300x150+200+200")
self.cmd_text = StringVar()
self.frame = Frame( master )
self.icon = PhotoImage( file=img_path +
"/target.gif" )
self.lbl_icon = Label( self.frame, image=self.icon )
self.lbl_icon.grid( row = 1, column = 0 )
self.label = Label( self.frame, text="Command: "
).grid( row = 1, column = 1 )
self.cmd = Entry( self.frame,
textvariable=self.cmd_text ).grid( row = 1, column = 2
)
self.btn = Button( self.frame, text=" Run ",
command=self.btn_run_click )
self.btn.grid( row = 2, column = 0, columnspan = 3,
sticky = "e")
self.btn.bind("<Return>", self.btn_run_click)
self.frame.pack()
self.cmd.focus()
Ronald Weidner
http://www.techport80.com
PHP Software developer for hire.
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor