Mark,

There are two problems here:

> from Tkinter import *
> def go():...

> e=Entry(main)
> e.pack()

This is OK but...

> b=Button(main,text='OK',command=go()).pack()

Problem 1:
This will store None in b because pack() always returns None.

Problem 2:
> For some reason the function is called before I click the button,
and
> I get .10037088 before I have done a thing.

Thats because you are calling go() inside the widget specification,
you need to pass a reference to the function instead - ie miss out
the parens:

b=Button(main,text='OK',command=go)
b.pack()

That should fix it.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to