Python Forum
Function parameters and values as string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function parameters and values as string
#2
I would recommend to organize your configration settings as a Python dictionary, e.g. = }{

default_style = {
'btn': {'activebackground': "#ff8040", 
        'activeforeground': "#000000"'
        },
'text': {'font': 'xxx'},

'other element': {a dict}
}
dark_theme can be based on default style;

Finally, you can traverse the dictionary and apply configurations to each eleement, e.g do something like this:

def apply_conf(self, conf):
    for k, v in conf.items():
        if hasattr(self, k):
           getattr(self, k).configure(**v)
Reply


Messages In This Thread
RE: Function parameters and values as string - by scidam - Jul-24-2020, 04:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to compare string values in an if statement israelsattleen 1 576 Jul-08-2023, 03:49 PM
Last Post: deanhystad
Question How to compare two parameters in a function that has *args? Milan 4 1,309 Mar-26-2023, 07:43 PM
Last Post: Milan
  Adding values with reduce() function from the list of tuples kinimod 10 2,745 Jan-24-2023, 08:22 AM
Last Post: perfringo
  Getting rid of old string values Pedroski55 3 1,065 Oct-11-2022, 10:56 PM
Last Post: Pedroski55
  mutable values to string items? fozz 15 2,946 Aug-30-2022, 07:20 PM
Last Post: deanhystad
  function accepts infinite parameters and returns a graph with those values edencthompson 0 880 Jun-10-2022, 03:42 PM
Last Post: edencthompson
  Convert a string to a function mikepy 8 2,587 May-13-2022, 07:28 PM
Last Post: mikepy
  Function - Return multiple values tester_V 10 4,537 Jun-02-2021, 05:34 AM
Last Post: tester_V
  How can I write a function with three parameters? MehmetAliKarabulut 1 2,446 Mar-04-2021, 10:47 PM
Last Post: Larz60+
  Parameters aren't seen inside function Sancho_Pansa 8 2,975 Oct-27-2020, 07:52 AM
Last Post: Sancho_Pansa

Forum Jump:

User Panel Messages

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