Hey all,

Working on a medium sized Tkinter app. I have it working fine, but I feel like the app isn't as clean as I would like it to be, namely because I have a million labels and different widgets and I can't figure out what to call them... For example, I have a bunch of entry inputs with labels to the left so that people know what to enter in said entry box. Like so:

x = Label(root,text = 'Email')
email = Entry(root,width = 50)

What would be the best thing to call the label (instead of x)? For smaller apps, email_label seems to be fine, but if you have 10 similar labels with slightly less obvious names, what should I call it? I never reference it again.

Anyway, I was just wondering if anybody had a good system for naming these variables so that they don't clutter up the code.

Don't you need the label identifier for the layout manager?

You could go to three character identifier that is somewhat recognizable like 'emz' for email label or 'adz' for address label.

Don't you need the label identifier for the layout manager?

You could go to three character identifier that is somewhat recognizable like 'emz' for email label or 'adz' for address label.

Well you can say Label(root,text="I'm a label!").grid(row = 0,column = 0) so no, you don't have to.

Well you can say Label(root,text="I'm a label!").grid(row = 0,column = 0) so no, you don't have to.

Correct, but that gets to be messy too. I rather do my layouts in one spot, if there are lots of widgets.

This article has been dead for over six months. Start a new discussion instead.