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?
#1
Esteemed Forum Participants and Lurkers:
========================================
Python 3.5.2 (Linux Mint 18.3 Mate 64-bit) Tk 8.6.5 IDLE 3.5.2

I am NOT a software developer, but I have been a hobyist/hacker since I first had unlimited access to a Bendix G15 (vacuum tube!) computer a "few" years ago.

I am trying to create an app with tkinter that involves a primitve level of 'animation' in a tkinter widget main window. So far I can create a grid array (a List) of single-character tk.Labels and operate on them to change foreground and background colors, bold/normal style, text cursor, and text (by variable reference), all using the {label}.config() widget option, as shown in the following example:

cBox[n].config(font=("Liberation Mono", 20, "bold"), fg="red3", bg="pink")
I have about 10 different 'styles' of Labels. I have found docs on how to change the font by variable reference, but is there any way to define a full ".config()" and reference the various configs by a defined name?

I have been searching for hours, and have come up with some very interesting web sites, but no help on "config by name". Thank you for any and all comments, suggestions, and assistance in this effort.

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

Confucius c. 500 BC: Love of knowledge (Python tkinter) without the love of learning (interminable searching) falls into presumption (and abject frustration).
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  update text variable on label with keypress knoxvilles_joker 3 4,954 Apr-17-2021, 11:21 PM
Last Post: knoxvilles_joker
  Printing Variable into the label ardvci 5 3,137 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,036 Dec-29-2019, 08:12 PM
Last Post: JackMack118
  [Tkinter] Trying to display a variable in a label Jordansonatina 2 17,877 Oct-31-2019, 06:28 PM
Last Post: Jordansonatina
  [Tkinter] can't update label to include variable foxtreat 2 3,678 Dec-01-2018, 07:16 AM
Last Post: jfong
  printing option menu variable in label in Tkinter SmokerX 1 6,641 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