Greetings: > -----Original Message----- > Date: Wed, 26 Jul 2006 10:11:28 +0100 > From: "Alan Gauld" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] loops to assign variables > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > <<snip>> > > "John CORRY" <[EMAIL PROTECTED]> wrote > > > For example, I have 30 textentry boxes numbered from entry20 to > > entry50. > > I have used the following code to assign the entryboxes to a local > > name. > > > > text20 = self.wTree.get_widget("entry20") > > text21 = self.wTree.get_widget("entry21") > > This is not a resonse to Johns original request but a general > comment on variable naming. It seems quite common in GUI > work for folks to use this style of entryN, buttonM etc. > > But its not very programmer friendly! We wouldn't normally > call our variables var1, var2 etc it makes the intent of the code > much harder to comprehend. So we choose meaningful variable > names like width, height, name, location etc. > <<snip>>
I agree with Alan here. Unless the numbers reflect some property of the object being modeled (room numbers in a hotel, airline flight numbers, TV channels, etc), they should not be used in the widget name. My $0.02. Regards, Barry [EMAIL PROTECTED] 541-302-1107 ________________________ We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor