Problem (or even bug?) with Tkinter

Matt Hammond matt.hammond at rd.bbc.co.uk
Fri Aug 19 04:53:20 EDT 2005


Here's a strange one in Tkinter that has me stumped:
(I'm running python 2.4 on Suse Linux 9.3 64bit)

I'm trying to make a set of Entry widgets with Label widgets to the left  
of each one, using the grid layout. If I make and grid the Label *before*  
the Entry then the Entry widget doesn't seem to work - it lets me put the  
cursor in it, but I can't type! See example code below.

Is this just me doing something really really silly, or is there a bug  
here?

I'm inclined to think the latter. I've been developing with python 2.4 on  
Suse Linux 9.3 64bit. I've just tested it on a Win2k machine witih python  
2.3 and can type into both Entry widgets.

regards


Matt
-------

#!/usr/bin/env python

import Tkinter

class ProblemGUI(object):

     def __init__(self):
         super(ProblemGUI, self).__init__()
         self.window = Tkinter.Tk()

         self.window.title("Try typing into both Entry widgets")

         # declare and grid Entry widget before Label widget
         self.entry1 = Tkinter.Entry(self.window)
         self.entry1.grid(row=0, column=1)

         self.label1 = Tkinter.Label(self.window, text="CAN WRITE ->")
         self.label1.grid(row=0,column=0)

         # declare and grid Label widget before Entry widget
         self.label2 = Tkinter.Label(self.window, text="CAN'T WRITE ->")
         self.label2.grid(row=1,column=0)

         self.entry2 = Tkinter.Entry(self.window)
         self.entry2.grid(row=1, column=1)


x=ProblemGUI()
x.window.mainloop()


-- 

| Matt Hammond
| R&D Engineer, BBC Research and Development, Tadworth, Surrey, UK.



More information about the Python-list mailing list