Odd behavior in Python/Tkinter?

Simon Forman sajmikins at gmail.com
Fri Dec 21 16:11:40 EST 2007


On Dec 21, 12:30 pm, Lie <Lie.1... at gmail.com> wrote:
> Inspect the following code:
>
> --- start of code ---
> import Tkinter as Tk
> from Tkconstants import *
>
> root = Tk.Tk()
>
> e1 = Tk.Entry(root, text = 'Hello World')
> e2 = Tk.Entry(root, text = 'Hello World')
>
> e1.grid(row = 1, column = 1)
> e2.grid(row = 2, column = 1)
>
> e1.insert(END, 'Hello Python')
>
> root.mainloop()
>
> --- end of code ---
>
> What do you expect the result should be?
> a. Two textboxes: One contains 'Hello Python', the other 'Hello World'
> b. Two textboxes: Both containing 'Hello World'
> c. Two textboxes: Both containing 'Hello Python'
> d. Two textboxes: Both empty
> e. Don't know
>
> Check your guess with your Python 2.5.1 (AFAIK, the latest version at
> the moment of writing)



Huh.  I got C (using python 2.4.3 on Ubuntu Linux..)

That ain't right.



More information about the Python-list mailing list