Python Forum
[Tkinter] HOW TO: Set [Label].config() by variable name reference?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] HOW TO: Set [Label].config() by variable name reference?
#5
Thanks Yoriz !!!

Of COURSE - "style" is a LIST, so [] is required !!! My oversight. My brain is foggy.

Just tried it and it works GREAT !!!

Thank you for resolving this for me ... I have been beating my head against a wall for hours, and never would have gotten the solution but for your input. This really simplifies my code. I can either load styles from an array, or I can give each style a descriptive name! WOOHOO!

I'll edit my previous post and show the correction, and mark the thread as solved.

Blessings in abundance, all the best, & ENJOY!
Art in Carlisle, PA USA

Thank you Yoriz !!!

In line 19 of the code in the 3rd post in this thread (I can't edit it!) ...
  cBox[0].config(**style(i))
  #   SHOULD BE:
  cBox[0].config(**style[i])
  #                     ^ ^
That resolves the error and the demo runs fine

Blessings!
Art in Carlisle, PA USA
Reply


Messages In This Thread
RE: HOW TO: Set [Label].config() by variable name reference? - by gazoxtapod - Apr-17-2019, 09:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  update text variable on label with keypress knoxvilles_joker 3 4,945 Apr-17-2021, 11:21 PM
Last Post: knoxvilles_joker
  Printing Variable into the label ardvci 5 3,121 Mar-19-2020, 09:35 PM
Last Post: joe_momma
  [Tkinter] Unable to save filepath to config.ini file using filedialog.askopenfilename JackMack118 10 5,013 Dec-29-2019, 08:12 PM
Last Post: JackMack118
  [Tkinter] Trying to display a variable in a label Jordansonatina 2 17,860 Oct-31-2019, 06:28 PM
Last Post: Jordansonatina
  [Tkinter] can't update label to include variable foxtreat 2 3,670 Dec-01-2018, 07:16 AM
Last Post: jfong
  printing option menu variable in label in Tkinter SmokerX 1 6,635 Jan-18-2018, 07:36 PM
Last Post: SmokerX

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020